Skip to content

Commit dd5e791

Browse files
committed
refactor: rearrange monorepo and packages + ci
1 parent bc2d4ae commit dd5e791

Some content is hidden

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

48 files changed

+15832
-11959
lines changed

.eslintrc

+4-7
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@
1212
},
1313
"import/resolver": {
1414
"node": {
15-
"paths": [
16-
"packages/"
17-
],
18-
"extensions": [
19-
".ts"
20-
]
15+
"paths": ["packages/"],
16+
"extensions": [".ts"]
2117
},
2218
"typescript": {
19+
"project": ["packages/**/*/tsconfig.json"],
2320
"alwaysTryTypes": true
2421
}
2522
}
@@ -63,7 +60,7 @@
6360
"devDependencies": true,
6461
"optionalDependencies": false,
6562
"peerDependencies": false,
66-
"packageDir": "./"
63+
"packageDir": ["./", "packages/*"]
6764
}
6865
],
6966
"@typescript-eslint/consistent-type-imports": [

.github/workflows/ci.yml

+22-33
Original file line numberDiff line numberDiff line change
@@ -17,87 +17,76 @@ jobs:
1717
- name: Checkout
1818
uses: actions/checkout@v4
1919

20-
2120
- name: Use Node ${{ matrix.node-version }}
2221
uses: actions/setup-node@v4
2322
with:
2423
node-version: ${{ matrix.node-version }}
25-
- name: Install pnpm
26-
uses: pnpm/action-setup@v4
27-
with:
28-
version: 9.15.4
29-
- uses: actions/cache@v2
24+
25+
- uses: actions/cache@v4
3026
with:
3127
path: '**/node_modules'
32-
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
28+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
3329

34-
- name: PNPM
35-
run: pnpm install --frozen-lockfile
30+
- name: Install
31+
run: npm ci
3632

3733
- name: Build
38-
run: pnpm run build
34+
run: npm run build
3935

4036
lint:
4137
name: Lint
4238
runs-on: ubuntu-latest
4339
steps:
4440
- name: Checkout
4541
uses: actions/checkout@v4
42+
4643
- name: Setup Node
4744
uses: actions/setup-node@v4
4845
with:
49-
node-version: '22.x'
50-
- name: Install pnpm
51-
uses: pnpm/action-setup@v4
52-
with:
53-
version: 9.15.4
54-
55-
- uses: actions/cache@v2
46+
node-version: '18.x'
47+
48+
- uses: actions/cache@v4
5649
with:
5750
path: '**/node_modules'
58-
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
51+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
5952

60-
- name: PNPM
61-
run: pnpm install --frozen-lockfile
53+
- name: Install
54+
run: npm ci
6255

6356
- name: Lint
64-
run: pnpm run lint
57+
run: npm run lint
6558

6659
- name: Validate Packages
67-
run: pnpm manypkg check
60+
run: npx @manypkg/cli check
6861

6962
test:
7063
name: Test
7164
runs-on: ubuntu-latest
7265
strategy:
7366
matrix:
74-
project: ['doubles.jest', 'doubles.sinon', 'core.unit', 'doubles.vitest', 'di.nestjs', 'di.inversify', 'unit']
67+
project: ['cli', 'differs.openapi', 'compilers.openapi', 'generators.openapi', 'openapi']
7568
steps:
7669
- name: Checkout
7770
uses: actions/checkout@v4
7871

7972
- name: Setup Node
8073
uses: actions/setup-node@v4
8174
with:
82-
node-version: '22.x'
83-
- name: Install pnpm
84-
uses: pnpm/action-setup@v4
85-
with:
86-
version: 9.15.4
75+
node-version: '18.x'
8776

88-
- uses: actions/cache@v2
77+
- uses: actions/cache@v4
8978
with:
9079
path: '**/node_modules'
91-
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }}
80+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
9281

93-
- name: PNPM
94-
run: pnpm install --frozen-lockfile
82+
- name: Yarn
83+
run: yarn --frozen-lockfile
9584

9685
- name: Create Coverage Directory
9786
run: mkdir -p ${{ github.workspace }}/coverage
9887

9988
- name: Test
100-
run: pnpm --filter @contractual/${{ matrix.project }} run test
89+
run: npm run test --workspace=@contractual/${{ matrix.project }}
10190
env:
10291
JEST_JUNIT_OUTPUT_NAME: ${{ matrix.project }}.xml
10392
JEST_JUNIT_OUTPUT_DIR: ${{ github.workspace }}/test-reports

.github/workflows/publish-packages.yml

+23-113
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ on:
2121
- 'beta'
2222
required: true
2323
default: 'dev'
24+
release_branch:
25+
description: 'Release Branch'
26+
type: choice
27+
options:
28+
- 'next'
29+
- 'master'
30+
required: true
31+
default: 'next'
2432
strategy:
2533
description: 'Release Strategy'
2634
type: choice
@@ -29,136 +37,38 @@ on:
2937
- 'from-package'
3038
required: true
3139
default: 'from-package'
32-
40+
target_branch:
41+
description: 'Target branch to release from'
42+
type: choice
43+
options:
44+
- 'next'
45+
- 'master'
46+
required: true
47+
default: 'next'
3348
jobs:
34-
e2e:
35-
name: Build and Test
36-
runs-on: ubuntu-latest
37-
strategy:
38-
matrix:
39-
e2e-project: ['jest/nestjs', 'sinon/nestjs', 'vitest/nestjs', 'jest/inversify', 'sinon/inversify', 'vitest/inversify']
40-
node-version: [16.x, 18.x, 20.x]
41-
exclude:
42-
- e2e-project: 'vitest/inversify'
43-
node-version: '16.x'
44-
- e2e-project: 'vitest/nestjs'
45-
node-version: '16.x'
46-
steps:
47-
- name: Checkout
48-
uses: actions/checkout@v4
49-
with:
50-
ref: ${{ github.event.inputs.target_branch }}
51-
52-
- name: Remove Vitest If Needed
53-
if: ${{ matrix.node-version == '16.x' }}
54-
run: |
55-
rm -rf packages/doubles/vitest
56-
git config --global user.email "[email protected]"
57-
git config --global user.name "Suites CI"
58-
git add .
59-
git commit -am "remove vitest temp"
60-
61-
- name: Setup Node ${{ matrix.node-version }}
62-
uses: actions/setup-node@v4
63-
with:
64-
node-version: ${{ matrix.node-version }}
65-
- name: Install pnpm
66-
uses: pnpm/action-setup@v4
67-
with:
68-
version: 9.15.4
69-
70-
- name: PNPM
71-
run: pnpm install --frozen-lockfile
72-
73-
- name: Run Verdaccio Docker
74-
run: |
75-
docker run -d --name verdaccio \
76-
-p 4873:4873 \
77-
-v ${{ github.workspace }}/e2e/config.yaml:/verdaccio/conf/config.yaml \
78-
verdaccio/verdaccio
79-
80-
- name: Build
81-
run: pnpm build
82-
83-
- name: Setup Registry
84-
uses: actions/setup-node@v4
85-
with:
86-
node-version: ${{ matrix.node-version }}
87-
registry-url: http://localhost:4873
88-
scope: '@suites'
89-
always-auth: false
90-
91-
- name: Install jq
92-
run: sudo apt-get install jq
93-
94-
- name: Remove provenance from publishConfig
95-
run: |
96-
find packages -name 'package.json' | while read filename; do
97-
jq 'del(.publishConfig.provenance)' "$filename" > temp.json && mv temp.json "$filename"
98-
done
99-
100-
- name: Commit Change
101-
run: |
102-
git config --global user.email "[email protected]"
103-
git config --global user.name "Suites e2e"
104-
git add .
105-
git commit -am "remove provenance"
106-
107-
- name: Publish Packages
108-
run: |
109-
pnpm publish -r \
110-
--no-git-checks \
111-
--access public \
112-
--tag ci \
113-
--force
114-
- name: Setup and Test
115-
run: |
116-
IFS='/' read -r library framework <<< "${{ matrix.e2e-project }}"
117-
echo "FRAMEWORK=$framework" >> $GITHUB_ENV
118-
echo "LIBRARY=$library" >> $GITHUB_ENV
119-
120-
- name: Clean Source
121-
run: |
122-
rm -rf packages
123-
rm -rf node_modules
124-
125-
- name: Install Dependencies
126-
run: |
127-
cd "$PWD/e2e/$LIBRARY/$FRAMEWORK"
128-
npm install --no-cache --no-package-lock
129-
npm install --dev --no-package-lock @types/node@${{ matrix.node-version }}
130-
131-
- name: Execute Test
132-
run: |
133-
cd "$PWD/e2e/$LIBRARY/$FRAMEWORK"
134-
npm test
135-
13649
publish:
13750
name: Publish Packages
138-
needs: [e2e]
13951
runs-on: ubuntu-latest
14052
steps:
14153
- name: Checkout
14254
uses: actions/checkout@v4
55+
with:
56+
ref: ${{ github.event.inputs.target_branch }}
14357

14458
- name: Setup Registry
14559
uses: actions/setup-node@v4
14660
with:
14761
registry-url: https://registry.npmjs.org/
148-
scope: '@suites'
62+
scope: '@contractual'
14963
always-auth: true
150-
- name: Install pnpm
151-
uses: pnpm/action-setup@v4
152-
with:
153-
version: 9.15.4
15464

155-
- name: pnpm
156-
run: pnpm install --frozen-lockfile
65+
- name: NPM
66+
run: npm ci
15767

15868
- name: Build
159-
run: pnpm build
69+
run: npm run build
16070

16171
- name: Publish Packages
162-
run: pnpm publish -r ${{ github.event.inputs.strategy }} --access public --tag ${{ github.event.inputs.dist_tag }}
72+
run: npx lerna publish ${{ github.event.inputs.strategy }} --yes --dist-tag ${{ github.event.inputs.dist_tag }}
16373
env:
16474
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/release-packages.yml

+4-9
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,22 @@ jobs:
5858
- name: Prerelease Version (Exact Version)
5959
if: ${{ github.event.inputs.release_type == 'prerelease' && github.event.inputs.exact_version }}
6060
run: |
61-
pnpm version ${{ github.event.inputs.exact_version }} \
62-
--workspaces-update \
63-
--no-git-tag-version \
64-
--no-commit-hooks
61+
npx lerna version ${{ github.event.inputs.exact_version }} --yes --no-changelog
6562
env:
6663
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6764

6865
- name: Prerelease Version
6966
if: ${{ github.event.inputs.release_type == 'prerelease' && !github.event.inputs.exact_version }}
7067
run: |
71-
pnpm version prerelease \
68+
npx lerna version prerelease --yes \
7269
--preid ${{ github.event.inputs.preid }} \
73-
--workspaces-update \
74-
--no-git-tag-version \
75-
--no-commit-hooks
70+
--no-changelog
7671
env:
7772
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7873

7974
- name: Graduate Version
8075
if: ${{ github.event.inputs.release_type == 'graduate' }}
81-
run: pnpm version --workspaces-update from-git
76+
run: npx lerna version --conventional-graduate --yes
8277
env:
8378
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8479

0 commit comments

Comments
 (0)