From 8205497215e43cfbacf071114042c4ec04085881 Mon Sep 17 00:00:00 2001 From: Andrew Powell Date: Thu, 15 Jul 2021 12:59:59 -0400 Subject: [PATCH] chore(repo): automatically publish packages (#940) * chore(repo): automatically publish * fix: remove tests from tsconfig include * chore: disable pnpm audit for the time being --- .eslintrc.js | 24 +- .github/workflows/node-windows.yml | 2 +- .github/workflows/pr-title.yml | 25 + .github/workflows/release.yml | 58 + .github/workflows/validate.yml | 5 +- README.md | 12 +- package.json | 36 +- packages/alias/package.json | 13 +- packages/alias/tsconfig.json | 5 +- packages/auto-install/package.json | 13 +- packages/auto-install/tsconfig.json | 5 +- packages/babel/package.json | 11 +- packages/babel/tsconfig.json | 1 + packages/beep/package.json | 4 +- packages/buble/package.json | 13 +- packages/buble/tsconfig.json | 5 +- packages/commonjs/package.json | 13 +- packages/commonjs/tsconfig.json | 1 + packages/data-uri/package.json | 11 +- packages/data-uri/tsconfig.json | 10 +- packages/dsv/package.json | 13 +- packages/dsv/tsconfig.json | 1 + packages/dynamic-import-vars/package.json | 11 +- packages/dynamic-import-vars/tsconfig.json | 1 + packages/eslint/package.json | 13 +- packages/eslint/tsconfig.json | 5 +- packages/graphql/package.json | 13 +- packages/graphql/tsconfig.json | 1 + packages/html/package.json | 13 +- packages/html/tsconfig.json | 5 +- packages/image/package.json | 13 +- packages/image/tsconfig.json | 1 + packages/inject/package.json | 13 +- packages/inject/tsconfig.json | 1 + packages/json/package.json | 13 +- packages/json/tsconfig.json | 1 + packages/legacy/package.json | 13 +- packages/legacy/tsconfig.json | 1 + packages/multi-entry/package.json | 13 +- packages/multi-entry/tsconfig.json | 1 + packages/node-resolve/package.json | 15 +- packages/node-resolve/tsconfig.json | 1 + packages/pluginutils/package.json | 13 +- packages/pluginutils/tsconfig.json | 9 +- packages/replace/package.json | 13 +- packages/replace/tsconfig.json | 1 + packages/run/package.json | 13 +- packages/run/tsconfig.json | 5 +- packages/strip/package.json | 10 +- packages/strip/tsconfig.json | 1 + packages/sucrase/package.json | 13 +- packages/sucrase/tsconfig.json | 1 + packages/typescript/package.json | 13 +- packages/typescript/tsconfig.json | 5 +- packages/url/package.json | 13 +- packages/url/tsconfig.json | 1 + packages/virtual/package.json | 13 +- packages/virtual/tsconfig.json | 5 +- packages/wasm/package.json | 13 +- packages/wasm/tsconfig.json | 5 +- packages/yaml/package.json | 13 +- packages/yaml/tsconfig.json | 1 + pnpm-lock.yaml | 7526 ++++++++++---------- scripts/release.ts | 261 + scripts/tsconfig.json | 4 + shared/tsconfig.json | 4 + tsconfig.base.json | 2 +- 67 files changed, 4486 insertions(+), 3901 deletions(-) create mode 100644 .github/workflows/pr-title.yml create mode 100644 .github/workflows/release.yml mode change 100644 => 120000 packages/alias/tsconfig.json mode change 100644 => 120000 packages/auto-install/tsconfig.json create mode 120000 packages/babel/tsconfig.json mode change 100644 => 120000 packages/buble/tsconfig.json create mode 120000 packages/commonjs/tsconfig.json mode change 100644 => 120000 packages/data-uri/tsconfig.json create mode 120000 packages/dsv/tsconfig.json create mode 120000 packages/dynamic-import-vars/tsconfig.json mode change 100755 => 120000 packages/eslint/tsconfig.json create mode 120000 packages/graphql/tsconfig.json mode change 100644 => 120000 packages/html/tsconfig.json create mode 120000 packages/image/tsconfig.json create mode 120000 packages/inject/tsconfig.json create mode 120000 packages/json/tsconfig.json create mode 120000 packages/legacy/tsconfig.json create mode 120000 packages/multi-entry/tsconfig.json create mode 120000 packages/node-resolve/tsconfig.json mode change 100644 => 120000 packages/pluginutils/tsconfig.json create mode 120000 packages/replace/tsconfig.json mode change 100644 => 120000 packages/run/tsconfig.json create mode 120000 packages/strip/tsconfig.json create mode 120000 packages/sucrase/tsconfig.json mode change 100644 => 120000 packages/typescript/tsconfig.json create mode 120000 packages/url/tsconfig.json mode change 100644 => 120000 packages/virtual/tsconfig.json mode change 100644 => 120000 packages/wasm/tsconfig.json create mode 120000 packages/yaml/tsconfig.json create mode 100644 scripts/release.ts create mode 100644 scripts/tsconfig.json create mode 100644 shared/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js index 42c6d7c33..90211391e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,6 +31,18 @@ module.exports = { tsx: 'never' } ], + 'import/no-extraneous-dependencies': [ + 'error', + { + devDependencies: [ + '**/scripts/**/*.ts', + '**/*.test.*', + '**/test/**/*.js', + '**/test/**/*.ts' + ], + optionalDependencies: false + } + ], 'import/prefer-default-export': 'off', 'import/no-namespace': 'off', 'import/no-named-export': 'off', @@ -51,15 +63,15 @@ module.exports = { }, overrides: [ { - "files": ["**/test/**/*.{js,ts}"], - "rules": { - "no-console": "off" + 'files': ['**/test/**/*.{js,ts}'], + 'rules': { + 'no-console': 'off' } }, { - "files": ["**/*.ts"], - "rules": { - "no-undef": "off" + 'files': ['**/*.ts'], + 'rules': { + 'no-undef': 'off' } } ] diff --git a/.github/workflows/node-windows.yml b/.github/workflows/node-windows.yml index 0ee176ea7..d09e28be8 100644 --- a/.github/workflows/node-windows.yml +++ b/.github/workflows/node-windows.yml @@ -38,4 +38,4 @@ jobs: run: pnpm install --ignore-scripts - name: run tests - run: pnpm run ci:test --filter ...[${{ github.sha }}] + run: pnpm ci:test --filter ...[${{ github.sha }}] diff --git a/.github/workflows/pr-title.yml b/.github/workflows/pr-title.yml new file mode 100644 index 000000000..95b1f299c --- /dev/null +++ b/.github/workflows/pr-title.yml @@ -0,0 +1,25 @@ +name: Pull Request Title Format + +on: + pull_request: + branches: + - '*' + types: + - opened + - reopened + - edited + - synchronize + +jobs: + prTitle: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Check PR Title + uses: clowdhaus/actions/pr-title@v0.1.0 + with: + on-fail-message: "Your PR title doesn't match the required format. The title should be in the conventional commit (https://www.conventionalcommits.org/en/v1.0.0-beta.4/) format. e.g.\n\n```\nchore(plugin-name): add pr title workflow\n```" + title-regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([\w|,|\-|\|]+\))?(!)?\:\s.*$' + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..db471231f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release Packages + +on: + push: + branches: + - master + +jobs: + publish: + runs-on: ubuntu-latest + + name: release + + steps: + - name: Checkout Commit + uses: actions/checkout@v1 + + - name: Setup Node + uses: actions/setup-node@v1 + with: + node-version: 14 + + - name: Checkout Main + run: | + git branch -f main origin/main + git checkout main + + - name: Sanity Check + run: | + echo branch `git branch --show-current`; + echo node `node -v`; + + - name: Install pnpm + run: | + npm install pnpm -g; + echo node `pnpm -v`; + + - name: Git Identify + run: | + git config --global user.email "release-workflow@rollup.dev" + git config --global user.name "Release Workflow" + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + + - name: pnpm install + run: pnpm install + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} + + - name: Lint Monorepo + run: pnpm lint + + - name: Run Tests + run: pnpm test --filter [HEAD^] + + - name: Release and Publish Packages + run: pnpm release --filter [HEAD^] + env: + NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index ebe3d8e44..1d5d5f3fa 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -41,8 +41,9 @@ jobs: - name: pnpm install run: pnpm install - - name: Audit Dependencies - run: pnpm security + # pnpm audit isn't as robust as it needs to be atm + # - name: Audit Dependencies + # run: pnpm security - name: Build Packages run: pnpm build --recursive diff --git a/README.md b/README.md index 952adfee0..47b323bbd 100644 --- a/README.md +++ b/README.md @@ -81,7 +81,7 @@ Where `` is the name of the NPM package you wish to add for a plugin pa #### Publishing: ```console -$ pnpm run publish -- [flags] +$ pnpm publish -- [flags] ``` Where `` is the portion of the plugin package name following `@rollup/plugin-`. (e.g. `beep`) @@ -112,13 +112,13 @@ The following flags are available to modify the publish process: To run tests on all packages which have changes: ```console -$ pnpm run test +$ pnpm test ``` To run tests on a specific package: ```console -$ pnpm run test --filter ./packages/ +$ pnpm test --filter ./packages/ ``` Linting: @@ -126,16 +126,16 @@ Linting: To lint all packages which have changes: ```console -$ pnpm run lint +$ pnpm lint ``` To lint a specific package: ```console -$ pnpm run lint --filter ./packages/ +$ pnpm lint --filter ./packages/ ``` -_Note: Scripts in the repository will run the root `test` and `lint` script on those packages which have changes. This is also how the CI pipelines function. To run either on a package outside of that pipeline, use `pnpm run