diff --git a/.github/workflows/auto-deprecate.yml b/.github/workflows/auto-deprecate.yml index f529427..32ed695 100644 --- a/.github/workflows/auto-deprecate.yml +++ b/.github/workflows/auto-deprecate.yml @@ -18,7 +18,7 @@ jobs: cache: yarn registry-url: https://registry.npmjs.org/ - name: Install Dependencies - run: yarn --immutable + uses: ./scripts/yarnCache - name: Deprecate versions run: yarn npm-deprecate env: diff --git a/.github/workflows/continuous-delivery.yml b/.github/workflows/continuous-delivery.yml index 419f59c..77bd028 100644 --- a/.github/workflows/continuous-delivery.yml +++ b/.github/workflows/continuous-delivery.yml @@ -39,7 +39,7 @@ jobs: cache: yarn registry-url: https://registry.yarnpkg.com/ - name: Install Dependencies - run: yarn --immutable + uses: ./scripts/yarnCache - name: Bump Version & Publish run: | # Resolve the tag to be used. "next" for push events, "pr-{prNumber}" for dispatch events. diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2d5644d..4afd75c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -22,9 +22,9 @@ jobs: cache: yarn registry-url: https://registry.npmjs.org/ - name: Install Dependencies - run: yarn --immutable + uses: ./scripts/yarnCache - name: Run ESLint - run: yarn lint --fix=false + run: yarn lint -- --fix=false # Testing: # name: Unit Tests @@ -63,7 +63,7 @@ jobs: cache: yarn registry-url: https://registry.npmjs.org/ - name: Install Dependencies - run: yarn --immutable + uses: ./scripts/yarnCache - name: Build Code run: yarn build diff --git a/.github/workflows/deploy-docs-on-publish.yml b/.github/workflows/deploy-docs-on-publish.yml index 44e7d78..be6b156 100644 --- a/.github/workflows/deploy-docs-on-publish.yml +++ b/.github/workflows/deploy-docs-on-publish.yml @@ -22,7 +22,7 @@ jobs: cache: yarn registry-url: https://registry.yarnpkg.com/ - name: Install Dependencies - run: yarn --immutable + uses: ./scripts/yarnCache - name: Build all packages run: yarn build - name: Generate Docs diff --git a/.github/workflows/deprecate-on-merge.yml b/.github/workflows/deprecate-on-merge.yml index 572bea2..d864286 100644 --- a/.github/workflows/deprecate-on-merge.yml +++ b/.github/workflows/deprecate-on-merge.yml @@ -19,7 +19,7 @@ jobs: cache: yarn registry-url: https://registry.npmjs.org/ - name: Install Dependencies - run: yarn --immutable + uses: ./scripts/yarnCache - name: Deprecate versions run: yarn npm-deprecate --name "*pr-${PR_NUMBER}*" -d -v env: diff --git a/package.json b/package.json index 70a7623..25a30c3 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "@commitlint/config-conventional": "^17.6.6", "@favware/cliff-jumper": "^2.1.1", "@favware/npm-deprecate": "^1.0.7", - "@types/is-ci": "^3.0.0", "@types/node": "^20.4.2", "@vitest/coverage-v8": "^0.33.0", "cz-conventional-changelog": "^3.3.0", @@ -30,7 +29,6 @@ "eslint-config-mahir": "^0.0.29", "husky": "^8.0.3", "lint-staged": "^13.2.3", - "pinst": "^3.0.0", "prettier": "^3.0.0", "tsup": "^7.1.0", "turbo": "^1.10.7", diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.ts index 2ffaeef..b8bfb0c 100644 --- a/packages/core/tsup.config.ts +++ b/packages/core/tsup.config.ts @@ -1,7 +1,11 @@ import { esbuildPluginVersionInjector } from 'esbuild-plugin-version-injector'; -import { createTsupConfig } from '../../tsup.config.js'; +import { createTsupConfig } from '../../scripts/tsup.config.js'; export default createTsupConfig({ + dts: { + entry: 'src/index.ts' + }, + entry: ['src/index.ts', 'src/cli.ts'], esbuildPlugins: [esbuildPluginVersionInjector()] }); diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index 41ea8c8..1a02e25 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -1,3 +1,3 @@ -import { createVitestConfig } from '../../vitest.config.js'; +import { createVitestConfig } from '../../scripts/vitest.config.js'; export default createVitestConfig(); diff --git a/tsup.config.ts b/scripts/tsup.config.ts similarity index 85% rename from tsup.config.ts rename to scripts/tsup.config.ts index dd7e889..a683c81 100644 --- a/tsup.config.ts +++ b/scripts/tsup.config.ts @@ -6,10 +6,8 @@ import { defineConfig, type Options } from 'tsup'; export const createTsupConfig = (options: Options = {}) => defineConfig({ clean: true, - dts: { - entry: 'src/index.ts' - }, - entry: ['src/index.ts', 'src/cli.ts'], + dts: true, + entry: ['src/index.ts'], format: ['esm'], minify: false, skipNodeModulesBundle: true, diff --git a/vitest.config.ts b/scripts/vitest.config.ts similarity index 100% rename from vitest.config.ts rename to scripts/vitest.config.ts diff --git a/scripts/yarnCache/action.yml b/scripts/yarnCache/action.yml new file mode 100644 index 0000000..b9f332d --- /dev/null +++ b/scripts/yarnCache/action.yml @@ -0,0 +1,35 @@ +name: 'yarn install' +description: 'Run yarn install with node_modules linker and cache enabled' +runs: + using: 'composite' + steps: + - name: Expose yarn config as "$GITHUB_OUTPUT" + id: yarn-config + shell: bash + run: | + echo "CACHE_FOLDER=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT + + - name: Restore yarn cache + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + id: yarn-download-cache + with: + path: ${{ steps.yarn-config.outputs.CACHE_FOLDER }} + key: yarn-download-cache-${{ hashFiles('yarn.lock') }} + restore-keys: | + yarn-download-cache- + + - name: Restore yarn install state + id: yarn-install-state-cache + uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 + with: + path: .yarn/ci-cache/ + key: ${{ runner.os }}-yarn-install-state-cache-${{ hashFiles('yarn.lock', '.yarnrc.yml') }} + + - name: Install dependencies + shell: bash + run: | + yarn install --immutable --inline-builds + env: + YARN_ENABLE_GLOBAL_CACHE: 'false' + YARN_NM_MODE: 'hardlinks-local' + YARN_INSTALL_STATE_PATH: .yarn/ci-cache/install-state.gz diff --git a/yarn.lock b/yarn.lock index 7c81210..b5328bc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -971,15 +971,6 @@ __metadata: languageName: node linkType: hard -"@types/is-ci@npm:^3.0.0": - version: 3.0.0 - resolution: "@types/is-ci@npm:3.0.0" - dependencies: - ci-info: ^3.1.0 - checksum: 7c1f1f16c1fa2134de7400d82766c83fa76057261ba890628af77a09382ebb92d945bb077b98cfcf3d40ab1469c9ffbd2278112867edbe57aa655f53547eb139 - languageName: node - linkType: hard - "@types/istanbul-lib-coverage@npm:^2.0.1": version: 2.0.4 resolution: "@types/istanbul-lib-coverage@npm:2.0.4" @@ -1883,7 +1874,7 @@ __metadata: languageName: node linkType: hard -"ci-info@npm:^3.1.0, ci-info@npm:^3.8.0": +"ci-info@npm:^3.8.0": version: 3.8.0 resolution: "ci-info@npm:3.8.0" checksum: d0a4d3160497cae54294974a7246202244fff031b0a6ea20dd57b10ec510aa17399c41a1b0982142c105f3255aff2173e5c0dd7302ee1b2f28ba3debda375098 @@ -5661,15 +5652,6 @@ __metadata: languageName: node linkType: hard -"pinst@npm:^3.0.0": - version: 3.0.0 - resolution: "pinst@npm:3.0.0" - bin: - pinst: bin.js - checksum: 4ae48a6a60f79c37071233af51b4d91bfc85cfa3c12b66ccda60cdb642b4d14a4ab0cb3587afc55b1f6192cea1772a5e4822026a0d0d3528296edef00cc2d61f - languageName: node - linkType: hard - "pirates@npm:^4.0.1": version: 4.0.5 resolution: "pirates@npm:4.0.5" @@ -6095,7 +6077,6 @@ __metadata: "@commitlint/config-conventional": ^17.6.6 "@favware/cliff-jumper": ^2.1.1 "@favware/npm-deprecate": ^1.0.7 - "@types/is-ci": ^3.0.0 "@types/node": ^20.4.2 "@vitest/coverage-v8": ^0.33.0 cz-conventional-changelog: ^3.3.0 @@ -6104,7 +6085,6 @@ __metadata: eslint-config-mahir: ^0.0.29 husky: ^8.0.3 lint-staged: ^13.2.3 - pinst: ^3.0.0 prettier: ^3.0.0 tsup: ^7.1.0 turbo: ^1.10.7