@nan0web/release 1.0.1 → 1.0.3
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/README.md +24 -42
- package/bin/nan0release.js +27 -42
- package/package.json +48 -42
- package/project.yaml +79 -0
- package/src/README.md.js +90 -93
- package/src/Release/Document.js +13 -19
- package/src/Release/MarkdownToTest.js +35 -33
- package/src/Release/Person.js +3 -8
- package/src/Release/Scanner.js +179 -0
- package/src/Release.js +19 -12
- package/src/Team.js +9 -9
- package/src/architecture/ProjectManagementAsCode.js +8 -8
- package/src/cli/index.js +9 -0
- package/src/co/AppCommandOptions.js +4 -6
- package/src/commands/CloseCommand.js +67 -0
- package/src/commands/Command.js +48 -0
- package/src/commands/DepsCommand.js +143 -0
- package/src/commands/InitCommand.js +48 -56
- package/src/commands/PublishCommand.js +80 -119
- package/src/commands/SpecCommand.js +41 -0
- package/src/commands/StatusCommand.js +26 -0
- package/src/db/ReleaseDB.js +5 -5
- package/src/index.js +18 -0
- package/src/ui/cli/ReleaseCLi.js +52 -0
- package/src/utils/runSpawn.js +0 -0
- package/types/Release/Document.d.ts +2 -2
- package/types/Release/Person.d.ts +3 -3
- package/types/Release/Scanner.d.ts +90 -0
- package/types/Release.d.ts +37 -33
- package/types/ReleaseCLI.d.ts +29 -28
- package/types/Team.d.ts +3 -3
- package/types/architecture/ProjectManagementAsCode.d.ts +1 -1
- package/types/cli/index.d.ts +2 -0
- package/types/co/AppCommandMessage.d.ts +10 -11
- package/types/co/AppCommandOptions.d.ts +1 -2
- package/types/commands/BaseCommand.d.ts +23 -0
- package/types/commands/ChatCommand.d.ts +9 -9
- package/types/commands/ChatMessage.d.ts +36 -0
- package/types/commands/CloseCommand.d.ts +25 -0
- package/types/commands/Command.d.ts +28 -0
- package/types/commands/DepsCommand.d.ts +32 -0
- package/types/commands/DepsMessage.d.ts +28 -0
- package/types/commands/HostCommand.d.ts +7 -7
- package/types/commands/HostMessage.d.ts +44 -0
- package/types/commands/InitCommand.d.ts +24 -19
- package/types/commands/InitMessage.d.ts +24 -0
- package/types/commands/ListCommand.d.ts +8 -8
- package/types/commands/ListMessage.d.ts +30 -0
- package/types/commands/PublishCommand.d.ts +36 -47
- package/types/commands/PublishMessage.d.ts +39 -0
- package/types/commands/SealCommand.d.ts +7 -7
- package/types/commands/SealMessage.d.ts +28 -0
- package/types/commands/ServeCommand.d.ts +7 -7
- package/types/commands/ServeMessage.d.ts +30 -0
- package/types/commands/ShowCommand.d.ts +7 -7
- package/types/commands/SpecCommand.d.ts +25 -0
- package/types/commands/StatusCommand.d.ts +9 -0
- package/types/commands/SubCommand.d.ts +9 -7
- package/types/commands/ValidateCommand.d.ts +7 -7
- package/types/commands/ValidateMessage.d.ts +20 -0
- package/types/db/ReleaseDB.d.ts +2 -2
- package/types/index.d.ts +10 -0
- package/types/ui/cli/ReleaseCLi.d.ts +10 -0
- package/types/ui/cli/index.d.ts +0 -0
- package/types/utils/runSpawn.d.ts +0 -0
- package/.datasets/README.dataset.jsonl +0 -19
- package/.editorconfig +0 -20
- package/CHANGELOG.md +0 -6
- package/CONTRIBUTING.md +0 -42
- package/bin/commands/InitCommand.js +0 -10
- package/bin/lib/functions.js +0 -240
- package/bin/lib/functions.test.js +0 -138
- package/bin/release.js +0 -12
- package/bin/release.test.js +0 -73
- package/bin/temp/package.json +0 -1
- package/docs/system.uk.md +0 -413
- package/docs/uk/README.md +0 -284
- package/legacy/PrepareCommand.js +0 -154
- package/legacy/PrepareCommand.test.js +0 -189
- package/legacy/changelog.js +0 -446
- package/releases/1/0/v1.0.0/models/Person.js +0 -26
- package/releases/1/0/v1.0.0/models/Person.test.js +0 -44
- package/releases/1/0/v1.0.0/models/company.js +0 -11
- package/releases/1/0/v1.0.0/models/members.js +0 -14
- package/releases/1/0/v1.0.0/models/members.test.js +0 -21
- package/releases/1/0/v1.0.0/models/teams/DevTeam.js +0 -6
- package/releases/1/0/v1.0.0/models/teams/DevTeam.test.js +0 -15
- package/releases/1/0/v1.0.0/models/teams/index.js +0 -5
- package/releases/1/0/v1.0.0/release.js +0 -12
- package/releases/1/0/v1.0.0/release.md +0 -121
- package/releases/1/0/v1.0.0/release.test.js +0 -36
- package/releases/1/0/v1.0.0/test/YaRaSLove/git-native.test.js +0 -14
- package/releases/current.js +0 -3
- package/releases/index.js +0 -11
- package/src/Release/MarkdownToTest.test.js +0 -60
- package/src/ReleaseCLI.js +0 -122
- package/src/architecture/ProjectManagementAsCode.test.js +0 -128
- package/src/co/AppCommandMessage.js +0 -22
- package/src/commands/ChatCommand.js +0 -56
- package/src/commands/HostCommand.js +0 -63
- package/src/commands/ListCommand.js +0 -56
- package/src/commands/SealCommand.js +0 -51
- package/src/commands/ServeCommand.js +0 -53
- package/src/commands/ShowCommand.js +0 -58
- package/src/commands/SubCommand.js +0 -21
- package/src/commands/ValidateCommand.js +0 -66
- package/system.md +0 -571
- package/tsconfig.json +0 -23
- /package/{bin/lib/temp/pnpm-lock.yaml → src/ui/cli/index.js} +0 -0
package/src/README.md.js
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
|
-
import { describe, it, before, beforeEach } from
|
|
2
|
-
import assert from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import Release from "./Release.js"
|
|
12
|
-
import ReleaseDocument from "./Release/Document.js"
|
|
13
|
-
import Person from "./Release/Person.js"
|
|
1
|
+
import { describe, it, before, beforeEach } from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
import { readFile } from 'node:fs/promises'
|
|
4
|
+
import FS from '@nan0web/db-fs'
|
|
5
|
+
import { NoConsole } from '@nan0web/log'
|
|
6
|
+
import { DatasetParser, DocsParser, runSpawn } from '@nan0web/test'
|
|
7
|
+
import ReleaseCLi from './ui/cli/ReleaseCLi.js'
|
|
8
|
+
import Release from './Release.js'
|
|
9
|
+
import ReleaseDocument from './Release/Document.js'
|
|
10
|
+
import Person from './Release/Person.js'
|
|
14
11
|
import {
|
|
15
12
|
ProjectManagement,
|
|
16
13
|
ReleaseManager,
|
|
17
14
|
TaskTestSuite,
|
|
18
|
-
ChangelogTaskManager
|
|
19
|
-
} from
|
|
15
|
+
ChangelogTaskManager,
|
|
16
|
+
} from './architecture/ProjectManagementAsCode.js'
|
|
20
17
|
|
|
21
18
|
const fs = new FS()
|
|
22
19
|
let pkg
|
|
23
20
|
|
|
24
21
|
// Load package.json once before tests
|
|
25
22
|
before(async () => {
|
|
26
|
-
const doc = await fs.loadDocument(
|
|
23
|
+
const doc = await fs.loadDocument('package.json', {})
|
|
27
24
|
pkg = doc || {}
|
|
28
25
|
})
|
|
29
26
|
|
|
@@ -63,35 +60,35 @@ function testRender() {
|
|
|
63
60
|
*
|
|
64
61
|
* ## Installation
|
|
65
62
|
*/
|
|
66
|
-
it(
|
|
63
|
+
it('How to install with pnpm?', () => {
|
|
67
64
|
/**
|
|
68
65
|
* ```bash
|
|
69
66
|
* pnpm add @nan0web/release
|
|
70
67
|
* ```
|
|
71
68
|
*/
|
|
72
|
-
assert.equal(pkg.name,
|
|
69
|
+
assert.equal(pkg.name, '@nan0web/release')
|
|
73
70
|
})
|
|
74
71
|
/**
|
|
75
72
|
* @docs
|
|
76
73
|
*/
|
|
77
|
-
it(
|
|
74
|
+
it('How to install with npm?', () => {
|
|
78
75
|
/**
|
|
79
76
|
* ```bash
|
|
80
77
|
* npm install @nan0web/release
|
|
81
78
|
* ```
|
|
82
79
|
*/
|
|
83
|
-
assert.equal(pkg.name,
|
|
80
|
+
assert.equal(pkg.name, '@nan0web/release')
|
|
84
81
|
})
|
|
85
82
|
/**
|
|
86
83
|
* @docs
|
|
87
84
|
*/
|
|
88
|
-
it(
|
|
85
|
+
it('How to install with yarn?', () => {
|
|
89
86
|
/**
|
|
90
87
|
* ```bash
|
|
91
88
|
* yarn add @nan0web/release
|
|
92
89
|
* ```
|
|
93
90
|
*/
|
|
94
|
-
assert.equal(pkg.name,
|
|
91
|
+
assert.equal(pkg.name, '@nan0web/release')
|
|
95
92
|
})
|
|
96
93
|
|
|
97
94
|
/**
|
|
@@ -100,103 +97,103 @@ function testRender() {
|
|
|
100
97
|
*
|
|
101
98
|
* Start by initializing a new release:
|
|
102
99
|
*/
|
|
103
|
-
it(
|
|
100
|
+
it('How to initialize a new release version?', () => {
|
|
104
101
|
/**
|
|
105
102
|
* ```bash
|
|
106
103
|
* release init v1.0.0
|
|
107
104
|
* ```
|
|
108
105
|
*/
|
|
109
|
-
const cli =
|
|
110
|
-
assert.ok(cli
|
|
106
|
+
const cli = ReleaseCLi()
|
|
107
|
+
assert.ok(cli.logger)
|
|
111
108
|
})
|
|
112
109
|
|
|
113
110
|
/**
|
|
114
111
|
* @docs
|
|
115
112
|
* Show release details:
|
|
116
113
|
*/
|
|
117
|
-
it(
|
|
114
|
+
it('How to show release information?', () => {
|
|
118
115
|
/**
|
|
119
116
|
* ```bash
|
|
120
117
|
* release show [--full]
|
|
121
118
|
* ```
|
|
122
119
|
*/
|
|
123
120
|
const release = new Release({
|
|
124
|
-
version:
|
|
125
|
-
createdAt: new Date(
|
|
121
|
+
version: 'v1.0.0',
|
|
122
|
+
createdAt: new Date('2025-08-20'),
|
|
126
123
|
})
|
|
127
124
|
console.info(release.version) // v1.0.0
|
|
128
|
-
assert.strictEqual(console.output()[0][1],
|
|
125
|
+
assert.strictEqual(console.output()[0][1], 'v1.0.0')
|
|
129
126
|
})
|
|
130
127
|
|
|
131
128
|
/**
|
|
132
129
|
* @docs
|
|
133
130
|
* List all releases in the project:
|
|
134
131
|
*/
|
|
135
|
-
it(
|
|
132
|
+
it('How to list all releases?', () => {
|
|
136
133
|
/**
|
|
137
134
|
* ```bash
|
|
138
135
|
* release list [--json]
|
|
139
136
|
* ```
|
|
140
137
|
*/
|
|
141
|
-
const cli =
|
|
142
|
-
assert.ok(cli.
|
|
138
|
+
const cli = ReleaseCLi()
|
|
139
|
+
assert.ok(cli.logger)
|
|
143
140
|
})
|
|
144
141
|
|
|
145
142
|
/**
|
|
146
143
|
* @docs
|
|
147
144
|
* Add a chat message to the current release:
|
|
148
145
|
*/
|
|
149
|
-
it(
|
|
146
|
+
it('How to write a release chat message?', () => {
|
|
150
147
|
/**
|
|
151
148
|
* ```bash
|
|
152
149
|
* release chat write --user alice "Issue with the build pipeline"
|
|
153
150
|
* ```
|
|
154
151
|
*/
|
|
155
|
-
const cli =
|
|
156
|
-
assert.ok(cli
|
|
152
|
+
const cli = ReleaseCLi()
|
|
153
|
+
assert.ok(cli.logger)
|
|
157
154
|
})
|
|
158
155
|
|
|
159
156
|
/**
|
|
160
157
|
* @docs
|
|
161
158
|
* Host a static server for viewing releases:
|
|
162
159
|
*/
|
|
163
|
-
it(
|
|
160
|
+
it('How to host release UI?', () => {
|
|
164
161
|
/**
|
|
165
162
|
* ```bash
|
|
166
163
|
* release host [--webui] [--port 3000]
|
|
167
164
|
* ```
|
|
168
165
|
*/
|
|
169
|
-
const cli =
|
|
170
|
-
assert.ok(cli
|
|
166
|
+
const cli = ReleaseCLi()
|
|
167
|
+
assert.ok(cli.logger)
|
|
171
168
|
})
|
|
172
169
|
|
|
173
170
|
/**
|
|
174
171
|
* @docs
|
|
175
172
|
* Serve all release files for local inspection:
|
|
176
173
|
*/
|
|
177
|
-
it(
|
|
174
|
+
it('How to serve release static assets?', () => {
|
|
178
175
|
/**
|
|
179
176
|
* ```bash
|
|
180
177
|
* release serve [--port 8080]
|
|
181
178
|
* ```
|
|
182
179
|
*/
|
|
183
|
-
const cli =
|
|
184
|
-
assert.ok(cli
|
|
180
|
+
const cli = ReleaseCLi()
|
|
181
|
+
assert.ok(cli.logger)
|
|
185
182
|
})
|
|
186
183
|
|
|
187
184
|
/**
|
|
188
185
|
* @docs
|
|
189
186
|
* Validate release tasks and integrity:
|
|
190
187
|
*/
|
|
191
|
-
it(
|
|
188
|
+
it('How to validate release tasks?', () => {
|
|
192
189
|
/**
|
|
193
190
|
* ```bash
|
|
194
191
|
* release validate [--ignore-fail]
|
|
195
192
|
* ```
|
|
196
193
|
*/
|
|
197
194
|
const release = new Release({
|
|
198
|
-
version:
|
|
199
|
-
createdAt: new Date(
|
|
195
|
+
version: 'v1.0.0',
|
|
196
|
+
createdAt: new Date('2025-08-20'),
|
|
200
197
|
})
|
|
201
198
|
assert.ok(release instanceof Release)
|
|
202
199
|
})
|
|
@@ -205,14 +202,14 @@ function testRender() {
|
|
|
205
202
|
* @docs
|
|
206
203
|
* Seal the release with retro reflection:
|
|
207
204
|
*/
|
|
208
|
-
it(
|
|
205
|
+
it('How to seal a release?', () => {
|
|
209
206
|
/**
|
|
210
207
|
* ```bash
|
|
211
208
|
* release seal [--message "All core APIs are stable and tested"]
|
|
212
209
|
* ```
|
|
213
210
|
*/
|
|
214
|
-
const cli =
|
|
215
|
-
assert.ok(cli
|
|
211
|
+
const cli = ReleaseCLi()
|
|
212
|
+
assert.ok(cli.logger)
|
|
216
213
|
})
|
|
217
214
|
|
|
218
215
|
/**
|
|
@@ -228,16 +225,16 @@ function testRender() {
|
|
|
228
225
|
*
|
|
229
226
|
* Each property is typed and validated automatically via JSDoc and runtime parsing.
|
|
230
227
|
*/
|
|
231
|
-
it(
|
|
228
|
+
it('How to instantiate a Release?', () => {
|
|
232
229
|
//import { Release } from '@nan0web/release'
|
|
233
230
|
const release = new Release({
|
|
234
|
-
version:
|
|
235
|
-
createdAt:
|
|
231
|
+
version: 'v1.0.0',
|
|
232
|
+
createdAt: '2025-08-20T10:00:00Z',
|
|
236
233
|
})
|
|
237
234
|
console.info(release.version) // ← v1.0.0
|
|
238
235
|
console.info(release.createdAt instanceof Date) // ← true
|
|
239
236
|
|
|
240
|
-
assert.strictEqual(console.output()[0][1],
|
|
237
|
+
assert.strictEqual(console.output()[0][1], 'v1.0.0')
|
|
241
238
|
assert.strictEqual(console.output()[1][1], true)
|
|
242
239
|
})
|
|
243
240
|
|
|
@@ -250,7 +247,7 @@ function testRender() {
|
|
|
250
247
|
* - Extraction of sections and tasks
|
|
251
248
|
* - Team and role parsing from markdown frontmatter or code
|
|
252
249
|
*/
|
|
253
|
-
it(
|
|
250
|
+
it('How to parse release notes markdown into structured data?', () => {
|
|
254
251
|
//import { ReleaseDocument } from '@nan0web/release'
|
|
255
252
|
const md = `# v1.0.0 - 2025-08-20
|
|
256
253
|
|
|
@@ -266,7 +263,7 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
266
263
|
console.info(doc.date instanceof Date) // ← true
|
|
267
264
|
console.info(doc.document.children instanceof Array) // ← true
|
|
268
265
|
|
|
269
|
-
assert.strictEqual(console.output()[0][1],
|
|
266
|
+
assert.strictEqual(console.output()[0][1], 'v1.0.0')
|
|
270
267
|
assert.strictEqual(console.output()[1][1], true)
|
|
271
268
|
assert.strictEqual(console.output()[2][1], true)
|
|
272
269
|
})
|
|
@@ -280,17 +277,17 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
280
277
|
* - `gender`: HumanGender
|
|
281
278
|
* - `contacts`: array of HumanContact
|
|
282
279
|
*/
|
|
283
|
-
it(
|
|
280
|
+
it('How to create a Person with typed properties?', () => {
|
|
284
281
|
//import { Person } from '@nan0web/release'
|
|
285
282
|
const person = new Person({
|
|
286
|
-
name: [
|
|
287
|
-
gender:
|
|
288
|
-
contacts: [
|
|
283
|
+
name: ['Alice', 'Developer'],
|
|
284
|
+
gender: 'female',
|
|
285
|
+
contacts: ['mailto:alice@example.com'],
|
|
289
286
|
})
|
|
290
287
|
console.info(person.name.firstName) // ← Alice
|
|
291
288
|
console.info(person.contacts.length >= 0) // ← true
|
|
292
289
|
|
|
293
|
-
assert.strictEqual(console.output()[0][1],
|
|
290
|
+
assert.strictEqual(console.output()[0][1], 'Alice')
|
|
294
291
|
assert.strictEqual(console.output()[1][1], true)
|
|
295
292
|
})
|
|
296
293
|
|
|
@@ -305,23 +302,23 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
305
302
|
* Tasks are registered as `taskId` → `testFilePath` in `ProjectManagement`.
|
|
306
303
|
* Their status is derived by running `node:test` suites.
|
|
307
304
|
*/
|
|
308
|
-
it(
|
|
305
|
+
it('How to register and validate tasks as tests?', async () => {
|
|
309
306
|
//import { ProjectManagement } from '@nan0web/release'
|
|
310
307
|
const pm = new ProjectManagement()
|
|
311
|
-
pm.registerTask(
|
|
312
|
-
pm.registerTask(
|
|
308
|
+
pm.registerTask('task-1', './tests/task1.test.js')
|
|
309
|
+
pm.registerTask('task-2', './tests/task2.test.js')
|
|
313
310
|
|
|
314
311
|
const mockResults = {
|
|
315
|
-
passed: [
|
|
312
|
+
passed: ['task-1'],
|
|
316
313
|
failed: [],
|
|
317
|
-
pending: [
|
|
314
|
+
pending: ['task-2'],
|
|
318
315
|
}
|
|
319
316
|
|
|
320
317
|
pm.validateProjectState = async () => mockResults
|
|
321
318
|
const results = await pm.validateProjectState()
|
|
322
319
|
|
|
323
|
-
console.info(results.passed.includes(
|
|
324
|
-
console.info(results.pending.includes(
|
|
320
|
+
console.info(results.passed.includes('task-1')) // ← true
|
|
321
|
+
console.info(results.pending.includes('task-2')) // ← true
|
|
325
322
|
|
|
326
323
|
assert.strictEqual(console.output()[0][1], true)
|
|
327
324
|
assert.strictEqual(console.output()[1][1], true)
|
|
@@ -337,19 +334,19 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
337
334
|
* - Version is correctly incremented
|
|
338
335
|
* - Git tag is applied if all validations succeed
|
|
339
336
|
*/
|
|
340
|
-
it(
|
|
337
|
+
it('How to execute a release after validation?', async () => {
|
|
341
338
|
//import { ReleaseManager, ProjectManagement } from '@nan0web/release'
|
|
342
339
|
const pm = new ProjectManagement()
|
|
343
340
|
const rm = new ReleaseManager(pm)
|
|
344
341
|
|
|
345
|
-
rm.calculateVersion = () =>
|
|
342
|
+
rm.calculateVersion = () => 'v1.0.1'
|
|
346
343
|
rm.publish = async () => true
|
|
347
344
|
|
|
348
|
-
const result = await rm.executeRelease(
|
|
345
|
+
const result = await rm.executeRelease('patch')
|
|
349
346
|
console.info(result.version) // ← v1.0.1
|
|
350
347
|
console.info(result.published) // ← true
|
|
351
348
|
|
|
352
|
-
assert.strictEqual(console.output()[0][1],
|
|
349
|
+
assert.strictEqual(console.output()[0][1], 'v1.0.1')
|
|
353
350
|
assert.strictEqual(console.output()[1][1], true)
|
|
354
351
|
})
|
|
355
352
|
|
|
@@ -362,7 +359,7 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
362
359
|
* - Generate corresponding test files
|
|
363
360
|
* - Automate task progression in CI
|
|
364
361
|
*/
|
|
365
|
-
it(
|
|
362
|
+
it('How to parse changelog and extract tasks?', () => {
|
|
366
363
|
//import { ChangelogTaskManager } from '@nan0web/release'
|
|
367
364
|
const ctm = new ChangelogTaskManager()
|
|
368
365
|
const changelog = `# Changelog
|
|
@@ -384,9 +381,9 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
384
381
|
* @docs
|
|
385
382
|
* ## Java•Script Features
|
|
386
383
|
*/
|
|
387
|
-
it(
|
|
384
|
+
it('Uses JSDoc and .d.ts files for autocompletion', () => {
|
|
388
385
|
assert.ok(pkg.types)
|
|
389
|
-
assert.ok(pkg.types.includes(
|
|
386
|
+
assert.ok(pkg.types.includes('.d.ts'))
|
|
390
387
|
})
|
|
391
388
|
|
|
392
389
|
/**
|
|
@@ -395,7 +392,7 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
395
392
|
*
|
|
396
393
|
* Try the package in the terminal:
|
|
397
394
|
*/
|
|
398
|
-
it(
|
|
395
|
+
it('How to run playground demo?', async () => {
|
|
399
396
|
/**
|
|
400
397
|
* ```bash
|
|
401
398
|
* git clone https://github.com/nan0web/release.git
|
|
@@ -405,9 +402,9 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
405
402
|
* ```
|
|
406
403
|
*/
|
|
407
404
|
assert.ok(pkg.scripts?.playground)
|
|
408
|
-
const response = await runSpawn(
|
|
405
|
+
const response = await runSpawn('git', ['remote', 'get-url', 'origin'])
|
|
409
406
|
assert.ok(response.code === 0)
|
|
410
|
-
assert.ok(response.text.trim().endsWith(
|
|
407
|
+
assert.ok(response.text.trim().endsWith(':nan0web/release.git'))
|
|
411
408
|
})
|
|
412
409
|
|
|
413
410
|
/**
|
|
@@ -416,7 +413,7 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
416
413
|
*
|
|
417
414
|
* To verify the project is ready, run:
|
|
418
415
|
*/
|
|
419
|
-
it(
|
|
416
|
+
it('How to check project status before publishing?', async () => {
|
|
420
417
|
/**
|
|
421
418
|
* ```bash
|
|
422
419
|
* npm test
|
|
@@ -425,44 +422,44 @@ Release milestone includes UI polish and core API stabilization.
|
|
|
425
422
|
* ```
|
|
426
423
|
*/
|
|
427
424
|
assert.ok(pkg.scripts?.test)
|
|
428
|
-
assert.ok(pkg.scripts?.[
|
|
429
|
-
assert.ok(pkg.scripts?.[
|
|
425
|
+
assert.ok(pkg.scripts?.['test:coverage'])
|
|
426
|
+
assert.ok(pkg.scripts?.['test:status'])
|
|
430
427
|
})
|
|
431
428
|
|
|
432
429
|
/**
|
|
433
430
|
* @docs
|
|
434
431
|
* ## Contributing
|
|
435
432
|
*/
|
|
436
|
-
it(
|
|
437
|
-
assert.equal(pkg.scripts?.precommit,
|
|
438
|
-
assert.equal(pkg.scripts?.prepush,
|
|
439
|
-
assert.equal(pkg.scripts?.prepare,
|
|
433
|
+
it('How to contribute? - [check here](./CONTRIBUTING.md)', async () => {
|
|
434
|
+
assert.equal(pkg.scripts?.precommit, 'npm test')
|
|
435
|
+
assert.equal(pkg.scripts?.prepush, 'npm test')
|
|
436
|
+
assert.equal(pkg.scripts?.prepare, 'husky')
|
|
440
437
|
})
|
|
441
438
|
|
|
442
439
|
/**
|
|
443
440
|
* @docs
|
|
444
441
|
* ## License
|
|
445
442
|
*/
|
|
446
|
-
it(
|
|
443
|
+
it('How to license ISC? - [check here](./LICENSE)', async () => {
|
|
447
444
|
/** @docs */
|
|
448
|
-
const text = await fs.loadDocument(
|
|
449
|
-
assert.ok(String(text).includes(
|
|
445
|
+
const text = await fs.loadDocument('LICENSE')
|
|
446
|
+
assert.ok(String(text).includes('ISC'))
|
|
450
447
|
})
|
|
451
448
|
}
|
|
452
449
|
|
|
453
|
-
describe(
|
|
450
|
+
describe('README.md testing', testRender)
|
|
454
451
|
|
|
455
|
-
describe(
|
|
456
|
-
let text =
|
|
457
|
-
const format = new Intl.NumberFormat(
|
|
452
|
+
describe('Rendering README.md', async () => {
|
|
453
|
+
let text = ''
|
|
454
|
+
const format = new Intl.NumberFormat('en-US').format
|
|
458
455
|
const parser = new DocsParser()
|
|
459
456
|
text = String(parser.decode(testRender))
|
|
460
|
-
await fs.saveDocument(
|
|
457
|
+
await fs.saveDocument('README.md', text)
|
|
461
458
|
const dataset = DatasetParser.parse(text, pkg.name)
|
|
462
|
-
await fs.saveDocument(
|
|
459
|
+
await fs.saveDocument('.datasets/README.dataset.jsonl', dataset)
|
|
463
460
|
|
|
464
461
|
it(`document is rendered [${format(Buffer.byteLength(text))}b]`, async () => {
|
|
465
|
-
const text = await
|
|
466
|
-
assert.ok(text.includes(
|
|
462
|
+
const text = await readFile('README.md', 'utf8')
|
|
463
|
+
assert.ok(text.includes('## License'))
|
|
467
464
|
})
|
|
468
465
|
})
|
package/src/Release/Document.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Markdown, { MDElement, MDHeading1, MDHeading2, MDHeading3 } from
|
|
2
|
-
import Person from
|
|
1
|
+
import Markdown, { MDElement, MDHeading1, MDHeading2, MDHeading3 } from '@nan0web/markdown'
|
|
2
|
+
import Person from './Person.js'
|
|
3
3
|
|
|
4
4
|
class ReleaseDocument extends Markdown {
|
|
5
5
|
/** @type {Person[]} */
|
|
@@ -20,15 +20,10 @@ class ReleaseDocument extends Markdown {
|
|
|
20
20
|
*/
|
|
21
21
|
constructor(options = {}) {
|
|
22
22
|
super()
|
|
23
|
-
const {
|
|
24
|
-
team = [],
|
|
25
|
-
roles = new Map(),
|
|
26
|
-
version = "",
|
|
27
|
-
date
|
|
28
|
-
} = options
|
|
23
|
+
const { team = [], roles = new Map(), version = '', date } = options
|
|
29
24
|
this.version = String(version)
|
|
30
25
|
this.date = date ? new Date(date) : undefined
|
|
31
|
-
this.team = team.map(t => Person.from(t))
|
|
26
|
+
this.team = team.map((t) => Person.from(t))
|
|
32
27
|
this.roles = new Map(roles)
|
|
33
28
|
}
|
|
34
29
|
|
|
@@ -43,13 +38,13 @@ class ReleaseDocument extends Markdown {
|
|
|
43
38
|
|
|
44
39
|
const h1s = this.document.filter((el) => el instanceof MDHeading1)
|
|
45
40
|
if (h1s.length !== 1) {
|
|
46
|
-
throw new TypeError(
|
|
41
|
+
throw new TypeError('Release document must have exactly one H1 heading with version and date')
|
|
47
42
|
}
|
|
48
43
|
|
|
49
|
-
const h1Content = h1s[0].content ??
|
|
50
|
-
const [versionPart, ...dateParts] = h1Content.split(
|
|
44
|
+
const h1Content = h1s[0].content ?? ''
|
|
45
|
+
const [versionPart, ...dateParts] = h1Content.split(' - ')
|
|
51
46
|
this.version = versionPart.trim()
|
|
52
|
-
this.date = new Date(dateParts.join(
|
|
47
|
+
this.date = new Date(dateParts.join(' - ').trim())
|
|
53
48
|
|
|
54
49
|
const sections = []
|
|
55
50
|
/** @type {{title: string, tasks: Array} | null} */
|
|
@@ -58,11 +53,10 @@ class ReleaseDocument extends Markdown {
|
|
|
58
53
|
if (el instanceof MDHeading2) {
|
|
59
54
|
currentSection = {
|
|
60
55
|
title: el.content.trim(),
|
|
61
|
-
tasks: []
|
|
56
|
+
tasks: [],
|
|
62
57
|
}
|
|
63
58
|
sections.push(currentSection)
|
|
64
|
-
}
|
|
65
|
-
else if (el instanceof MDHeading3 && currentSection) {
|
|
59
|
+
} else if (el instanceof MDHeading3 && currentSection) {
|
|
66
60
|
const content = el.content.trim()
|
|
67
61
|
const statusMatch = content.match(/^(\w+)\s*(.+)$/)
|
|
68
62
|
const slugMatch = content.match(/\[([^\]]+)\]$/)
|
|
@@ -84,7 +78,7 @@ class ReleaseDocument extends Markdown {
|
|
|
84
78
|
currentSection.tasks.push({
|
|
85
79
|
content: taskContent,
|
|
86
80
|
status: status,
|
|
87
|
-
slug: slug
|
|
81
|
+
slug: slug,
|
|
88
82
|
})
|
|
89
83
|
}
|
|
90
84
|
}
|
|
@@ -98,7 +92,7 @@ class ReleaseDocument extends Markdown {
|
|
|
98
92
|
*/
|
|
99
93
|
static from(input) {
|
|
100
94
|
if (input instanceof ReleaseDocument) return input
|
|
101
|
-
if (typeof input ===
|
|
95
|
+
if (typeof input === 'string') {
|
|
102
96
|
const doc = new ReleaseDocument()
|
|
103
97
|
doc.parse(input)
|
|
104
98
|
return doc
|
|
@@ -107,4 +101,4 @@ class ReleaseDocument extends Markdown {
|
|
|
107
101
|
}
|
|
108
102
|
}
|
|
109
103
|
|
|
110
|
-
export default ReleaseDocument
|
|
104
|
+
export default ReleaseDocument
|