diff --git a/.eslintrc.js b/.eslintrc.js index db60f507..27f3d446 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -38,6 +38,7 @@ module.exports = { '@typescript-eslint/no-unsafe-assignment': 'warn', '@typescript-eslint/no-unsafe-member-access': 'warn', '@typescript-eslint/explicit-module-boundary-types': 'off', + '@typescript-eslint/no-explicit-any': 'warn', }, }, ], diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27c0fed4..05b2cb29 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,21 +14,21 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x] + node-version: [20.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - name: test run: | + corepack enable yarn yarn build - yarn jest --coverage + yarn test:coverage - name: report - uses: coverallsapp/github-action@v1.0.1 + uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: ./coverage/lcov.info diff --git a/.gitignore b/.gitignore index ff3addee..f352f076 100644 --- a/.gitignore +++ b/.gitignore @@ -11,9 +11,15 @@ package-lock.json *.log .DS_Store -# Editor -.vscode - # gatsby .cache website/public + +# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions diff --git a/.husky/commit-msg b/.husky/commit-msg new file mode 100644 index 00000000..2785bc1d --- /dev/null +++ b/.husky/commit-msg @@ -0,0 +1 @@ +yarn commitlint --edit $1 diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100644 index 00000000..37236231 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1 @@ +yarn lint-staged diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..a1773c00 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "search.exclude": {".yarn": true} +} diff --git a/.yarn/plugins/plugin-dedupe-on-install.cjs b/.yarn/plugins/plugin-dedupe-on-install.cjs new file mode 100644 index 00000000..950dcd18 --- /dev/null +++ b/.yarn/plugins/plugin-dedupe-on-install.cjs @@ -0,0 +1,22 @@ +module.exports = { + name: `plugin-dedupe-on-install`, + factory: (require) => { + const {execute} = require('@yarnpkg/shell') + return { + hooks: { + // yarn / yarn install / yarn add / yarn dedupe -> afterAllInstalled + async afterAllInstalled() { + // use env var to prevent infinite loops + if (!process.env.DEDUPED && !process.argv.includes('dedupe')) { + process.env.DEDUPED = 'yes' + // fast check for duplicates + if (await execute('yarn dedupe --check')) { + // run actual dedupe/link step + await execute('yarn dedupe') + } + } + }, + }, + } + }, +} diff --git a/.yarn/plugins/plugin-hook-scripts.cjs b/.yarn/plugins/plugin-hook-scripts.cjs new file mode 100644 index 00000000..fe023f74 --- /dev/null +++ b/.yarn/plugins/plugin-hook-scripts.cjs @@ -0,0 +1,22 @@ +module.exports = { + name: `plugin-hook-scripts`, + factory: (require) => { + /** @type {import('@yarnpkg/core')} */ + const {scriptUtils} = require('@yarnpkg/core') + return { + hooks: { + async afterAllInstalled( + /** @type {import('@yarnpkg/core').Project} */ project + ) { + const script = 'yarn:afterAllInstalled' + const locator = project.topLevelWorkspace.anchoredLocator + if (await scriptUtils.hasPackageScript(locator, script, {project})) { + await scriptUtils.executePackageScript(locator, script, [], { + project, + }) + } + }, + }, + } + }, +} diff --git a/.yarnrc.yml b/.yarnrc.yml new file mode 100644 index 00000000..1ad9a0ed --- /dev/null +++ b/.yarnrc.yml @@ -0,0 +1,9 @@ +nodeLinker: node-modules + +plugins: + - checksum: 7930a64ba6239d4502df0204edda913788df1a9614a9056d23b53345d844f6f13526dae71c2be5282071502c3c077db7b1e97bcf019037db3ca35c737cd25b0c + path: .yarn/plugins/plugin-dedupe-on-install.cjs + spec: "https://raw.githubusercontent.com/ambar/yarn-plugin-dedupe-on-install/main/index.js" + - checksum: 2bf08235ccdfb0b95f511d4f0b0383a14de6c06e0c37e20e61c6ba939b85934542fbc6ff502387858722ac8b10f24c6b0a28a93536b628bd2e9446a491b40f29 + path: .yarn/plugins/plugin-hook-scripts.cjs + spec: "https://raw.githubusercontent.com/ambar/yarn-plugin-hook-scripts/main/index.js" diff --git a/example/index.html b/example/index.html index 94978744..532ce810 100644 --- a/example/index.html +++ b/example/index.html @@ -15,10 +15,10 @@