Skip to content

Commit 8e04ebc

Browse files
committed
ci(GithubAction): use scope in ci to allow publishing to different registries with different scopes
1 parent 1ea7841 commit 8e04ebc

File tree

3 files changed

+71
-67
lines changed

3 files changed

+71
-67
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ jobs:
2020
verify:
2121
runs-on: ubuntu-latest
2222
steps:
23-
- uses: actions/checkout@v3
24-
- uses: actions/setup-node@v3
23+
- uses: actions/checkout@v4
24+
# Setup .npmrc file to publish to npm
25+
- uses: actions/setup-node@v4
2526
with:
2627
node-version: 18
2728
- name: Install dependencies

.github/workflows/publish.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,18 @@ jobs:
3333
steps:
3434
- uses: actions/checkout@v4
3535
# Setup .npmrc file to publish to npm
36-
- uses: actions/setup-node@v3
36+
- uses: actions/setup-node@v4
3737
with:
3838
node-version: ${{ matrix.version }}
3939
registry-url: 'https://registry.npmjs.org'
40+
scope: '@make-everything-simple'
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
43+
- name: show npm config
44+
run: cat $NPM_CONFIG_USERCONFIG
4045
- name: Install dependencies
4146
run: npm ci
4247
- name: Build package
4348
run: npm run build
4449
- name: Publish package to NPM registry
4550
run: npm publish --access public
46-
env:
47-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}

package.json

Lines changed: 62 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,64 @@
11
{
2-
"name": "@askbills/npm-template-typescript",
3-
"version": "1.0.0-canary.0",
4-
"description": "Typescript template to build npm package",
5-
"main": "./dist/index.js",
6-
"module": "./dist/index.mjs",
7-
"types": "./dist/index.d.ts",
8-
"files": [
9-
"dist"
10-
],
11-
"scripts": {
12-
"prebuild": "rimraf dist",
13-
"build": "tsup --config ./configs/tsup.config.ts",
14-
"start": "npm run build && node dist/index.js",
15-
"start:watch": "tsup src/index.ts --config ./configs/tsup.config.ts --watch --onSuccess 'node dist/index.js'",
16-
"pretest": "rimraf coverage",
17-
"test": "jest --config ./configs/jest.config.ts",
18-
"lint": "eslint \"{src,tests}/**/*.ts\" --config ./configs/.eslintrc.js",
19-
"lint:fix": "npm run lint -- --fix",
20-
"prettier:format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"configs/**/*\" --config configs/.prettierrc",
21-
"prepare": "husky install"
22-
},
23-
"repository": {
24-
"type": "git",
25-
"url": "git+https://github.com/lengocduy/npm-template-typescript.git"
26-
},
27-
"keywords": [
28-
"npm",
29-
"template",
30-
"npm-typescript",
31-
"package-template"
32-
],
33-
"author": "Le Ngoc Duy",
34-
"license": "MIT",
35-
"bugs": {
36-
"url": "https://github.com/lengocduy/npm-template-typescript/issues"
37-
},
38-
"homepage": "https://github.com/lengocduy/npm-template-typescript#readme",
39-
"devDependencies": {
40-
"@tsconfig/node18": "^18.2.2",
41-
"@types/jest": "^29.5.11",
42-
"@typescript-eslint/eslint-plugin": "^6.20.0",
43-
"eslint": "^8.56.0",
44-
"eslint-config-prettier": "^9.1.0",
45-
"eslint-plugin-import": "^2.29.1",
46-
"eslint-plugin-prettier": "^5.1.3",
47-
"husky": "^9.0.10",
48-
"jest": "^29.7.0",
49-
"lint-staged": "^15.2.1",
50-
"node-notifier": "^10.0.1",
51-
"prettier": "3.2.4",
52-
"rimraf": "^5.0.5",
53-
"ts-jest": "^29.1.2",
54-
"ts-node": "^10.9.2",
55-
"tsup": "^8.0.1",
56-
"typescript": "^5.3.3"
57-
},
58-
"lint-staged": {
59-
"**/*": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"configs/**/*\" --config configs/.prettierrc --ignore-unknown"
60-
},
61-
"engines": {
62-
"node": ">=18.0.0"
63-
}
2+
"name": "npm-template-typescript",
3+
"version": "0.0.2-test",
4+
"description": "Typescript template to build npm package",
5+
"main": "./dist/index.js",
6+
"module": "./dist/index.mjs",
7+
"types": "./dist/index.d.ts",
8+
"files": [
9+
"dist"
10+
],
11+
"scripts": {
12+
"prebuild": "rimraf dist",
13+
"build": "tsup --config ./configs/tsup.config.ts",
14+
"start": "npm run build && node dist/index.js",
15+
"start:watch": "tsup src/index.ts --config ./configs/tsup.config.ts --watch --onSuccess 'node dist/index.js'",
16+
"pretest": "rimraf coverage",
17+
"test": "jest --config ./configs/jest.config.ts",
18+
"lint": "eslint \"{src,tests}/**/*.ts\" --config ./configs/.eslintrc.js",
19+
"lint:fix": "npm run lint -- --fix",
20+
"prettier:format": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"configs/**/*\" --config configs/.prettierrc",
21+
"prepare": "husky install"
22+
},
23+
"repository": {
24+
"type": "git",
25+
"url": "git+https://github.com/lengocduy/npm-template-typescript.git"
26+
},
27+
"keywords": [
28+
"npm",
29+
"template",
30+
"npm-typescript",
31+
"package-template"
32+
],
33+
"author": "Le Ngoc Duy",
34+
"license": "MIT",
35+
"bugs": {
36+
"url": "https://github.com/lengocduy/npm-template-typescript/issues"
37+
},
38+
"homepage": "https://github.com/lengocduy/npm-template-typescript#readme",
39+
"devDependencies": {
40+
"@tsconfig/node18": "^18.2.2",
41+
"@types/jest": "^29.5.11",
42+
"@typescript-eslint/eslint-plugin": "^6.20.0",
43+
"eslint": "^8.56.0",
44+
"eslint-config-prettier": "^9.1.0",
45+
"eslint-plugin-import": "^2.29.1",
46+
"eslint-plugin-prettier": "^5.1.3",
47+
"husky": "^9.0.10",
48+
"jest": "^29.7.0",
49+
"lint-staged": "^15.2.1",
50+
"node-notifier": "^10.0.1",
51+
"prettier": "3.2.4",
52+
"rimraf": "^5.0.5",
53+
"ts-jest": "^29.1.2",
54+
"ts-node": "^10.9.2",
55+
"tsup": "^8.0.1",
56+
"typescript": "^5.3.3"
57+
},
58+
"lint-staged": {
59+
"**/*": "prettier --write \"src/**/*.ts\" \"tests/**/*.ts\" \"configs/**/*\" --config configs/.prettierrc --ignore-unknown"
60+
},
61+
"engines": {
62+
"node": ">=18.0.0"
63+
}
6464
}

0 commit comments

Comments
 (0)