Skip to content

Commit a63bc1f

Browse files
committed
chore: upgrade infrastructure
1 parent 2d1c8ef commit a63bc1f

18 files changed

+462
-1759
lines changed

.clean-publish

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"withoutPublish": true,
3-
"tempDir": "package"
3+
"tempDir": "package",
4+
"fields": ["scripts", "publishConfig"],
5+
"files": ["**/*.spec.{js,ts}"]
46
}
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
1-
const lernaScopes = require('@commitlint/config-pnpm-scopes')
1+
import scopes from '@commitlint/config-pnpm-scopes'
22

3-
module.exports = {
3+
export default {
44
extends: [
55
'@commitlint/config-conventional',
66
'@commitlint/config-pnpm-scopes'
77
],
88
rules: {
99
'body-max-line-length': [0],
10+
'header-max-length': [0],
1011
'scope-enum': async (ctx) => {
11-
const scopeEnum = await lernaScopes.rules['scope-enum'](ctx)
12+
const scopeEnum = await scopes.rules['scope-enum'](ctx)
1213

1314
return [
1415
scopeEnum[0],
1516
scopeEnum[1],
1617
[
1718
...scopeEnum[2],
1819
'deps',
19-
'dev-deps'
20+
'dev-deps',
21+
'release'
2022
]
2123
]
2224
}

.eslintrc.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"import/dynamic-import-chunkname": "off"
1616
},
1717
"ignorePatterns": [
18-
"packages/*/dist/**/*",
19-
"rollup.config.js"
18+
"packages/*/dist/**/*"
2019
]
2120
}

.github/workflows/checks.yml

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,6 @@ on:
44
branches:
55
- main
66
jobs:
7-
list-workspaces:
8-
runs-on: ubuntu-latest
9-
name: list workspaces
10-
outputs:
11-
matrix: ${{ steps.set-matrix.outputs.matrix }}
12-
steps:
13-
- name: Checkout the repository
14-
uses: actions/checkout@v4
15-
- name: Install Node.js
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: 16
19-
- id: set-matrix
20-
run: node -e "console.log('::set-output name=matrix::' + JSON.stringify(fs.readdirSync('packages')))"
21-
size:
22-
runs-on: ubuntu-latest
23-
needs: list-workspaces
24-
strategy:
25-
matrix:
26-
workspace: ${{ fromJson(needs.list-workspaces.outputs.matrix) }}
27-
name: ${{ matrix.workspace }} / size-limit
28-
steps:
29-
- name: Checkout the repository
30-
uses: actions/checkout@v4
31-
- name: Install pnpm
32-
uses: pnpm/action-setup@v2
33-
with:
34-
version: 8
35-
- name: Install Node.js
36-
uses: actions/setup-node@v4
37-
with:
38-
node-version: 16
39-
cache: 'pnpm'
40-
- name: Check size
41-
uses: andresz1/size-limit-action@master
42-
with:
43-
github_token: ${{ secrets.GITHUB_TOKEN }}
44-
package_manager: pnpm
45-
directory: packages/${{ matrix.workspace }}/
467
editorconfig:
478
runs-on: ubuntu-latest
489
name: editorconfig
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import fs from 'fs/promises'
2+
import path from 'path'
3+
4+
const scriptsToFind = process.argv.slice(2)
5+
const workspaceDir = 'packages'
6+
const workspaceFiles = await fs.readdir(workspaceDir, {
7+
withFileTypes: true
8+
})
9+
const foundWorkspaces = {}
10+
11+
for (const file of workspaceFiles) {
12+
if (file.isDirectory()) {
13+
try {
14+
const packageJson = await fs.readFile(path.join(workspaceDir, file.name, 'package.json'), 'utf-8')
15+
const { scripts } = JSON.parse(packageJson)
16+
17+
if (scripts) {
18+
for (const scriptToFind of scriptsToFind) {
19+
if (scripts[scriptToFind]) {
20+
foundWorkspaces[scriptToFind] = foundWorkspaces[scriptToFind] || []
21+
foundWorkspaces[scriptToFind].push(file.name)
22+
}
23+
}
24+
}
25+
} catch (error) {}
26+
}
27+
}
28+
29+
for (const foundWorkspacesKey in foundWorkspaces) {
30+
console.log(foundWorkspacesKey.replaceAll(':', '-') + '=' + JSON.stringify(foundWorkspaces[foundWorkspacesKey]))
31+
}

.github/workflows/release.yml

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

.github/workflows/tests.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ jobs:
99
runs-on: ubuntu-latest
1010
name: list workspaces
1111
outputs:
12-
matrix: ${{ steps.set-matrix.outputs.matrix }}
12+
test-types: ${{ steps.set-matrix.outputs.test-types }}
13+
lint: ${{ steps.set-matrix.outputs.lint }}
14+
test-unit: ${{ steps.set-matrix.outputs.test-unit }}
1315
steps:
1416
- name: Checkout the repository
1517
uses: actions/checkout@v4
@@ -18,13 +20,13 @@ jobs:
1820
with:
1921
node-version: 16
2022
- id: set-matrix
21-
run: node -e "console.log('::set-output name=matrix::' + JSON.stringify(fs.readdirSync('packages')))"
23+
run: node .github/workflows/list-workspaces.js test:types lint test:unit >> $GITHUB_OUTPUT
2224
types:
2325
runs-on: ubuntu-latest
2426
needs: list-workspaces
2527
strategy:
2628
matrix:
27-
workspace: ${{ fromJson(needs.list-workspaces.outputs.matrix) }}
29+
workspace: ${{ fromJson(needs.list-workspaces.outputs.test-types) }}
2830
name: ${{ matrix.workspace }} / types
2931
steps:
3032
- name: Checkout the repository
@@ -41,13 +43,36 @@ jobs:
4143
- name: Install dependencies
4244
run: pnpm install
4345
- name: Check types
44-
run: pnpm --filter ${{ matrix.workspace }} test:types
46+
run: pnpm --filter ${{ matrix.workspace }} --if-present test:types
47+
lint:
48+
runs-on: ubuntu-latest
49+
needs: list-workspaces
50+
strategy:
51+
matrix:
52+
workspace: ${{ fromJson(needs.list-workspaces.outputs.lint) }}
53+
name: ${{ matrix.workspace }} / lint
54+
steps:
55+
- name: Checkout the repository
56+
uses: actions/checkout@v4
57+
- name: Install pnpm
58+
uses: pnpm/action-setup@v2
59+
with:
60+
version: 8
61+
- name: Install Node.js
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: 16
65+
cache: 'pnpm'
66+
- name: Install dependencies
67+
run: pnpm install
68+
- name: Lint files
69+
run: pnpm --filter ${{ matrix.workspace }} --if-present lint
4570
unit:
4671
runs-on: ubuntu-latest
4772
needs: list-workspaces
4873
strategy:
4974
matrix:
50-
workspace: ${{ fromJson(needs.list-workspaces.outputs.matrix) }}
75+
workspace: ${{ fromJson(needs.list-workspaces.outputs.test-unit) }}
5176
name: ${{ matrix.workspace }} / unit
5277
steps:
5378
- name: Checkout the repository
@@ -64,9 +89,9 @@ jobs:
6489
- name: Install dependencies
6590
run: pnpm install
6691
- name: Run tests
67-
run: pnpm --filter ${{ matrix.workspace }} test
92+
run: pnpm --filter ${{ matrix.workspace }} --if-present test:unit
6893
- name: Collect coverage
69-
uses: codecov/codecov-action@v3
94+
uses: codecov/codecov-action@v5
7095
if: success()
7196
with:
7297
files: ./packages/${{ matrix.workspace }}/coverage/lcov.info

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,15 @@ node_modules
2121

2222
# Compiled dist
2323
dist
24-
package
24+
packages/*/package
2525
build
2626

2727
# Env files
2828
.env
29+
30+
# IDE files
31+
.idea
32+
.vscode
33+
34+
# Temporary files
35+
tmp

.nano-staged.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"*.{js,ts,tsx}": "eslint --fix"
2+
"*.{js,ts,cjs}": "eslint --fix"
33
}

package.json

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,47 +15,34 @@
1515
"url": "https://github.com/TrigenSoftware/simple-release-tools/issues"
1616
},
1717
"engines": {
18-
"node": ">=14"
18+
"node": ">=18"
1919
},
2020
"scripts": {
2121
"clear": "pnpm -r --parallel clear",
2222
"build": "pnpm -r --parallel build",
23-
"lint": "eslint '*.{js,cjs}' 'packages/**/*.{js,jsx,ts,tsx}'",
24-
"test:unit": "vitest run --coverage",
25-
"test:unit:watch": "vitest watch",
26-
"test:size": "pnpm -r --parallel --if-present test:size",
27-
"test": "run -p lint test:unit",
23+
"lint": "pnpm -r --parallel --if-present lint",
24+
"test:unit": "pnpm -r --parallel --if-present test:unit",
25+
"test:types": "pnpm -r --parallel --if-present test:types",
26+
"test": "run -p lint test:unit test:types",
2827
"commit": "cz",
29-
"bumpVersion": "standard-version",
30-
"createGithubRelease": "./packages/simple-github-release/dist/index.js",
31-
"release": "run bumpVersion [ git push origin main --tags ] createGithubRelease",
32-
"updateGitHooks": "simple-git-hooks"
28+
"updateGitHooks": "simple-git-hooks",
29+
"release": "echo todo"
3330
},
3431
"devDependencies": {
35-
"@commitlint/cli": "^18.0.0",
36-
"@commitlint/config-conventional": "^18.0.0",
37-
"@commitlint/config-pnpm-scopes": "^18.0.0",
38-
"@commitlint/cz-commitlint": "^18.0.0",
39-
"@rollup/plugin-node-resolve": "^15.0.1",
40-
"@size-limit/file": "^11.0.0",
41-
"@swc/core": "^1.3.20",
42-
"@trigen/browserslist-config": "8.0.0-alpha.27",
32+
"@commitlint/cli": "^19.8.1",
33+
"@commitlint/config-conventional": "^19.8.1",
34+
"@commitlint/config-pnpm-scopes": "^19.8.1",
35+
"@commitlint/cz-commitlint": "^19.8.1",
4336
"@trigen/eslint-config": "8.0.0-alpha.33",
4437
"@trigen/scripts": "8.0.0-alpha.33",
4538
"@types/node": "^20.0.0",
4639
"@vitest/coverage-v8": "^0.34.4",
47-
"browserslist": "^4.21.4",
4840
"clean-publish": "^5.0.0",
4941
"commitizen": "^4.2.4",
5042
"del-cli": "^5.0.0",
5143
"eslint": "^8.28.0",
5244
"nano-staged": "^0.8.0",
53-
"rollup": "^4.0.0",
54-
"rollup-plugin-add-shebang": "^0.3.1",
55-
"rollup-plugin-swc3": "^0.10.0",
5645
"simple-git-hooks": "^2.7.0",
57-
"size-limit": "^11.0.0",
58-
"standard-version": "^9.3.2",
5946
"typescript": "^5.0.0",
6047
"vite": "^5.0.0",
6148
"vitest": "^0.34.4"

0 commit comments

Comments
 (0)