@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.
Files changed (109) hide show
  1. package/README.md +24 -42
  2. package/bin/nan0release.js +27 -42
  3. package/package.json +48 -42
  4. package/project.yaml +79 -0
  5. package/src/README.md.js +90 -93
  6. package/src/Release/Document.js +13 -19
  7. package/src/Release/MarkdownToTest.js +35 -33
  8. package/src/Release/Person.js +3 -8
  9. package/src/Release/Scanner.js +179 -0
  10. package/src/Release.js +19 -12
  11. package/src/Team.js +9 -9
  12. package/src/architecture/ProjectManagementAsCode.js +8 -8
  13. package/src/cli/index.js +9 -0
  14. package/src/co/AppCommandOptions.js +4 -6
  15. package/src/commands/CloseCommand.js +67 -0
  16. package/src/commands/Command.js +48 -0
  17. package/src/commands/DepsCommand.js +143 -0
  18. package/src/commands/InitCommand.js +48 -56
  19. package/src/commands/PublishCommand.js +80 -119
  20. package/src/commands/SpecCommand.js +41 -0
  21. package/src/commands/StatusCommand.js +26 -0
  22. package/src/db/ReleaseDB.js +5 -5
  23. package/src/index.js +18 -0
  24. package/src/ui/cli/ReleaseCLi.js +52 -0
  25. package/src/utils/runSpawn.js +0 -0
  26. package/types/Release/Document.d.ts +2 -2
  27. package/types/Release/Person.d.ts +3 -3
  28. package/types/Release/Scanner.d.ts +90 -0
  29. package/types/Release.d.ts +37 -33
  30. package/types/ReleaseCLI.d.ts +29 -28
  31. package/types/Team.d.ts +3 -3
  32. package/types/architecture/ProjectManagementAsCode.d.ts +1 -1
  33. package/types/cli/index.d.ts +2 -0
  34. package/types/co/AppCommandMessage.d.ts +10 -11
  35. package/types/co/AppCommandOptions.d.ts +1 -2
  36. package/types/commands/BaseCommand.d.ts +23 -0
  37. package/types/commands/ChatCommand.d.ts +9 -9
  38. package/types/commands/ChatMessage.d.ts +36 -0
  39. package/types/commands/CloseCommand.d.ts +25 -0
  40. package/types/commands/Command.d.ts +28 -0
  41. package/types/commands/DepsCommand.d.ts +32 -0
  42. package/types/commands/DepsMessage.d.ts +28 -0
  43. package/types/commands/HostCommand.d.ts +7 -7
  44. package/types/commands/HostMessage.d.ts +44 -0
  45. package/types/commands/InitCommand.d.ts +24 -19
  46. package/types/commands/InitMessage.d.ts +24 -0
  47. package/types/commands/ListCommand.d.ts +8 -8
  48. package/types/commands/ListMessage.d.ts +30 -0
  49. package/types/commands/PublishCommand.d.ts +36 -47
  50. package/types/commands/PublishMessage.d.ts +39 -0
  51. package/types/commands/SealCommand.d.ts +7 -7
  52. package/types/commands/SealMessage.d.ts +28 -0
  53. package/types/commands/ServeCommand.d.ts +7 -7
  54. package/types/commands/ServeMessage.d.ts +30 -0
  55. package/types/commands/ShowCommand.d.ts +7 -7
  56. package/types/commands/SpecCommand.d.ts +25 -0
  57. package/types/commands/StatusCommand.d.ts +9 -0
  58. package/types/commands/SubCommand.d.ts +9 -7
  59. package/types/commands/ValidateCommand.d.ts +7 -7
  60. package/types/commands/ValidateMessage.d.ts +20 -0
  61. package/types/db/ReleaseDB.d.ts +2 -2
  62. package/types/index.d.ts +10 -0
  63. package/types/ui/cli/ReleaseCLi.d.ts +10 -0
  64. package/types/ui/cli/index.d.ts +0 -0
  65. package/types/utils/runSpawn.d.ts +0 -0
  66. package/.datasets/README.dataset.jsonl +0 -19
  67. package/.editorconfig +0 -20
  68. package/CHANGELOG.md +0 -6
  69. package/CONTRIBUTING.md +0 -42
  70. package/bin/commands/InitCommand.js +0 -10
  71. package/bin/lib/functions.js +0 -240
  72. package/bin/lib/functions.test.js +0 -138
  73. package/bin/release.js +0 -12
  74. package/bin/release.test.js +0 -73
  75. package/bin/temp/package.json +0 -1
  76. package/docs/system.uk.md +0 -413
  77. package/docs/uk/README.md +0 -284
  78. package/legacy/PrepareCommand.js +0 -154
  79. package/legacy/PrepareCommand.test.js +0 -189
  80. package/legacy/changelog.js +0 -446
  81. package/releases/1/0/v1.0.0/models/Person.js +0 -26
  82. package/releases/1/0/v1.0.0/models/Person.test.js +0 -44
  83. package/releases/1/0/v1.0.0/models/company.js +0 -11
  84. package/releases/1/0/v1.0.0/models/members.js +0 -14
  85. package/releases/1/0/v1.0.0/models/members.test.js +0 -21
  86. package/releases/1/0/v1.0.0/models/teams/DevTeam.js +0 -6
  87. package/releases/1/0/v1.0.0/models/teams/DevTeam.test.js +0 -15
  88. package/releases/1/0/v1.0.0/models/teams/index.js +0 -5
  89. package/releases/1/0/v1.0.0/release.js +0 -12
  90. package/releases/1/0/v1.0.0/release.md +0 -121
  91. package/releases/1/0/v1.0.0/release.test.js +0 -36
  92. package/releases/1/0/v1.0.0/test/YaRaSLove/git-native.test.js +0 -14
  93. package/releases/current.js +0 -3
  94. package/releases/index.js +0 -11
  95. package/src/Release/MarkdownToTest.test.js +0 -60
  96. package/src/ReleaseCLI.js +0 -122
  97. package/src/architecture/ProjectManagementAsCode.test.js +0 -128
  98. package/src/co/AppCommandMessage.js +0 -22
  99. package/src/commands/ChatCommand.js +0 -56
  100. package/src/commands/HostCommand.js +0 -63
  101. package/src/commands/ListCommand.js +0 -56
  102. package/src/commands/SealCommand.js +0 -51
  103. package/src/commands/ServeCommand.js +0 -53
  104. package/src/commands/ShowCommand.js +0 -58
  105. package/src/commands/SubCommand.js +0 -21
  106. package/src/commands/ValidateCommand.js +0 -66
  107. package/system.md +0 -571
  108. package/tsconfig.json +0 -23
  109. /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 "node:test"
2
- import assert from "node:assert/strict"
3
- import FS from "@nan0web/db-fs"
4
- import { NoConsole } from "@nan0web/log"
5
- import {
6
- DatasetParser,
7
- DocsParser,
8
- runSpawn,
9
- } from "@nan0web/test"
10
- import ReleaseCLI from "./ReleaseCLI.js"
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 "./architecture/ProjectManagementAsCode.js"
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("package.json", {})
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("How to install with pnpm?", () => {
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, "@nan0web/release")
69
+ assert.equal(pkg.name, '@nan0web/release')
73
70
  })
74
71
  /**
75
72
  * @docs
76
73
  */
77
- it("How to install with npm?", () => {
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, "@nan0web/release")
80
+ assert.equal(pkg.name, '@nan0web/release')
84
81
  })
85
82
  /**
86
83
  * @docs
87
84
  */
88
- it("How to install with yarn?", () => {
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, "@nan0web/release")
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("How to initialize a new release version?", () => {
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 = new ReleaseCLI()
110
- assert.ok(cli instanceof ReleaseCLI)
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("How to show release information?", () => {
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: "v1.0.0",
125
- createdAt: new Date("2025-08-20")
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], "v1.0.0")
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("How to list all releases?", () => {
132
+ it('How to list all releases?', () => {
136
133
  /**
137
134
  * ```bash
138
135
  * release list [--json]
139
136
  * ```
140
137
  */
141
- const cli = new ReleaseCLI()
142
- assert.ok(cli.releases)
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("How to write a release chat message?", () => {
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 = new ReleaseCLI()
156
- assert.ok(cli instanceof ReleaseCLI)
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("How to host release UI?", () => {
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 = new ReleaseCLI()
170
- assert.ok(cli instanceof ReleaseCLI)
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("How to serve release static assets?", () => {
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 = new ReleaseCLI()
184
- assert.ok(cli instanceof ReleaseCLI)
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("How to validate release tasks?", () => {
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: "v1.0.0",
199
- createdAt: new Date("2025-08-20")
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("How to seal a release?", () => {
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 = new ReleaseCLI()
215
- assert.ok(cli instanceof ReleaseCLI)
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("How to instantiate a Release?", () => {
228
+ it('How to instantiate a Release?', () => {
232
229
  //import { Release } from '@nan0web/release'
233
230
  const release = new Release({
234
- version: "v1.0.0",
235
- createdAt: "2025-08-20T10:00:00Z"
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], "v1.0.0")
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("How to parse release notes markdown into structured data?", () => {
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], "v1.0.0")
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("How to create a Person with typed properties?", () => {
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: ["Alice", "Developer"],
287
- gender: "female",
288
- contacts: ["mailto:alice@example.com"]
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], "Alice")
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("How to register and validate tasks as tests?", async () => {
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("task-1", "./tests/task1.test.js")
312
- pm.registerTask("task-2", "./tests/task2.test.js")
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: ["task-1"],
312
+ passed: ['task-1'],
316
313
  failed: [],
317
- pending: ["task-2"]
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("task-1")) // ← true
324
- console.info(results.pending.includes("task-2")) // ← true
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("How to execute a release after validation?", async () => {
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 = () => "v1.0.1"
342
+ rm.calculateVersion = () => 'v1.0.1'
346
343
  rm.publish = async () => true
347
344
 
348
- const result = await rm.executeRelease("patch")
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], "v1.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("How to parse changelog and extract tasks?", () => {
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("Uses JSDoc and .d.ts files for autocompletion", () => {
384
+ it('Uses JSDoc and .d.ts files for autocompletion', () => {
388
385
  assert.ok(pkg.types)
389
- assert.ok(pkg.types.includes(".d.ts"))
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("How to run playground demo?", async () => {
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("git", ["remote", "get-url", "origin"])
405
+ const response = await runSpawn('git', ['remote', 'get-url', 'origin'])
409
406
  assert.ok(response.code === 0)
410
- assert.ok(response.text.trim().endsWith(":nan0web/release.git"))
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("How to check project status before publishing?", async () => {
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?.["test:coverage"])
429
- assert.ok(pkg.scripts?.["test:status"])
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("How to contribute? - [check here](./CONTRIBUTING.md)", async () => {
437
- assert.equal(pkg.scripts?.precommit, "npm test")
438
- assert.equal(pkg.scripts?.prepush, "npm test")
439
- assert.equal(pkg.scripts?.prepare, "husky")
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("How to license ISC? - [check here](./LICENSE)", async () => {
443
+ it('How to license ISC? - [check here](./LICENSE)', async () => {
447
444
  /** @docs */
448
- const text = await fs.loadDocument("LICENSE")
449
- assert.ok(String(text).includes("ISC"))
445
+ const text = await fs.loadDocument('LICENSE')
446
+ assert.ok(String(text).includes('ISC'))
450
447
  })
451
448
  }
452
449
 
453
- describe("README.md testing", testRender)
450
+ describe('README.md testing', testRender)
454
451
 
455
- describe("Rendering README.md", async () => {
456
- let text = ""
457
- const format = new Intl.NumberFormat("en-US").format
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("README.md", text)
457
+ await fs.saveDocument('README.md', text)
461
458
  const dataset = DatasetParser.parse(text, pkg.name)
462
- await fs.saveDocument(".datasets/README.dataset.jsonl", dataset)
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 fs.loadDocument("README.md")
466
- assert.ok(text.includes("## License"))
462
+ const text = await readFile('README.md', 'utf8')
463
+ assert.ok(text.includes('## License'))
467
464
  })
468
465
  })
@@ -1,5 +1,5 @@
1
- import Markdown, { MDElement, MDHeading1, MDHeading2, MDHeading3 } from "@nan0web/markdown"
2
- import Person from "./Person.js"
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("Release document must have exactly one H1 heading with version and date")
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(" - ").trim())
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 === "string") {
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