Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract libmmel out as a separate package #104

Draft
wants to merge 63 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
271ebc2
refactor(mmel): Extract libmmel out as a separate package
ribose-jeffreylau Feb 2, 2023
478db2f
chore: Normalize paths to '@/' alias
ribose-jeffreylau Jun 1, 2023
ed2ff0b
chore: Normalize more paths to '@/' alias
ribose-jeffreylau Jul 14, 2023
c033c54
chore(package.json): Add "tsc" scripts for comparison
ribose-jeffreylau Jul 12, 2023
603cacc
chore: Upgrade paneron dependencies
ribose-jeffreylau Jul 12, 2023
88f03b7
chore: Align node packages with Paneron, extension-kit, etc.
ribose-jeffreylau Jul 12, 2023
5bfcc5b
chore: Update @emotion/* packages
ribose-jeffreylau Jul 12, 2023
a1bc908
fix: Update wording for error message in XMLParser
ribose-jeffreylau Jul 13, 2023
147a752
chore: Remove jest from legacy
ribose-jeffreylau Jul 12, 2023
6e387e1
Revert "chore: Remove jest from legacy"
ribose-jeffreylau Jul 14, 2023
fb73780
fix(build): Add typescript-transform-paths
ribose-jeffreylau Jul 18, 2023
42c8c97
chore(build): Clean up tsconfig.json
ribose-jeffreylau Jul 18, 2023
9f243f3
chore(build): Add configs for transform-typescript-paths
ribose-jeffreylau Jul 18, 2023
31902be
chore(build): Fix tsconfig paths
ribose-jeffreylau Jul 18, 2023
0fa431e
chore(build): Align build configs for libmmel
ribose-jeffreylau Jul 18, 2023
9907d40
chore(build): Add tsconfig-paths
ribose-jeffreylau Jul 18, 2023
2645a5a
chore(build): Use "tsconfig-paths/register"
ribose-jeffreylau Jul 18, 2023
b94ea5d
chore(build): Clean up tsconfigs
ribose-jeffreylau Jul 18, 2023
825c1cf
chore(swc): Fix path aliases
ribose-jeffreylau Jul 20, 2023
4f7414f
chore(tsconfig): Use importHelpers to DRY up output
ribose-jeffreylau Jul 20, 2023
40da098
chore(tsconfig): Remove explicit typeRoots
ribose-jeffreylau Jul 20, 2023
ce4300b
chore(tsconfig): Remove useless paths
ribose-jeffreylau Jul 20, 2023
2f4a671
chore(tsconfig): Remove use of */register
ribose-jeffreylau Jul 20, 2023
7eb645c
refactor(mmel): Move libmmel out
ribose-jeffreylau Jul 31, 2023
17e13cf
chore: Update libmmel to 0.0.1-dev.5
ribose-jeffreylau Aug 8, 2023
66da23b
chore(eslint): Add rules for JSON
ribose-jeffreylau Aug 15, 2023
1d3c478
chore: Upgrade typescript to 5.1.6
ribose-jeffreylau Aug 8, 2023
2fa1a24
chore(npm): Add tslib for TS2354
ribose-jeffreylau Aug 15, 2023
85ba9ea
chore(ci): Remove support for building on windows
ribose-jeffreylau Aug 15, 2023
00cede0
chore(ci): Only test with Paneron v2.1.4
ribose-jeffreylau Aug 16, 2023
2d78c55
chore: Remove comments from compiled outputs
ribose-jeffreylau Aug 16, 2023
34a4dd0
chore(npm): Add bump and bump:dev scripts
ribose-jeffreylau Aug 16, 2023
68ea9cc
chore: Add test:dist to test sanity of output artifacts
ribose-jeffreylau Aug 16, 2023
3dbd2be
chore(ts): Add "types" in package.json
ribose-jeffreylau Aug 16, 2023
65f1a10
chore(ts): Add "typesVersions" in package.json
ribose-jeffreylau Aug 16, 2023
cc05399
chore(package.json): Remove leading slash in "files"
ribose-jeffreylau Aug 16, 2023
506c65c
chore: Add @codeceptjs/configure for config typing
ribose-jeffreylau Aug 16, 2023
e2e5d45
chore(ci): Tighten up test-dist with more debug logs
ribose-jeffreylau Aug 16, 2023
1bfd761
chore: Add ts-patch to activate typescript-transform-paths for *.d.ts
ribose-jeffreylau Aug 16, 2023
cb877c2
chore(ci): Rename tests.yml to reflect current status
ribose-jeffreylau Aug 16, 2023
9bbe127
fix(ci): Fix copying of updated package.json before publishing
ribose-jeffreylau Aug 17, 2023
49a3d21
chore: Sync react-* versions with @paneron/paneron
ribose-jeffreylau Aug 17, 2023
fd75e01
fix: Calm down react by adding "... @jsx ..."
ribose-jeffreylau Aug 17, 2023
2feae24
chore(mmel): Upgrade @paneron/libmmel to 0.0.1
ribose-jeffreylau Aug 17, 2023
1eac354
chore(extension): Update requiredHostAppVersion to ^2.0.0
ribose-jeffreylau Aug 17, 2023
dd88ac2
chore(eslint): Add rules for react-hooks
ribose-jeffreylau Aug 17, 2023
2c46cb4
chore: Remove anything nodejs-related
ribose-jeffreylau Aug 18, 2023
a8216a3
chore(typescript): Emit error for imports not used as values
ribose-jeffreylau Aug 18, 2023
96c2990
chore(lint): Add rules to aid fixing of import type issues
ribose-jeffreylau Aug 18, 2023
aec4b72
chore(types): Make import of types explicit
ribose-jeffreylau Aug 18, 2023
bbe01cc
chore(types): Remove problematic type imports
ribose-jeffreylau Aug 18, 2023
a084cf2
chore(extension): Update requiredHostAppVersion to ^2.2.0
ribose-jeffreylau Aug 18, 2023
66bf4ce
chore(mmel): Upgrade @paneron/libmmel to 0.1.3
ribose-jeffreylau Aug 18, 2023
9d6210c
chore(ci): Rename tests workflow
ribose-jeffreylau Aug 18, 2023
17669b0
chore(ci): Remove unused job step
ribose-jeffreylau Aug 18, 2023
5ac847a
docs(README): Place badge for released version first
ribose-jeffreylau Aug 18, 2023
a1669de
chore(repo): Rename from hls to smart
ribose-jeffreylau Aug 18, 2023
1437477
chore(npm): Implement 'dist:watch' to streamline development
ribose-jeffreylau Aug 24, 2023
b0e5db9
build: Add and configure husky (git hooks), commitizen, commitlint, etc
ribose-jeffreylau Aug 24, 2023
35923b2
chore(npm): Upgrade extension-kit to 2.2.0
ribose-jeffreylau Aug 28, 2023
6cb4229
refactor(mmel): Remove all mentions of MMELToText and textToMMEL
ribose-jeffreylau Aug 29, 2023
3c32c38
chore: Remove certain checks for Paneron version, etc
ribose-jeffreylau Aug 29, 2023
3b18ad9
chore(logger): Add warn()
ribose-jeffreylau Aug 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
38 changes: 37 additions & 1 deletion packages/legacy/.eslintrc.js → .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,24 @@ var rules = {
'no-empty-function' : 'off',
'react/prop-types' : 'off',
'react/no-unknown-property' : ['error', { ignore : ['css'] }],
'@typescript-eslint/consistent-type-imports' : [
'error',
{
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
}
],
'@typescript-eslint/no-empty-function' : 'off',
'@typescript-eslint/no-import-type-side-effects': 'error',
'@typescript-eslint/no-non-null-asserted-nullish-coalescing' : 'warn',
'no-unused-vars' : 'off',
'@typescript-eslint/no-unused-vars' : 'warn',
'@emotion/jsx-import' : 'error',
'@emotion/no-vanilla' : 'error',
'@emotion/import-from-emotion' : 'error',
'@emotion/styled-import' : 'error',
'react-hooks/rules-of-hooks': 'error', // Checks rules of Hooks
'react-hooks/exhaustive-deps': 'warn', // Checks effect dependencies
};

module.exports = {
Expand All @@ -153,12 +163,38 @@ module.exports = {
typescript : {}
}
},
"rules" : rules,
overrides : [
{
files : ["*.ts", "*.tsx"],
plugins: [
"react-hooks",
],
rules : rules,
},
{
extends : [],
parser : null,
parserOptions : {},
settings : {},
files : ["*.js"],
rules : rules,
},
{
"files" : ["*.json", "*.json5", "*.jsonc"],
parser: "jsonc-eslint-parser",
parserOptions : {},
extends: [
// add more generic rulesets here, such as:
// 'eslint:recommended',
// "plugin:jsonc/recommended-with-jsonc",
],
"rules" : {
"key-spacing" : "off",
"max-len" : "off",
"quote-props" : ["error", "always"],
"quotes" : ["error", "double"],
},
},
{
"files" : ["spec/**"],
"plugins" : ["jest", "@emotion"],
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ jobs:
- uses: actions/setup-node@v3
id: setup-node
with:
node-version: ${{ matrix.node }}
node-version: 20

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

# See: https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: tests
name: build & test

on:
workflow_call:
Expand All @@ -15,7 +15,7 @@ on:
- '**.nix'
- 'flake.lock'
- '.github/workflows/*.yml'
- '!.github/workflows/tests.yml'
- '!.github/workflows/build-and-test.yml'
- '!.github/workflows/lint.yml'
- '!.github/workflows/build.yml'
- '!.github/workflows/test.yml'
Expand All @@ -33,9 +33,6 @@ on:
- 'flake.lock'
workflow_dispatch:

env:
CACHE_DIR: installs

jobs:
lint:
uses: ./.github/workflows/lint.yml
Expand All @@ -44,9 +41,7 @@ jobs:
uses: ./.github/workflows/build.yml

test:
needs: [build]
uses: ./.github/workflows/test.yml

test-e2e:
needs: [build]
uses: ./.github/workflows/test-e2e.yml
37 changes: 12 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@ on:
workflow_dispatch:

env:
CACHE_DIR: installs
CACHE_DIR: dist
MAIN_PACKAGE_PATH: packages/legacy

jobs:
build:
name: Build
runs-on: ${{ matrix.os }}
runs-on: ubuntu-latest

concurrency:
group: '${{ github.workflow }}-build-${{ matrix.node }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: ['14.x', '16.x', '18.x']
node: [16, 18, 20]

steps:
- uses: actions/checkout@v3
Expand All @@ -29,9 +32,7 @@ jobs:
# results down the file
id: build-cache-key
run: |
if command -v shasum; then sum() { shasum -a 256 "$@"; } ; else sum() { sha256sum "$@"; }; fi
fragment=$(< package.json command grep 'version"\|"name"\|"files"\|"main"\|"build' | sum | command head -c8)
echo "key=build-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/src/**', '**/.swcrc', '**/.npmrc', '**/tsconfig*.json', '**/pnpm-lock.yaml', '.github/workflows/build.yml') }}-${fragment}" | tee -a $GITHUB_OUTPUT
echo "key=build-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', '**/src/**', '**/.swcrc', '**/.npmrc', '**/tsconfig*.json', '**/pnpm-lock.yaml', '.github/workflows/build.yml') }}" | tee -a $GITHUB_OUTPUT
shell: bash

- name: Restore build cache
Expand All @@ -52,7 +53,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

# See: https://github.com/pnpm/action-setup#use-cache-to-reduce-installation-time
Expand All @@ -76,28 +77,14 @@ jobs:
if: steps.build_cache.outputs.cache-hit != 'true'
run: pnpm install --frozen-lockfile --strict-peer-dependencies

# For rsync support in Windows
- uses: GuillaumeFalourd/[email protected]
if: ${{ startsWith(runner.os, 'windows') && steps.build_cache.outputs.cache-hit != 'true' }}

- name: Build cache on ${{ runner.os }}
if: steps.build_cache.outputs.cache-hit != 'true'
shell: bash
run: |
pnpm run -r build-dist
pnpm run dist

- name: Save built artefacts to cache
- name: Test build artifacts sanity
if: steps.build_cache.outputs.cache-hit != 'true'
shell: bash
run: |
# Due to GitHub's stupid cp, need to use rsync instead.
for i in dist; do \
mkdir -p ${{ env.CACHE_DIR }}/"${MAIN_PACKAGE_PATH}" ; \
ls -la "${MAIN_PACKAGE_PATH}/$i"; \
echo rsync -a "${MAIN_PACKAGE_PATH}/$i" ${{ env.CACHE_DIR }}/"${MAIN_PACKAGE_PATH}/"; \
rsync -a "${MAIN_PACKAGE_PATH}/$i" ${{ env.CACHE_DIR }}/"${MAIN_PACKAGE_PATH}/"; \
done
echo ls -la ${{ env.CACHE_DIR }}
ls -la ${{ env.CACHE_DIR }}
echo ls -la ${{ env.CACHE_DIR }}/**
ls -la ${{ env.CACHE_DIR }}/**
pnpm run test:dist
21 changes: 9 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,36 @@ env:

jobs:
lint:
name: Lint on NodeJS ${{ matrix.node }}
name: Lint
runs-on: ubuntu-latest

concurrency:
group: '${{ github.workflow }}-lint-${{ matrix.node }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true

strategy:
fail-fast: false
matrix:
node: ['18.x']
node: [20]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Calculate a fragment of cache key
id: cache-key
run: |
echo "fragment=$(< package.json command grep '"lint"' | command sha256sum | command head -c8)" >> $GITHUB_OUTPUT
shell: bash

- name: Restore test cache
id: test_cache
uses: actions/cache@v3
with:
path: ${{ env.CACHE_TEST_DIR }}
key: lint-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/*eslintrc*', '**/.*eslintrc*', '**/src/**', '**/pnpm-lock.yaml') }}-${{ steps.cache-key.outputs.fragment }}
key: lint-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', '**/*eslintrc*', '**/.*eslintrc*', '**/src/**', '**/pnpm-lock.yaml') }}

- uses: pnpm/action-setup@v2
if: steps.test_cache.outputs.cache-hit != 'true'
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

# See: https:
Expand All @@ -67,6 +65,5 @@ jobs:

- if: steps.test_cache.outputs.cache-hit != 'true'
run: |
pnpm run -r lint-typecheck
pnpm run lint-typecheck
mkdir -p ${{ env.CACHE_TEST_DIR }}
touch ${{ env.CACHE_TEST_DIR }}/pass
53 changes: 13 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,20 @@ on:
# default: 'false'

env:
CACHE_DIR: installs
MAIN_PACKAGE_PATH: packages/legacy
CACHE_DIR: dist

jobs:
tests:
# XXX: does not skip for some reason
# if: github.events.inputs.skip_tests != 'true'
uses: ./.github/workflows/tests.yml
uses: ./.github/workflows/build-and-test.yml

publish:
needs: [tests]
runs-on: ubuntu-latest
strategy:
matrix:
node: ['16.x']
node: [18]
fail-fast: false

steps:
Expand All @@ -47,9 +46,7 @@ jobs:
# results down the file
id: build-cache-key
run: |
if command -v shasum; then sum() { shasum -a 256 "$@"; } ; else sum() { sha256sum "$@"; }; fi
fragment=$(< package.json command grep 'version"\|"name"\|"files"\|"main"\|"build' | sum | command head -c8)
echo "key=build-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('**/src/**', '**/.swcrc', '**/.npmrc', '**/tsconfig*.json', '**/pnpm-lock.yaml', '.github/workflows/build.yml') }}-${fragment}" | tee -a $GITHUB_OUTPUT
echo "key=build-${{ runner.os }}-${{ matrix.node }}-${{ hashFiles('package.json', '**/src/**', '**/.swcrc', '**/.npmrc', '**/tsconfig*.json', '**/pnpm-lock.yaml', '.github/workflows/build.yml') }}" | tee -a $GITHUB_OUTPUT
shell: bash

- uses: actions/setup-node@v3
Expand All @@ -62,7 +59,7 @@ jobs:
name: Install pnpm
id: pnpm-install
with:
version: 7
version: 8
run_install: false

# See: https:
Expand All @@ -84,56 +81,32 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile --strict-peer-dependencies

# For rsync support in Windows
- uses: GuillaumeFalourd/[email protected]
if: startsWith(runner.os, 'windows')

- name: Restore cache
id: build_cache
uses: actions/cache@v3
with:
path: ${{ env.CACHE_DIR }}
key: ${{ steps.build-cache-key.outputs.key }}

- name: Restore cache to working directory
shell: bash
run: |
echo ls -la ${{ env.CACHE_DIR }}/
ls -la ${{ env.CACHE_DIR }}/
echo ls -la ${{ env.CACHE_DIR }}/*
ls -la ${{ env.CACHE_DIR }}/*
echo ls -la .
ls -la .
for i in dist; do \
echo rsync -a ${{ env.CACHE_DIR }}/"${MAIN_PACKAGE_PATH}/$i" "${MAIN_PACKAGE_PATH}/"; \
rsync -a ${{ env.CACHE_DIR }}/"${MAIN_PACKAGE_PATH}/$i" "${MAIN_PACKAGE_PATH}/"; \
done
echo ls -la .
ls -la .
echo ls -la "${MAIN_PACKAGE_PATH}"/dist
ls -la "${MAIN_PACKAGE_PATH}"/dist
echo ls -la "${MAIN_PACKAGE_PATH}"/dist/*
ls -la "${MAIN_PACKAGE_PATH}"/dist/*

- name: Create a new version
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip' }}
if: ${{ github.event_name == 'workflow_call' || github.event_name == 'workflow_dispatch' && github.event.inputs.next_version != 'skip' }}
shell: bash
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"

cd "${MAIN_PACKAGE_PATH}"
pnpm version --new-version ${{ github.event.inputs.next_version }}
git add -u
git commit -m "chore: Release ${{ github.event.inputs.next_version }}"
git tag -a "${{ github.event.inputs.next_version }}" -mBump
# cd to where project package.json is
# pnpm version \
# --new-version ${{ github.event.inputs.next_version }} \
# --message "chore: Release ${{ github.event.inputs.next_version }}"
pnpm bump-version ${{ github.event.inputs.next_version }}

# Push commit along with tag
git push origin --tags :

- name: Publish to npm
run: |
cd "${MAIN_PACKAGE_PATH}"
diff -u {,dist/}package.json | \
diff -u {,dist/}package.json || \
cp {,dist/}package.json
pnpm publish dist --access public --no-git-checks
env:
Expand Down
Loading