Skip to content

Commit e8b473d

Browse files
committed
ci: update Node.js version to 22.x and restructure test jobs in build.yml
1 parent e6b2410 commit e8b473d

File tree

5 files changed

+49
-849
lines changed

5 files changed

+49
-849
lines changed

.github/workflows/build.yml

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,56 @@ on:
1212
jobs:
1313
lint:
1414
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
node-version: [20.x]
1815

1916
steps:
2017
- uses: actions/checkout@v4
21-
- name: Use Node.js ${{ matrix.node-version }}
18+
- name: Use Node.js
2219
uses: actions/setup-node@v4
2320
with:
24-
node-version: ${{ matrix.node-version }}
21+
node-version: 22.x
2522
- name: Install dependencies
2623
run: yarn install --immutable
2724
- name: Run lint
2825
run: yarn lint
2926

30-
test:
31-
runs-on: ${{ matrix.os }}
27+
test-cli-core:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
- name: Use Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 22.x
35+
- name: Install dependencies
36+
run: yarn install --immutable
37+
- name: Run tests for cli-core
38+
run: yarn test --project=@tsed/cli-core
3239

33-
strategy:
34-
matrix:
35-
os: [ubuntu-latest, windows-latest]
36-
node-version: [20.x]
37-
exclude:
38-
# - os: macos-latest
39-
# node-version: 12.x
40-
# - os: macos-latest
41-
# node-version: 15.x
42-
# - os: windows-latest
43-
# node-version: 12.x
44-
- os: windows-latest
45-
node-version: 20.x
40+
test-cli:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: Use Node.js
45+
uses: actions/setup-node@v4
46+
with:
47+
node-version: 22.x
48+
- name: Install dependencies
49+
run: yarn install --immutable
50+
- name: Run tests for cli
51+
run: yarn test run --project=@tsed/cli
4652

53+
test-plugins:
54+
runs-on: "ubuntu-latest"
4755
steps:
4856
- uses: actions/checkout@v4
49-
- name: Use Node.js ${{ matrix.node-version }}
57+
- name: Use Node.js
5058
uses: actions/setup-node@v4
5159
with:
52-
node-version: ${{ matrix.node-version }}
60+
node-version: 22.x
5361
- name: Install dependencies
5462
run: yarn install --immutable
55-
- name: Run test
56-
run: yarn test
63+
- name: Run tests for other packages
64+
run: yarn test --project="@tsed/cli-plugin-*"
5765

5866
build:
5967
runs-on: ubuntu-latest
@@ -77,19 +85,15 @@ jobs:
7785

7886
deploy-packages:
7987
runs-on: ubuntu-latest
80-
needs: [lint, test, build]
88+
needs: [lint, test-cli-core, test-cli, test-plugins, build]
8189
if: ${{ github.event_name != 'pull_request' && (contains(github.ref, 'master') || contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc')) }}
8290

83-
strategy:
84-
matrix:
85-
node-version: [20.x]
86-
8791
steps:
8892
- uses: actions/checkout@v4
89-
- name: Use Node.js ${{ matrix.node-version }}
93+
- name: Use Node.js
9094
uses: actions/setup-node@v4
9195
with:
92-
node-version: ${{ matrix.node-version }}
96+
node-version: 22.x
9397
- name: Install dependencies
9498
run: yarn install --frozen-lockfile --network-timeout 500000
9599
- name: Release packages

docs/readme.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,6 @@ frameworks:
119119
- title: AWS
120120
href: https://tsed.dev/tutorials/aws.html
121121
src: /aws.png
122-
- title: Handlebars
123-
href: https://handlebarsjs.com/
124-
src: https://handlebarsjs.com/images/handlebars_logo.png
125122
---
126123

127124
::: slot hero-brand

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@
5858
"execa": "8.0.1",
5959
"figures": "^6.1.0",
6060
"fs-extra": "^11.2.0",
61-
"handlebars": "^4.7.8",
62-
"handlebars-helpers": "^0.10.0",
6361
"inquirer": "^9.3.7",
6462
"inquirer-autocomplete-prompt": "3.0.1",
6563
"js-yaml": "^4.1.0",

packages/cli-core/readme.md

Lines changed: 5 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ npm install @tsed/core @tsed/di @tsed/cli-core
3939

4040
## Getting started
4141

42-
Create CLI require some steps like create a package.json with the right information and create a structure directory
42+
Create CLI requires some steps like create a package.json with the right information and create a structure directory
4343
aligned with TypeScript to be compiled correctly for a npm deployment.
4444

45-
Here a structure directory example:
45+
Here is a structure directory example:
4646

4747
```
4848
.
@@ -57,93 +57,6 @@ Here a structure directory example:
5757
└── tsconfig.compile.json
5858
```
5959

60-
## Create package.json and tsconfig
61-
62-
The first step is to create the package.json with the following lines:
63-
64-
```jsonc
65-
{
66-
"name": "{{name}}",
67-
"version": "1.0.0",
68-
"main": "./lib/index.js",
69-
"typings": "./lib/index.d.ts",
70-
"bin": {
71-
"tsed": "lib/bin/{{name}}.js"
72-
},
73-
"files": ["lib/bin/{{name}}.js", "lib/bin", "lib", "templates"],
74-
"description": "An awesome CLI build on top of @tsed/cli-core",
75-
"dependencies": {
76-
"@tsed/cli-core": "1.3.1",
77-
"tslib": "1.11.1"
78-
},
79-
"devDependencies": {
80-
"@tsed/cli-testing": "1.3.1",
81-
"ts-node": "latest",
82-
"typescript": "latest"
83-
},
84-
"scripts": {
85-
"build": "tsc --build tsconfig.compile.json",
86-
"start:cmd:add": "cross-env NODE_ENV=development ts-node -r src/bin/{{name}}.ts add -r ./.tmp"
87-
},
88-
"engines": {
89-
"node": ">=8.9"
90-
},
91-
"peerDependencies": {}
92-
}
93-
```
94-
95-
Then create tsconfig files one for the IDE (`tsconfig.json`):
96-
97-
```json
98-
{
99-
"compilerOptions": {
100-
"module": "commonjs",
101-
"target": "es2016",
102-
"sourceMap": true,
103-
"declaration": false,
104-
"experimentalDecorators": true,
105-
"emitDecoratorMetadata": true,
106-
"moduleResolution": "node",
107-
"isolatedModules": false,
108-
"suppressImplicitAnyIndexErrors": false,
109-
"noImplicitAny": true,
110-
"strictNullChecks": true,
111-
"noUnusedLocals": false,
112-
"noUnusedParameters": false,
113-
"allowSyntheticDefaultImports": true,
114-
"importHelpers": true,
115-
"newLine": "LF",
116-
"noEmit": true,
117-
"lib": ["es7", "dom", "esnext.asynciterable"],
118-
"typeRoots": ["./node_modules/@types"]
119-
},
120-
"linterOptions": {
121-
"exclude": []
122-
},
123-
"exclude": []
124-
}
125-
```
126-
127-
And another one to compile source (`tsconfig.compile.json`):
128-
129-
```json
130-
{
131-
"extends": "./tsconfig.compile.json",
132-
"compilerOptions": {
133-
"rootDir": "src",
134-
"outDir": "lib",
135-
"moduleResolution": "node",
136-
"declaration": true,
137-
"noResolve": false,
138-
"preserveConstEnums": true,
139-
"sourceMap": true,
140-
"noEmit": false,
141-
"inlineSources": true
142-
},
143-
"exclude": ["node_modules", "test", "lib", "**/*.spec.ts"]
144-
}
145-
```
146-
14760
## Create the bin file
14861

14962
The bin file is used by npm to create your node.js executable program when you install the node_module globally.
@@ -155,19 +68,13 @@ Create a new file according to your project name (example: `name.ts`) and add th
15568
import {AddCmd, CliCore} from "@tsed/cli-core";
15669
import {resolve} from "node:path";
15770

158-
const pkg = require("../../package.json");
159-
const TEMPLATE_DIR = resolve(__dirname, "..", "..", "templates");
160-
16171
CliCore.bootstrap({
16272
commands: [
16373
AddCmd // CommandProvider to install a plugin
16474
// then add you commands
16575
],
166-
16776
// optionals
168-
name: "name", // replace by the cli name. This property will be used by Plugins command
169-
pkg,
170-
templateDir: TEMPLATE_DIR
77+
name: "name" // replace by the cli name. This property will be used by Plugins command
17178
}).catch(console.error);
17279
```
17380

@@ -265,12 +172,6 @@ export class GenerateCmd implements CommandProvider {
265172
}
266173
```
267174

268-
Finally, create a handlebars template in templates directory:
269-
270-
```hbs
271-
import {Injectable} from "@tsed/di"; @Injectable() export class {{symbolName}} { }
272-
```
273-
274175
## Run command in dev mode
275176

276177
In your package.json add the following line in scripts property:
@@ -281,13 +182,13 @@ In your package.json add the following line in scripts property:
281182
}
282183
```
283184

284-
> Note: replace {{name}} by the name of you bin file located in src/bin.
185+
> Note: replace {{name}} by the name of your bin file located in src/bin.
285186
286187
> Note 2: The option `-r ./.tmp` create a temporary directory to generate files with your command.
287188
288189
## More examples
289190

290-
Here other commands examples:
191+
Here are other command examples:
291192

292193
- Init a project command: https://github.com/tsedio/tsed-cli/tree/master/packages/cli/src/commands/init/InitCmd
293194
- Generate command: https://github.com/tsedio/tsed-cli/tree/master/packages/cli/src/commands/generate/GenerateCmd

0 commit comments

Comments
 (0)