@meza/adr-tools 1.0.10 → 1.0.12

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 (93) hide show
  1. package/.gitattributes +40 -0
  2. package/.github/renovate.json +5 -0
  3. package/.github/workflows/ci-pr.yml +50 -0
  4. package/.github/workflows/ci.yml +28 -20
  5. package/.github/workflows/sync-deps-to-main.yml +25 -0
  6. package/.github/workflows/sync-to-deps.yml +26 -0
  7. package/.releaserc.json +1 -13
  8. package/CHANGELOG.md +76 -0
  9. package/LICENSE +674 -0
  10. package/README.md +64 -5
  11. package/biome.json +148 -0
  12. package/dist/index.js +52 -82
  13. package/dist/index.js.map +1 -1
  14. package/dist/lib/adr.js +100 -126
  15. package/dist/lib/adr.js.map +1 -1
  16. package/dist/lib/config.js +20 -37
  17. package/dist/lib/config.js.map +1 -1
  18. package/dist/lib/links.js +8 -25
  19. package/dist/lib/links.js.map +1 -1
  20. package/dist/lib/links.test.js +35 -64
  21. package/dist/lib/links.test.js.map +1 -1
  22. package/dist/lib/manipulator.js +22 -23
  23. package/dist/lib/manipulator.js.map +1 -1
  24. package/dist/lib/manipulator.test.js +59 -63
  25. package/dist/lib/manipulator.test.js.map +1 -1
  26. package/dist/lib/numbering.js +9 -48
  27. package/dist/lib/numbering.js.map +1 -1
  28. package/dist/lib/numbering.test.js +27 -44
  29. package/dist/lib/numbering.test.js.map +1 -1
  30. package/dist/lib/prompt.js +14 -0
  31. package/dist/lib/prompt.js.map +1 -0
  32. package/dist/lib/prompt.test.js +33 -0
  33. package/dist/lib/prompt.test.js.map +1 -0
  34. package/dist/lib/template.js +13 -26
  35. package/dist/lib/template.js.map +1 -1
  36. package/dist/types/lib/adr.d.ts.map +1 -1
  37. package/dist/types/lib/config.d.ts.map +1 -1
  38. package/dist/types/lib/links.d.ts.map +1 -1
  39. package/dist/types/lib/manipulator.d.ts.map +1 -1
  40. package/dist/types/lib/numbering.d.ts.map +1 -1
  41. package/dist/types/lib/prompt.d.ts +2 -0
  42. package/dist/types/lib/prompt.d.ts.map +1 -0
  43. package/dist/types/lib/prompt.test.d.ts +2 -0
  44. package/dist/types/lib/prompt.test.d.ts.map +1 -0
  45. package/dist/types/lib/template.d.ts.map +1 -1
  46. package/dist/types/version.d.ts +1 -1
  47. package/dist/version.js +1 -4
  48. package/dist/version.js.map +1 -1
  49. package/doc/adr/.adr-sequence.lock +1 -0
  50. package/doc/adr/decisions.md +3 -0
  51. package/package.json +73 -47
  52. package/src/index.ts +52 -27
  53. package/src/lib/adr.ts +68 -73
  54. package/src/lib/config.ts +3 -3
  55. package/src/lib/links.test.ts +8 -24
  56. package/src/lib/links.ts +2 -2
  57. package/src/lib/manipulator.test.ts +44 -47
  58. package/src/lib/manipulator.ts +22 -10
  59. package/src/lib/numbering.test.ts +5 -9
  60. package/src/lib/numbering.ts +4 -5
  61. package/src/lib/prompt.test.ts +42 -0
  62. package/src/lib/prompt.ts +14 -0
  63. package/src/lib/template.ts +7 -3
  64. package/src/version.ts +1 -1
  65. package/tests/.adr-dir +1 -0
  66. package/tests/__snapshots__/generate-graph.e2e.test.ts.snap +23 -23
  67. package/tests/__snapshots__/init-adr-repository.e2e.test.ts.snap +1 -1
  68. package/tests/__snapshots__/linking-records.e2e.test.ts.snap +1 -1
  69. package/tests/__snapshots__/new-adr.e2e.test.ts.snap +1 -1
  70. package/tests/__snapshots__/superseding-records.e2e.test.ts.snap +1 -1
  71. package/tests/__snapshots__/toc-prefixing.e2e.test.ts.snap +1 -1
  72. package/tests/__snapshots__/use-template-override.e2e.test.ts.snap +1 -1
  73. package/tests/edit-on-create.e2e.test.ts +17 -12
  74. package/tests/funny-characters.e2e.test.ts +28 -21
  75. package/tests/generate-graph.e2e.test.ts +21 -13
  76. package/tests/init-adr-repository.e2e.test.ts +12 -8
  77. package/tests/linking-records.e2e.test.ts +21 -14
  78. package/tests/list-adrs.e2e.test.ts +23 -18
  79. package/tests/new-adr.e2e.test.ts +15 -12
  80. package/tests/superseding-records.e2e.test.ts +16 -11
  81. package/tests/toc-prefixing.e2e.test.ts +15 -11
  82. package/tests/use-template-override.e2e.test.ts +18 -10
  83. package/tests/work-form-other-directories.e2e.test.ts +14 -12
  84. package/tsconfig.json +9 -8
  85. package/vitest.config.e2e.ts +13 -0
  86. package/vitest.config.ts +8 -1
  87. package/.eslintignore +0 -2
  88. package/.eslintrc.json +0 -23
  89. package/.github/dependabot.yml +0 -14
  90. package/.github/workflows/auto-merge.yml +0 -14
  91. package/doc/adr/0001-record-architecture-decisions.md +0 -21
  92. package/doc/adr/0002-using-heavy-e2e-tests.md +0 -20
  93. /package/src/{environment.d.ts → types/environment.d.ts} +0 -0
@@ -0,0 +1,33 @@
1
+ import { faker } from '@faker-js/faker';
2
+ import inquirer from 'inquirer';
3
+ import { describe, expect, it, vi } from 'vitest';
4
+ import { askForClarification } from './prompt.js';
5
+ vi.mock('inquirer');
6
+ vi.mock('chalk', () => ({
7
+ default: {
8
+ blue: (str) => {
9
+ return `BLUE[${str}]`;
10
+ }
11
+ }
12
+ }));
13
+ describe('The prompt helper', () => {
14
+ it('calls inquirer correctly', async () => {
15
+ const prompt = vi.mocked(inquirer.prompt);
16
+ prompt.mockResolvedValueOnce({ target: 'does not matter' });
17
+ const randomChoices = [faker.system.filePath(), faker.system.filePath(), faker.system.filePath()];
18
+ await askForClarification('this is the search string', randomChoices);
19
+ expect(prompt).toHaveBeenCalledOnce();
20
+ const calledWith = prompt.mock.calls[0][0];
21
+ expect(calledWith[0].type).toEqual('list');
22
+ expect(calledWith[0].choices).toEqual(randomChoices);
23
+ expect(calledWith[0].message).toMatchInlineSnapshot('"Which file do you want to link to for BLUE[this is the search string]?"');
24
+ });
25
+ it('returns the selected choice', async () => {
26
+ const prompt = vi.mocked(inquirer.prompt);
27
+ const randomResult = faker.system.filePath();
28
+ prompt.mockResolvedValueOnce({ target: randomResult });
29
+ const result = await askForClarification('this is the search string', ['does not matter']);
30
+ expect(result).toEqual(randomResult);
31
+ });
32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AAC;QACzD,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC3C,MAAM,CAAE,UAAU,CAAC,CAAC,CAAkB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QACvE,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,qBAAqB,CACjD,0EAA0E,CAC3E,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,KAAK,IAAI,EAAE;QAC3C,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE1C,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;QAE7C,MAAM,CAAC,qBAAqB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,CAAC;QAEvD,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,2BAA2B,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAE3F,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,34 +1,21 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.template = void 0;
16
- const promises_1 = __importDefault(require("fs/promises"));
17
- const path_1 = __importDefault(require("path"));
18
- const config_1 = require("./config");
19
- const template = (templateFile) => __awaiter(void 0, void 0, void 0, function* () {
1
+ import * as path from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ import fs from 'fs/promises';
4
+ import { getDir } from './config.js';
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+ export const template = async (templateFile) => {
20
8
  if (templateFile) {
21
- return yield promises_1.default.readFile(path_1.default.resolve(templateFile), 'utf8');
9
+ return await fs.readFile(path.resolve(templateFile), 'utf8');
22
10
  }
23
11
  if (process.env.ADR_TEMPLATE) {
24
- return yield promises_1.default.readFile(path_1.default.resolve(process.env.ADR_TEMPLATE), 'utf8');
12
+ return await fs.readFile(path.resolve(process.env.ADR_TEMPLATE), 'utf8');
25
13
  }
26
14
  try {
27
- return yield promises_1.default.readFile(path_1.default.join(yield (0, config_1.getDir)(), 'templates/template.md'), 'utf8');
15
+ return await fs.readFile(path.join(await getDir(), 'templates/template.md'), 'utf8');
28
16
  }
29
- catch (e) {
30
- return yield promises_1.default.readFile(path_1.default.resolve(path_1.default.join(__dirname, '../templates/template.md')), 'utf8');
17
+ catch (_e) {
18
+ return await fs.readFile(path.resolve(path.join(__dirname, '../templates/template.md')), 'utf8');
31
19
  }
32
- });
33
- exports.template = template;
20
+ };
34
21
  //# sourceMappingURL=template.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"src/","sources":["lib/template.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2DAA6B;AAC7B,gDAAwB;AACxB,qCAAkC;AAE3B,MAAM,QAAQ,GAAG,CAAO,YAAqB,EAAmB,EAAE;IACvE,IAAI,YAAY,EAAE;QAChB,OAAO,MAAM,kBAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,OAAO,CAAC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pB,CAAC"}
1
+ {"version":3,"file":"adr.d.ts","sourceRoot":"src/","sources":["lib/adr.ts"],"names":[],"mappings":"AAaA,UAAU,UAAU;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AA6GD,eAAO,MAAM,WAAW,GAAU,UAAU;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,kBAc9D,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,OAAO,MAAM,EAAE,SAAS,UAAU,kBAuC9D,CAAC;AAEF,eAAO,MAAM,IAAI,GAAU,YAAY,MAAM,kBAQ5C,CAAC;AAEF,eAAO,MAAM,IAAI,GACf,QAAQ,MAAM,EACd,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd,aAAa,MAAM,EACnB,UAAU;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,kBAqB9B,CAAC;AAEF,eAAO,MAAM,QAAQ,yBAapB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"src/","sources":["lib/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,cAAsB,CAAC;AAyB9C,eAAO,MAAM,MAAM,QAAa,QAAQ,MAAM,CAI7C,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"src/","sources":["lib/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,UAAU,cAAsB,CAAC;AAyB9C,eAAO,MAAM,MAAM,QAAa,OAAO,CAAC,MAAM,CAI7C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"links.d.ts","sourceRoot":"src/","sources":["lib/links.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,oBAAoB,YAAmB,MAAM,sBAGzD,CAAC;AAEF,eAAO,MAAM,cAAc,eAAsB,MAAM,gBAAe,OAAO,KAAW,QAAQ,WAAW,CAiB1G,CAAC"}
1
+ {"version":3,"file":"links.d.ts","sourceRoot":"src/","sources":["lib/links.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,eAAO,MAAM,oBAAoB,GAAU,SAAS,MAAM,sBAGzD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,YAAY,MAAM,EAAE,cAAa,OAAe,KAAG,OAAO,CAAC,WAAW,CAiB1G,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"manipulator.d.ts","sourceRoot":"src/","sources":["lib/manipulator.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,aAAc,MAAM;;;;;;GAmB5C,CAAC;AAEF,eAAO,MAAM,YAAY,QAAS,MAAM,WAOvC,CAAC;AAEF,eAAO,MAAM,SAAS,aAAc,MAAM,QAAQ,MAAM,WAwBvD,CAAC;AAEF,eAAO,MAAM,UAAU,aAAc,MAAM,QAAQ,MAAM,WAuBxD,CAAC"}
1
+ {"version":3,"file":"manipulator.d.ts","sourceRoot":"src/","sources":["lib/manipulator.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,YAAY,GAAI,UAAU,MAAM;;;;;;GAmB5C,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,WAOvC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,WA+BvD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,EAAE,MAAM,MAAM,WA4BxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"numbering.d.ts","sourceRoot":"src/","sources":["lib/numbering.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,uBAqBrB,CAAC"}
1
+ {"version":3,"file":"numbering.d.ts","sourceRoot":"src/","sources":["lib/numbering.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,SAAS,uBAoBrB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const askForClarification: (searchString: string, matches: string[]) => Promise<any>;
2
+ //# sourceMappingURL=prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"src/","sources":["lib/prompt.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,mBAAmB,GAAU,cAAc,MAAM,EAAE,SAAS,MAAM,EAAE,iBAUhF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prompt.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt.test.d.ts","sourceRoot":"src/","sources":["lib/prompt.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"src/","sources":["lib/template.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,kBAAyB,MAAM,KAAG,QAAQ,MAAM,CAapE,CAAC"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"src/","sources":["lib/template.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,QAAQ,GAAU,eAAe,MAAM,KAAG,OAAO,CAAC,MAAM,CAapE,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const LIB_VERSION = "1.0.10";
1
+ export declare const LIB_VERSION = "1.0.12";
2
2
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,5 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LIB_VERSION = void 0;
4
- exports.LIB_VERSION = '1.0.10';
1
+ export const LIB_VERSION = '1.0.12';
5
2
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"src/","sources":["version.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GAAG,QAAQ,CAAC"}
1
+ {"version":3,"file":"version.js","sourceRoot":"src/","sources":["version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,QAAQ,CAAC"}
@@ -0,0 +1 @@
1
+ 1
@@ -0,0 +1,3 @@
1
+ # Table of Contents
2
+
3
+ - [1. Something about Node.JS](0001-something-about-node-js.md)
package/package.json CHANGED
@@ -1,10 +1,19 @@
1
1
  {
2
2
  "name": "@meza/adr-tools",
3
- "version": "1.0.10",
4
- "main": "dist/index.js",
3
+ "version": "1.0.12",
4
+ "exports": {
5
+ ".": {
6
+ "import": {
7
+ "types": "dist/types/index.d.ts",
8
+ "default": "dist/index.js"
9
+ }
10
+ }
11
+ },
5
12
  "bin": {
6
13
  "adr": "dist/index.js"
7
14
  },
15
+ "license": "GPL-3.0",
16
+ "type": "module",
8
17
  "types": "dist/index.d.ts",
9
18
  "private": false,
10
19
  "scripts": {
@@ -13,30 +22,30 @@
13
22
  "copy": "copyfiles -u 1 ./src/templates/** ./dist",
14
23
  "build": "tsc && yarn copy",
15
24
  "start": "ts-node src/index.ts",
16
- "commit": "commit",
17
- "ci": "npm set editor '' && yarn lint && yarn test",
25
+ "commit": "cz",
26
+ "ci": "npm set editor 'true' && npm-run-all --parallel lint test",
18
27
  "ci:dev": "exit 0",
19
28
  "clean": "rimraf dist .cache/tsbuildinfo",
20
29
  "clean:all": "yarn clean && rm -rf node_modules .cache",
21
- "lint:eslint": "eslint . --ext .ts --ext .json --cache --cache-location .cache/",
30
+ "lint:ci": "biome ci --reporter=github",
22
31
  "lint:tsc": "tsc --noEmit",
23
- "lint:fix": "yarn lint:eslint --fix && yarn lint:tsc",
24
- "lint": "yarn lint:eslint && yarn lint:tsc",
25
- "test": "vitest",
32
+ "lint": "npm-run-all --parallel lint:*",
33
+ "test": "npm-run-all --parallel test:*",
34
+ "test:unit": "vitest",
35
+ "test:e2e": "vitest --config vitest.config.e2e.ts",
26
36
  "prepare": "is-ci || husky install",
27
37
  "report": "exit 0",
28
38
  "semantic-release": "semantic-release",
29
39
  "release": "semantic-release"
30
40
  },
31
41
  "dependencies": {
32
- "@types/inquirer": "^8.2.1",
33
- "@types/marked": "^4.0.3",
34
- "@types/node": "^18.0.0",
35
- "chalk": "^4.1.2",
36
- "commander": "^9.3.0",
37
- "core-js": "^3.19.1",
38
- "inquirer": "^8.2.4",
39
- "marked": "^4.0.17"
42
+ "@types/inquirer": "9.0.8",
43
+ "@types/node": "22.15.21",
44
+ "chalk": "5.4.1",
45
+ "commander": "12.1.0",
46
+ "core-js": "3.42.0",
47
+ "inquirer": "9.3.7",
48
+ "marked": "4.3.0"
40
49
  },
41
50
  "commitlint": {
42
51
  "extends": [
@@ -52,37 +61,39 @@
52
61
  }
53
62
  },
54
63
  "devDependencies": {
55
- "@commitlint/cli": "^17.0.2",
56
- "@commitlint/config-conventional": "^17.0.2",
57
- "@commitlint/prompt-cli": "^17.0.0",
58
- "@meza/tsconfig-base": "^1.1.0",
59
- "@semantic-release/changelog": "^6.0.1",
60
- "@semantic-release/commit-analyzer": "^9.0.2",
61
- "@semantic-release/git": "^10.0.1",
62
- "@semantic-release/github": "^8.0.4",
63
- "@semantic-release/npm": "^9.0.1",
64
- "@semantic-release/release-notes-generator": "^10.0.3",
65
- "@types/uuid": "^8.3.4",
66
- "@typescript-eslint/eslint-plugin": "^5.29.0",
67
- "@typescript-eslint/parser": "^5.3.0",
68
- "@vitest/ui": "^0.15.2",
69
- "c8": "^7.11.3",
70
- "copyfiles": "^2.4.1",
71
- "eslint": "^8.1.0",
72
- "eslint-config-tailored-tunes": "^5.0.2",
73
- "eslint-plugin-json": "^3.1.0",
74
- "eslint-plugin-security": "^1.5.0",
75
- "husky": "^8.0.1",
76
- "install-deps-postmerge": "^2.0.1",
77
- "is-ci": "^3.0.1",
78
- "mock-cwd": "^1.0.0",
79
- "rimraf": "^3.0.2",
80
- "semantic-release": "^19.0.3",
81
- "ts-node": "^10.8.1",
82
- "typescript": "^4.4.4",
83
- "uuid": "^8.3.2",
84
- "vitest": "^0.15.2",
85
- "yarn": "^1.22.17"
64
+ "@biomejs/biome": "1.9.4",
65
+ "@commitlint/cli": "19.8.1",
66
+ "@commitlint/config-conventional": "19.8.1",
67
+ "@commitlint/prompt-cli": "19.8.1",
68
+ "@faker-js/faker": "9.8.0",
69
+ "@meza/adr-tools": "1.0.10",
70
+ "@meza/tsconfig-base": "1.1.0",
71
+ "@ryansonshine/commitizen": "4.2.8",
72
+ "@ryansonshine/cz-conventional-changelog": "3.3.4",
73
+ "@semantic-release/changelog": "6.0.3",
74
+ "@semantic-release/commit-analyzer": "13.0.1",
75
+ "@semantic-release/git": "10.0.1",
76
+ "@semantic-release/github": "11.0.2",
77
+ "@semantic-release/npm": "12.0.1",
78
+ "@semantic-release/release-notes-generator": "14.0.3",
79
+ "@types/uuid": "10.0.0",
80
+ "@vitest/ui": "3.1.4",
81
+ "copyfiles": "2.4.1",
82
+ "cross-env": "7.0.3",
83
+ "husky": "9.1.7",
84
+ "install-deps-postmerge": "2.0.1",
85
+ "is-ci": "4.1.0",
86
+ "lint-staged": "16.0.0",
87
+ "mock-cwd": "1.0.0",
88
+ "npm-run-all2": "8.0.3",
89
+ "rimraf": "6.0.1",
90
+ "semantic-release": "24.2.4",
91
+ "ts-node": "10.9.2",
92
+ "tsx": "^4.19.4",
93
+ "typescript": "5.8.3",
94
+ "uuid": "11.1.0",
95
+ "vitest": "3.1.4",
96
+ "yarn": "1.22.22"
86
97
  },
87
98
  "repository": {
88
99
  "type": "git",
@@ -90,5 +101,20 @@
90
101
  },
91
102
  "publishConfig": {
92
103
  "access": "public"
104
+ },
105
+ "config": {
106
+ "commitizen": {
107
+ "path": "./node_modules/@ryansonshine/cz-conventional-changelog"
108
+ }
109
+ },
110
+ "lint-staged": {
111
+ "*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}": [
112
+ "biome check --files-ignore-unknown=true",
113
+ "biome check --write --no-errors-on-unmatched",
114
+ "biome check --write --organize-imports-enabled=false --no-errors-on-unmatched",
115
+ "biome check --write --unsafe --no-errors-on-unmatched",
116
+ "biome format --write --no-errors-on-unmatched",
117
+ "biome lint --write --no-errors-on-unmatched"
118
+ ]
93
119
  }
94
120
  }
package/src/index.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { Command } from 'commander';
4
- import { LIB_VERSION } from './version';
5
- import { generateToc, init, link, listAdrs, newAdr } from './lib/adr';
6
- import chalk from 'chalk';
7
- import { workingDir } from './lib/config';
8
3
  import * as path from 'path';
9
- import { getLinksFrom, getTitleFrom } from './lib/manipulator';
4
+ import chalk from 'chalk';
5
+ import { Command } from 'commander';
10
6
  import fs from 'fs/promises';
7
+ import { generateToc, init, link, listAdrs, newAdr } from './lib/adr.js';
8
+ import { workingDir } from './lib/config.js';
9
+ import { getLinksFrom, getTitleFrom } from './lib/manipulator.js';
10
+ import { LIB_VERSION } from './version.js';
11
11
 
12
12
  const program = new Command();
13
13
 
@@ -21,7 +21,7 @@ const collectSupersedes = (val: string, memo: string[]) => {
21
21
  return memo;
22
22
  };
23
23
 
24
- const generateGraph = async (options?: {prefix: string, extension :string}) => {
24
+ const generateGraph = async (options?: { prefix: string; extension: string }) => {
25
25
  let text = 'digraph {\n';
26
26
  text += ' node [shape=plaintext];\n';
27
27
  text += ' subgraph {\n';
@@ -49,7 +49,6 @@ const generateGraph = async (options?: {prefix: string, extension :string}) => {
49
49
  text += ` _${n} -> _${linksInADR[j].targetNumber} [label="${linksInADR[j].label}", weight=0]\n`;
50
50
  }
51
51
  }
52
-
53
52
  }
54
53
 
55
54
  text += '}\n';
@@ -58,16 +57,30 @@ const generateGraph = async (options?: {prefix: string, extension :string}) => {
58
57
 
59
58
  program.name('adr').version(LIB_VERSION).description('Manage Architecture Decision Logs');
60
59
 
61
- program.command('new')
60
+ program
61
+ .command('new')
62
62
  .argument('<title...>', 'The title of the decision')
63
- .option('-q, --quiet', 'Do not ask for clarification. If multiple files match the search pattern, an error will be thrown.')
64
- .option('-s, --supersede <SUPERSEDE>', 'A reference (number or partial filename) of a previous decision that the new decision supercedes.\n'
65
- + 'A Markdown link to the superceded ADR is inserted into the Status section.\n'
66
- + 'The status of the superceded ADR is changed to record that it has been superceded by the new ADR.', collectSupersedes, [])
67
- .option('-l, --link "<TARGET:LINK:REVERSE-LINK>"', 'Links the new ADR to a previous ADR.\n'
68
- + `${chalk.bold('TARGET')} is a reference (number or partial filename) of a previous decision.\n`
69
- + `${chalk.bold('LINK')} is the description of the link created in the new ADR.\n`
70
- + `${chalk.bold('REVERSE-LINK')} is the description of the link created in the existing ADR that will refer to the new ADR`, collectLinks, [])
63
+ .option(
64
+ '-q, --quiet',
65
+ 'Do not ask for clarification. If multiple files match the search pattern, an error will be thrown.'
66
+ )
67
+ .option(
68
+ '-s, --supersede <SUPERSEDE>',
69
+ 'A reference (number or partial filename) of a previous decision that the new decision supercedes.\n' +
70
+ 'A Markdown link to the superceded ADR is inserted into the Status section.\n' +
71
+ 'The status of the superceded ADR is changed to record that it has been superceded by the new ADR.',
72
+ collectSupersedes,
73
+ []
74
+ )
75
+ .option(
76
+ '-l, --link "<TARGET:LINK:REVERSE-LINK>"',
77
+ 'Links the new ADR to a previous ADR.\n' +
78
+ `${chalk.bold('TARGET')} is a reference (number or partial filename) of a previous decision.\n` +
79
+ `${chalk.bold('LINK')} is the description of the link created in the new ADR.\n` +
80
+ `${chalk.bold('REVERSE-LINK')} is the description of the link created in the existing ADR that will refer to the new ADR`,
81
+ collectLinks,
82
+ []
83
+ )
71
84
  .action(async (title: string[], options) => {
72
85
  try {
73
86
  await newAdr(title.join(' '), {
@@ -83,33 +96,45 @@ program.command('new')
83
96
 
84
97
  const generate = program.command('generate');
85
98
 
86
- generate.command('toc')
99
+ generate
100
+ .command('toc')
87
101
  .option('-p, --prefix <PREFIX>', 'The prefix to use for each file link in the generated TOC.')
88
102
  .action((options) => generateToc(options));
89
103
 
90
- generate.command('graph')
104
+ generate
105
+ .command('graph')
91
106
  .option('-p, --prefix <PREFIX>', 'Prefix each decision file link with PREFIX.')
92
- .option('-e, --extension <EXTENSION>', 'the file extension of the documents to which generated links refer. Defaults to .html', '.html')
107
+ .option(
108
+ '-e, --extension <EXTENSION>',
109
+ 'the file extension of the documents to which generated links refer. Defaults to .html',
110
+ '.html'
111
+ )
93
112
  .action(async (options) => {
94
113
  await generateGraph(options);
95
114
  });
96
115
 
97
- program.command('link')
116
+ program
117
+ .command('link')
98
118
  .argument('<SOURCE>', 'Full or Partial reference number to an ADR')
99
119
  .argument('<LINK>', 'The description of the link created in the SOURCE')
100
120
  .argument('<TARGET>', 'Full or Partial reference number to an ADR')
101
121
  .argument('<REVERSE-LINK>', 'The description of the link created in the TARGET')
102
- .option('-q, --quiet', 'Do not ask for clarification. If multiple files match the search pattern, an error will be thrown.')
122
+ .option(
123
+ '-q, --quiet',
124
+ 'Do not ask for clarification. If multiple files match the search pattern, an error will be thrown.'
125
+ )
103
126
  .action(link);
104
127
 
105
- program.command('init').argument('[directory]', 'Initialize a new ADR directory').action(async (directory?: string) => {
106
- await init(directory);
107
- });
128
+ program
129
+ .command('init')
130
+ .argument('[directory]', 'Initialize a new ADR directory')
131
+ .action(async (directory?: string) => {
132
+ await init(directory);
133
+ });
108
134
 
109
135
  program.command('list').action(async () => {
110
136
  const adrs = await listAdrs();
111
- console.log(adrs.map(adr => path.relative(workingDir(), adr)).join('\n'));
137
+ console.log(adrs.map((adr) => path.relative(workingDir(), adr)).join('\n'));
112
138
  });
113
139
 
114
140
  program.parse();
115
-