Skip to content

Commit

Permalink
chore(repo): automatically publish packages (#940)
Browse files Browse the repository at this point in the history
* chore(repo): automatically publish

* fix: remove tests from tsconfig include

* chore: disable pnpm audit for the time being
  • Loading branch information
shellscape authored Jul 15, 2021
1 parent d71c55b commit 8205497
Show file tree
Hide file tree
Showing 67 changed files with 4,486 additions and 3,901 deletions.
24 changes: 18 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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'
}
}
]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/node-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}]
25 changes: 25 additions & 0 deletions .github/workflows/pr-title.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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 "[email protected]"
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}}
5 changes: 3 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Where `<package>` is the name of the NPM package you wish to add for a plugin pa
#### Publishing:

```console
$ pnpm run publish -- <name> [flags]
$ pnpm publish -- <name> [flags]
```

Where `<name>` is the portion of the plugin package name following `@rollup/plugin-`. (e.g. `beep`)
Expand Down Expand Up @@ -112,30 +112,30 @@ 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/<name>
$ pnpm test --filter ./packages/<name>
```

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/<name>
$ pnpm lint --filter ./packages/<name>
```

_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 <script> -- @rollup/plugin-<name>`._
_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 <script> -- @rollup/plugin-<name>`._

## Adding Plugins

Expand Down
36 changes: 20 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,41 @@
"lint:js": "eslint --cache packages scripts shared util --ext .js,.ts",
"lint:json": "prettier --write **/tsconfig*.json **/*.{yml,yaml}",
"lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package",
"plugin:release": "ts-node ./scripts/release.ts",
"preinstall": "node scripts/disallow-npm.js",
"pub": "node scripts/pub.js",
"publish": "node scripts/publish.js",
"security": "pnpm audit --audit-level=high"
},
"dependencies": {
"conventional-commits-parser": "^3.1.0",
"semver": "^7.3.2",
"write-pkg": "^4.0.0"
},
"devDependencies": {
"@ava/babel": "^1.0.1",
"@ava/babel": "2.0.0",
"@types/conventional-commits-parser": "^3.0.2",
"@types/semver": "^7.3.7",
"@types/source-map-support": "^0.5.4",
"@types/yargs-parser": "^20.2.1",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"ava": "^3.15.0",
"chalk": "^4.1.0",
"codecov-lite": "^1.0.3",
"del-cli": "^3.0.1",
"codecov-lite": "2.0.0",
"conventional-commits-parser": "^3.2.1",
"del-cli": "4.0.0",
"eslint-config-rollup": "^1.0.0",
"esm": "^3.2.25",
"execa": "^5.1.1",
"globby": "^11.0.1",
"husky": "^4.2.5",
"lint-staged": "^10.5.2",
"husky": "7.0.1",
"lint-staged": "11.0.1",
"nyc": "^15.1.0",
"pnpm": "5.13.5",
"pnpm": "6.10.0",
"prettier": "^2.2.1",
"prettier-plugin-package": "^1.3.0",
"ts-node": "^8.10.2",
"semver": "^7.3.2",
"source-map-support": "^0.5.19",
"ts-node": "10.1.0",
"tsconfig-paths": "^3.9.0",
"typescript": "^3.9.7",
"yaml": "^1.10.0"
"typescript": "4.3.5",
"write-pkg": "^4.0.0",
"yaml": "^1.10.0",
"yargs-parser": "^20.2.9"
},
"ava": {
"files": [
Expand Down
13 changes: 7 additions & 6 deletions packages/alias/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm build && pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose",
"ci:test": "pnpm test -- --verbose",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm -w run lint && pnpm run test",
"pretest": "pnpm run build",
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
"test": "ava",
"test:ts": "tsc --noEmit"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/alias/tsconfig.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/alias/tsconfig.json
13 changes: 7 additions & 6 deletions packages/auto-install/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
"module": "dist/index.es.js",
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm build && pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose",
"ci:test": "pnpm test -- --verbose",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm -w run lint",
"pretest": "pnpm run build",
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
"test": "ava",
"test:ts": "tsc --noEmit"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/auto-install/tsconfig.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/auto-install/tsconfig.json
11 changes: 6 additions & 5 deletions packages/babel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm build && pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose",
"ci:test": "pnpm test -- --verbose",
"prebuild": "del-cli dist",
"prepublishOnly": "pnpm -w run lint && pnpm run test && pnpm run build && pnpm run test:ts",
"pretest": "pnpm run build",
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
"test": "ava",
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
Expand Down
1 change: 1 addition & 0 deletions packages/babel/tsconfig.json
4 changes: 2 additions & 2 deletions packages/beep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"node": ">= 8.0.0"
},
"scripts": {
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run lint",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "ava --verbose",
"test": "ava"
Expand Down
13 changes: 7 additions & 6 deletions packages/buble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm build && pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose",
"ci:test": "pnpm test -- --verbose",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm -w run lint && pnpm run test",
"pretest": "pnpm run build",
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
"test": "ava",
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/buble/tsconfig.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/buble/tsconfig.json
13 changes: 7 additions & 6 deletions packages/commonjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
},
"scripts": {
"build": "rollup -c",
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm run build && pnpm run lint",
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
"ci:lint": "pnpm build && pnpm lint",
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
"ci:test": "pnpm run test -- --verbose && pnpm run test:ts",
"ci:test": "pnpm test -- --verbose && pnpm test:ts",
"prebuild": "del-cli dist",
"prepare": "pnpm run build",
"prepublishOnly": "pnpm -w run lint && pnpm run test:ts",
"pretest": "pnpm run build",
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
"prerelease": "pnpm build",
"pretest": "pnpm build",
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
"test": "ava",
"test:ts": "tsc types/index.d.ts test/types.ts --noEmit"
},
Expand Down
1 change: 1 addition & 0 deletions packages/commonjs/tsconfig.json
Loading

0 comments on commit 8205497

Please sign in to comment.