create-node-lib 2.9.2 → 2.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/main.yml +10 -4
- package/CHANGELOG.md +20 -0
- package/README.md +2 -2
- package/__tests__/generator.test.js +68 -0
- package/package.json +38 -26
- package/saofile.js +7 -0
- package/template/.changeset/config.json +16 -0
- package/template/package.json +1 -0
|
@@ -20,7 +20,7 @@ jobs:
|
|
|
20
20
|
strategy:
|
|
21
21
|
matrix:
|
|
22
22
|
platform: [ubuntu-latest]
|
|
23
|
-
node: ['
|
|
23
|
+
node: ['24']
|
|
24
24
|
name: Tests - Node ${{ matrix.node }} (${{ matrix.platform }})
|
|
25
25
|
runs-on: ${{ matrix.platform }}
|
|
26
26
|
steps:
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
|
29
29
|
with:
|
|
30
30
|
node-version: ${{ matrix.node }}
|
|
31
31
|
- name: install dependencies
|
|
32
|
-
run: npm ci --
|
|
32
|
+
run: npm ci --audit false
|
|
33
33
|
- name: run tests
|
|
34
34
|
run: npm run test
|
|
35
35
|
# - name: code coverage report
|
|
@@ -42,13 +42,19 @@ jobs:
|
|
|
42
42
|
runs-on: 'ubuntu-latest'
|
|
43
43
|
needs: build
|
|
44
44
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
45
|
+
permissions:
|
|
46
|
+
contents: write
|
|
47
|
+
issues: write
|
|
48
|
+
pull-requests: write
|
|
49
|
+
id-token: write
|
|
45
50
|
steps:
|
|
46
51
|
- uses: actions/checkout@v3
|
|
47
52
|
- uses: actions/setup-node@v3
|
|
48
53
|
with:
|
|
49
|
-
node-version: '
|
|
54
|
+
node-version: '24'
|
|
55
|
+
registry-url: 'https://registry.npmjs.org'
|
|
50
56
|
- name: install dependencies
|
|
51
|
-
run: npm ci --
|
|
57
|
+
run: npm ci --audit false
|
|
52
58
|
- name: release
|
|
53
59
|
run: npx semantic-release
|
|
54
60
|
env:
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
## [2.9.4](https://github.com/lirantal/create-node-lib/compare/v2.9.3...v2.9.4) (2026-01-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* add default changeset configuration to scaffolded projects ([#41](https://github.com/lirantal/create-node-lib/issues/41)) ([2cc16c6](https://github.com/lirantal/create-node-lib/commit/2cc16c6d05dc4921ac7247639771b2b1bf3c63e4))
|
|
7
|
+
|
|
8
|
+
## [2.9.3](https://github.com/lirantal/create-node-lib/compare/v2.9.2...v2.9.3) (2026-01-23)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* add prepare script to template for Husky initialization ([#33](https://github.com/lirantal/create-node-lib/issues/33)) ([4ff841d](https://github.com/lirantal/create-node-lib/commit/4ff841d79f03f18e1e2f13222fcbc8d38cd9069e))
|
|
14
|
+
* add publishConfig to package.json ([13fd5cf](https://github.com/lirantal/create-node-lib/commit/13fd5cf8cf7d02465bd4c1a48e1143ae39ce6047))
|
|
15
|
+
* fix automated release failures from main branch ([#35](https://github.com/lirantal/create-node-lib/issues/35)) ([4450205](https://github.com/lirantal/create-node-lib/commit/44502052361a33db2e3283a827bf93638f21d55b))
|
|
16
|
+
* Fix JSON formatting in package.json ([2532548](https://github.com/lirantal/create-node-lib/commit/25325482c68b7f3f85c18255bff9bdffb97f8050))
|
|
17
|
+
* nest semantic-release plugins in release config for OIDC provenance ([#37](https://github.com/lirantal/create-node-lib/issues/37)) ([afbcecd](https://github.com/lirantal/create-node-lib/commit/afbcecd664c6da84f74aee97e5f568c066742ba4))
|
|
18
|
+
* npm publishing ([00bd030](https://github.com/lirantal/create-node-lib/commit/00bd030794206a8726e5d5996e120beade63a6d0))
|
|
19
|
+
* out of sync package lock ([a5400dc](https://github.com/lirantal/create-node-lib/commit/a5400dca74f2a320942007158214ed076a066d88))
|
|
20
|
+
* update deep deps ([49fdbae](https://github.com/lirantal/create-node-lib/commit/49fdbaee2bd540ee0d8d8bc17155edae2c721da8))
|
package/README.md
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
<a href="https://www.npmjs.org/package/create-node-lib"><img src="https://badgen.net/npm/v/create-node-lib"alt="npm version"/></a>
|
|
11
11
|
<a href="https://www.npmjs.org/package/create-node-lib"><img src="https://badgen.net/npm/license/create-node-lib"alt="license"/></a>
|
|
12
12
|
<a href="https://www.npmjs.org/package/create-node-lib"><img src="https://badgen.net/npm/dt/create-node-lib"alt="downloads"/></a>
|
|
13
|
-
<a href="https://travis-ci.org/lirantal/create-node-lib"><img src="https://badgen.net/travis/lirantal/create-node-lib" alt="build"/></a>
|
|
14
13
|
<a href="https://snyk.io/test/github/lirantal/create-node-lib"><img src="https://snyk.io/test/github/lirantal/create-node-lib/badge.svg" alt="Known Vulnerabilities"/></a>
|
|
15
14
|
<a href="./SECURITY.md"><img src="https://img.shields.io/badge/Security-Responsible%20Disclosure-yellow.svg" alt="Responsible Disclosure Policy" /></a>
|
|
16
15
|
<a href="https://github.com/saojs/awesome-sao"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"/></a>
|
|
@@ -35,7 +34,8 @@ or if you're using yarn
|
|
|
35
34
|
yarn create node-lib my-cool-lib-name
|
|
36
35
|
```
|
|
37
36
|
|
|
38
|
-
<img
|
|
37
|
+
<img alt="Israel Rail API and CLI using npx and npm" src="https://github.com/user-attachments/assets/48ce8c3b-e56f-44a5-9d87-911c34eae43b" />
|
|
38
|
+
|
|
39
39
|
|
|
40
40
|
# Contributing
|
|
41
41
|
|
|
@@ -88,4 +88,72 @@ describe('all the template files are accountable for', () => {
|
|
|
88
88
|
// Testing only variable scripts
|
|
89
89
|
expect(pkg.scripts['lint:lockfile']).toEqual(mockScripts['lint:lockfile'])
|
|
90
90
|
})
|
|
91
|
+
|
|
92
|
+
test('Generator creates package.json with prepare script for husky', async () => {
|
|
93
|
+
const stream = await sao.mock({ generator: template })
|
|
94
|
+
const pkg = JSON.parse(await stream.readFile('package.json'))
|
|
95
|
+
expect(pkg.scripts.prepare).toBe('husky')
|
|
96
|
+
})
|
|
97
|
+
|
|
98
|
+
test('Generator creates changeset config.json file', async () => {
|
|
99
|
+
const stream = await sao.mock({ generator: template })
|
|
100
|
+
expect(stream.fileList).toContain('.changeset/config.json')
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
test('Generator creates changeset config with correct repo from projectRepository', async () => {
|
|
104
|
+
const mockProjectRepository = 'https://github.com/alice/wonderland'
|
|
105
|
+
|
|
106
|
+
const stream = await sao.mock(
|
|
107
|
+
{ generator: template },
|
|
108
|
+
{
|
|
109
|
+
projectRepository: mockProjectRepository
|
|
110
|
+
}
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
const changesetConfig = JSON.parse(await stream.readFile('.changeset/config.json'))
|
|
114
|
+
expect(changesetConfig.changelog[1].repo).toBe('alice/wonderland')
|
|
115
|
+
expect(changesetConfig.$schema).toBe('https://unpkg.com/@changesets/config/schema.json')
|
|
116
|
+
expect(changesetConfig.access).toBe('public')
|
|
117
|
+
expect(changesetConfig.baseBranch).toBe('main')
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
test('Generator creates changeset config with repo extracted from .git URL', async () => {
|
|
121
|
+
const mockProjectRepository = 'https://github.com/bob/project.git'
|
|
122
|
+
|
|
123
|
+
const stream = await sao.mock(
|
|
124
|
+
{ generator: template },
|
|
125
|
+
{
|
|
126
|
+
projectRepository: mockProjectRepository
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
const changesetConfig = JSON.parse(await stream.readFile('.changeset/config.json'))
|
|
131
|
+
expect(changesetConfig.changelog[1].repo).toBe('bob/project')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
test('Generator handles URL with trailing slash', async () => {
|
|
135
|
+
const mockProjectRepository = 'https://github.com/user/repo/'
|
|
136
|
+
|
|
137
|
+
const stream = await sao.mock(
|
|
138
|
+
{ generator: template },
|
|
139
|
+
{
|
|
140
|
+
projectRepository: mockProjectRepository
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
const changesetConfig = JSON.parse(await stream.readFile('.changeset/config.json'))
|
|
145
|
+
expect(changesetConfig.changelog[1].repo).toBe('user/repo')
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
test('Generator handles empty projectRepository gracefully', async () => {
|
|
149
|
+
const stream = await sao.mock(
|
|
150
|
+
{ generator: template },
|
|
151
|
+
{
|
|
152
|
+
projectRepository: ''
|
|
153
|
+
}
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
const changesetConfig = JSON.parse(await stream.readFile('.changeset/config.json'))
|
|
157
|
+
expect(changesetConfig.changelog[1].repo).toBe('')
|
|
158
|
+
})
|
|
91
159
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-node-lib",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.4",
|
|
4
4
|
"description": "Scaffolding out a Node.js library module",
|
|
5
5
|
"bin": "./bin/cli.js",
|
|
6
6
|
"engines": {
|
|
@@ -41,19 +41,25 @@
|
|
|
41
41
|
"type": "git",
|
|
42
42
|
"url": "https://github.com/lirantal/create-node-lib.git"
|
|
43
43
|
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"registry": "https://registry.npmjs.org/",
|
|
46
|
+
"tag": "latest",
|
|
47
|
+
"provenance": true
|
|
48
|
+
},
|
|
44
49
|
"dependencies": {
|
|
45
50
|
"sao": "^1.7.1",
|
|
51
|
+
"semantic-release": "^25.0.2",
|
|
46
52
|
"validate-npm-package-name": "^5.0.0"
|
|
47
53
|
},
|
|
48
54
|
"devDependencies": {
|
|
49
55
|
"@commitlint/cli": "^17.4.2",
|
|
50
56
|
"@commitlint/config-conventional": "^17.4.2",
|
|
51
57
|
"@semantic-release/changelog": "^6.0.2",
|
|
52
|
-
"@semantic-release/commit-analyzer": "^
|
|
58
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
53
59
|
"@semantic-release/git": "^10.0.1",
|
|
54
|
-
"@semantic-release/github": "^
|
|
55
|
-
"@semantic-release/npm": "^
|
|
56
|
-
"@semantic-release/release-notes-generator": "^
|
|
60
|
+
"@semantic-release/github": "^12.0.2",
|
|
61
|
+
"@semantic-release/npm": "^13.1.3",
|
|
62
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
57
63
|
"babel-eslint": "^10.0.1",
|
|
58
64
|
"babel-plugin-syntax-async-functions": "^6.13.0",
|
|
59
65
|
"babel-plugin-transform-regenerator": "^6.26.0",
|
|
@@ -193,28 +199,34 @@
|
|
|
193
199
|
"release": "patch"
|
|
194
200
|
}
|
|
195
201
|
]
|
|
196
|
-
}
|
|
202
|
+
},
|
|
203
|
+
"plugins": [
|
|
204
|
+
"@semantic-release/commit-analyzer",
|
|
205
|
+
"@semantic-release/release-notes-generator",
|
|
206
|
+
[
|
|
207
|
+
"@semantic-release/changelog",
|
|
208
|
+
{
|
|
209
|
+
"changelogFile": "CHANGELOG.md"
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
[
|
|
213
|
+
"@semantic-release/npm",
|
|
214
|
+
{
|
|
215
|
+
"npmPublish": true,
|
|
216
|
+
"provenance": true
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
[
|
|
220
|
+
"@semantic-release/git",
|
|
221
|
+
{
|
|
222
|
+
"assets": [
|
|
223
|
+
"CHANGELOG.md"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
"@semantic-release/github"
|
|
228
|
+
]
|
|
197
229
|
},
|
|
198
|
-
"plugins": [
|
|
199
|
-
"@semantic-release/commit-analyzer",
|
|
200
|
-
"@semantic-release/release-notes-generator",
|
|
201
|
-
[
|
|
202
|
-
"@semantic-release/changelog",
|
|
203
|
-
{
|
|
204
|
-
"changelogFile": "CHANGELOG.md"
|
|
205
|
-
}
|
|
206
|
-
],
|
|
207
|
-
"@semantic-release/npm",
|
|
208
|
-
[
|
|
209
|
-
"@semantic-release/git",
|
|
210
|
-
{
|
|
211
|
-
"assets": [
|
|
212
|
-
"CHANGELOG.md"
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"@semantic-release/github"
|
|
217
|
-
],
|
|
218
230
|
"peerDependencies": {
|
|
219
231
|
"node-notifier": "^10.0.1"
|
|
220
232
|
}
|
package/saofile.js
CHANGED
|
@@ -9,6 +9,13 @@ module.exports = {
|
|
|
9
9
|
year: new Date().getFullYear(),
|
|
10
10
|
npmClientInstall: ({ npmClient }) => {
|
|
11
11
|
return npmClient === 'npm' ? 'install' : 'add'
|
|
12
|
+
},
|
|
13
|
+
changesetRepo: ({ projectRepository }) => {
|
|
14
|
+
// Extract owner/repo from URL like https://github.com/username/reponame
|
|
15
|
+
// or https://github.com/username/reponame.git
|
|
16
|
+
if (!projectRepository || typeof projectRepository !== 'string') return ''
|
|
17
|
+
const match = projectRepository.match(/github\.com\/([^/]+\/[^/.?#]+)/)
|
|
18
|
+
return match ? match[1] : ''
|
|
12
19
|
}
|
|
13
20
|
},
|
|
14
21
|
prompts() {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://unpkg.com/@changesets/config/schema.json",
|
|
3
|
+
"changelog": [
|
|
4
|
+
"@changesets/changelog-github",
|
|
5
|
+
{
|
|
6
|
+
"repo": "<%- changesetRepo({ projectRepository }) %>"
|
|
7
|
+
}
|
|
8
|
+
],
|
|
9
|
+
"commit": false,
|
|
10
|
+
"fixed": [],
|
|
11
|
+
"linked": [],
|
|
12
|
+
"access": "public",
|
|
13
|
+
"baseBranch": "main",
|
|
14
|
+
"updateInternalDependencies": "patch",
|
|
15
|
+
"ignore": []
|
|
16
|
+
}
|
package/template/package.json
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"test": "c8 node --import tsx --test __tests__/**/*.test.ts",
|
|
43
43
|
"test:watch": "c8 node --import tsx --test --watch __tests__/**/*.test.ts",
|
|
44
44
|
"coverage:view": "open coverage/lcov-report/index.html",
|
|
45
|
+
"prepare": "husky",
|
|
45
46
|
"version": "changeset version",
|
|
46
47
|
"release": "changeset publish"
|
|
47
48
|
},
|