Skip to content

Commit 8205497

Browse files
authored
chore(repo): automatically publish packages (#940)
* chore(repo): automatically publish * fix: remove tests from tsconfig include * chore: disable pnpm audit for the time being
1 parent d71c55b commit 8205497

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+4486
-3901
lines changed

.eslintrc.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ module.exports = {
3131
tsx: 'never'
3232
}
3333
],
34+
'import/no-extraneous-dependencies': [
35+
'error',
36+
{
37+
devDependencies: [
38+
'**/scripts/**/*.ts',
39+
'**/*.test.*',
40+
'**/test/**/*.js',
41+
'**/test/**/*.ts'
42+
],
43+
optionalDependencies: false
44+
}
45+
],
3446
'import/prefer-default-export': 'off',
3547
'import/no-namespace': 'off',
3648
'import/no-named-export': 'off',
@@ -51,15 +63,15 @@ module.exports = {
5163
},
5264
overrides: [
5365
{
54-
"files": ["**/test/**/*.{js,ts}"],
55-
"rules": {
56-
"no-console": "off"
66+
'files': ['**/test/**/*.{js,ts}'],
67+
'rules': {
68+
'no-console': 'off'
5769
}
5870
},
5971
{
60-
"files": ["**/*.ts"],
61-
"rules": {
62-
"no-undef": "off"
72+
'files': ['**/*.ts'],
73+
'rules': {
74+
'no-undef': 'off'
6375
}
6476
}
6577
]

.github/workflows/node-windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ jobs:
3838
run: pnpm install --ignore-scripts
3939

4040
- name: run tests
41-
run: pnpm run ci:test --filter ...[${{ github.sha }}]
41+
run: pnpm ci:test --filter ...[${{ github.sha }}]

.github/workflows/pr-title.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Pull Request Title Format
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '*'
7+
types:
8+
- opened
9+
- reopened
10+
- edited
11+
- synchronize
12+
13+
jobs:
14+
prTitle:
15+
name: Check
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
- name: Check PR Title
21+
uses: clowdhaus/actions/[email protected]
22+
with:
23+
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```"
24+
title-regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([\w|,|\-|\|]+\))?(!)?\:\s.*$'
25+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Release Packages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
name: release
13+
14+
steps:
15+
- name: Checkout Commit
16+
uses: actions/checkout@v1
17+
18+
- name: Setup Node
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 14
22+
23+
- name: Checkout Main
24+
run: |
25+
git branch -f main origin/main
26+
git checkout main
27+
28+
- name: Sanity Check
29+
run: |
30+
echo branch `git branch --show-current`;
31+
echo node `node -v`;
32+
33+
- name: Install pnpm
34+
run: |
35+
npm install pnpm -g;
36+
echo node `pnpm -v`;
37+
38+
- name: Git Identify
39+
run: |
40+
git config --global user.email "[email protected]"
41+
git config --global user.name "Release Workflow"
42+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
43+
44+
- name: pnpm install
45+
run: pnpm install
46+
env:
47+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
48+
49+
- name: Lint Monorepo
50+
run: pnpm lint
51+
52+
- name: Run Tests
53+
run: pnpm test --filter [HEAD^]
54+
55+
- name: Release and Publish Packages
56+
run: pnpm release --filter [HEAD^]
57+
env:
58+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/validate.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ jobs:
4141
- name: pnpm install
4242
run: pnpm install
4343

44-
- name: Audit Dependencies
45-
run: pnpm security
44+
# pnpm audit isn't as robust as it needs to be atm
45+
# - name: Audit Dependencies
46+
# run: pnpm security
4647

4748
- name: Build Packages
4849
run: pnpm build --recursive

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Where `<package>` is the name of the NPM package you wish to add for a plugin pa
8181
#### Publishing:
8282

8383
```console
84-
$ pnpm run publish -- <name> [flags]
84+
$ pnpm publish -- <name> [flags]
8585
```
8686

8787
Where `<name>` is the portion of the plugin package name following `@rollup/plugin-`. (e.g. `beep`)
@@ -112,30 +112,30 @@ The following flags are available to modify the publish process:
112112
To run tests on all packages which have changes:
113113

114114
```console
115-
$ pnpm run test
115+
$ pnpm test
116116
```
117117

118118
To run tests on a specific package:
119119

120120
```console
121-
$ pnpm run test --filter ./packages/<name>
121+
$ pnpm test --filter ./packages/<name>
122122
```
123123

124124
Linting:
125125

126126
To lint all packages which have changes:
127127

128128
```console
129-
$ pnpm run lint
129+
$ pnpm lint
130130
```
131131

132132
To lint a specific package:
133133

134134
```console
135-
$ pnpm run lint --filter ./packages/<name>
135+
$ pnpm lint --filter ./packages/<name>
136136
```
137137

138-
_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>`._
138+
_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>`._
139139

140140
## Adding Plugins
141141

package.json

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,41 @@
88
"lint:js": "eslint --cache packages scripts shared util --ext .js,.ts",
99
"lint:json": "prettier --write **/tsconfig*.json **/*.{yml,yaml}",
1010
"lint:package": "prettier --write **/package.json --plugin=prettier-plugin-package",
11+
"plugin:release": "ts-node ./scripts/release.ts",
1112
"preinstall": "node scripts/disallow-npm.js",
12-
"pub": "node scripts/pub.js",
13-
"publish": "node scripts/publish.js",
1413
"security": "pnpm audit --audit-level=high"
1514
},
16-
"dependencies": {
17-
"conventional-commits-parser": "^3.1.0",
18-
"semver": "^7.3.2",
19-
"write-pkg": "^4.0.0"
20-
},
2115
"devDependencies": {
22-
"@ava/babel": "^1.0.1",
16+
"@ava/babel": "2.0.0",
17+
"@types/conventional-commits-parser": "^3.0.2",
18+
"@types/semver": "^7.3.7",
19+
"@types/source-map-support": "^0.5.4",
20+
"@types/yargs-parser": "^20.2.1",
2321
"@typescript-eslint/eslint-plugin": "^4.9.0",
2422
"@typescript-eslint/parser": "^4.9.0",
2523
"ava": "^3.15.0",
2624
"chalk": "^4.1.0",
27-
"codecov-lite": "^1.0.3",
28-
"del-cli": "^3.0.1",
25+
"codecov-lite": "2.0.0",
26+
"conventional-commits-parser": "^3.2.1",
27+
"del-cli": "4.0.0",
2928
"eslint-config-rollup": "^1.0.0",
3029
"esm": "^3.2.25",
30+
"execa": "^5.1.1",
3131
"globby": "^11.0.1",
32-
"husky": "^4.2.5",
33-
"lint-staged": "^10.5.2",
32+
"husky": "7.0.1",
33+
"lint-staged": "11.0.1",
3434
"nyc": "^15.1.0",
35-
"pnpm": "5.13.5",
35+
"pnpm": "6.10.0",
3636
"prettier": "^2.2.1",
3737
"prettier-plugin-package": "^1.3.0",
38-
"ts-node": "^8.10.2",
38+
"semver": "^7.3.2",
39+
"source-map-support": "^0.5.19",
40+
"ts-node": "10.1.0",
3941
"tsconfig-paths": "^3.9.0",
40-
"typescript": "^3.9.7",
41-
"yaml": "^1.10.0"
42+
"typescript": "4.3.5",
43+
"write-pkg": "^4.0.0",
44+
"yaml": "^1.10.0",
45+
"yargs-parser": "^20.2.9"
4246
},
4347
"ava": {
4448
"files": [

packages/alias/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@
2020
},
2121
"scripts": {
2222
"build": "rollup -c",
23-
"ci:coverage": "nyc pnpm run test && nyc report --reporter=text-lcov > coverage.lcov",
24-
"ci:lint": "pnpm run build && pnpm run lint",
23+
"ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov",
24+
"ci:lint": "pnpm build && pnpm lint",
2525
"ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}",
26-
"ci:test": "pnpm run test -- --verbose",
26+
"ci:test": "pnpm test -- --verbose",
2727
"prebuild": "del-cli dist",
28-
"prepare": "pnpm run build",
29-
"prepublishOnly": "pnpm -w run lint && pnpm run test",
30-
"pretest": "pnpm run build",
28+
"prepare": "if [ ! -d 'dist' ]; then pnpm build; fi",
29+
"prerelease": "pnpm build",
30+
"pretest": "pnpm build",
31+
"release": "pnpm plugin:release --workspace-root -- --pkg $npm_package_name",
3132
"test": "ava",
3233
"test:ts": "tsc --noEmit"
3334
},

packages/alias/tsconfig.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/alias/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../shared/tsconfig.json

0 commit comments

Comments
 (0)