@meza/adr-tools 1.0.10 → 1.0.11

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 +44 -0
  4. package/.github/workflows/ci.yml +19 -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 +2 -7
  8. package/CHANGELOG.md +69 -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 +99 -125
  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 +67 -72
  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
package/README.md CHANGED
@@ -1,14 +1,73 @@
1
1
  # ADR-TOOLS
2
2
 
3
- > THIS REPO IS UNDER HEAVY DEVELOPMENT. CODE YOU SEE HERE IS... NOT QUITE READY OR PRETTY (yet).
3
+ > This is a Typescript fork of Nat Pryce's [ADR-TOOLS](https://github.com/npryce/adr-tools).
4
+ >There are a few other forks out there which do some parts of the original tool but none actually do it fully.
5
+ >This does.
6
+ >More documentation to follow very soon!
4
7
 
5
- This is a Typescript fork of Nat Pryce's [ADR-TOOLS](https://github.com/npryce/adr-tools).
8
+ # Using ADRs
6
9
 
7
- There are a few other forks out there which do some parts of the original tool but none actually do it fully.
10
+ If you’re interested in reading more about what ADRs are and why they’re important, [check this article out](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions).
8
11
 
9
- This does.
12
+ ## **ADR Location Convention**
10
13
 
11
- More documentation to follow very soon!
14
+ By convention we store the decisions in **<project_root>/docs/decisions**
15
+
16
+ You can also check where the directory is by inspecting the **.adr-dir** file’s contents.
17
+
18
+ ## **ADR CLI in node land**
19
+
20
+ Managing the files and templates by hand is laborious and is not expected from anyone. We have a tool capable of handling that.
21
+
22
+ You can install it by running
23
+
24
+ ```
25
+ npm install --save-dev @meza/adr-tools
26
+ ```
27
+
28
+ This will give you the following shorthands:
29
+
30
+ ### **Creating new records**
31
+
32
+ ```
33
+ adr new A new decision the team has made
34
+ ```
35
+
36
+ This will automatically figure out the numbering sequence, get the correct filename format and use the title inside of an ADR template.
37
+
38
+ If you have an EDITOR or VISUAL environment variable set, that editor will open the newly created file.
39
+
40
+ ### **Superseding previous decisions**
41
+
42
+ We work in an agile environment where we aim to fail fast. Some of our decisions will turn out to be invalid within a new context. In those situations we would want to record a new decision to supersede our previous one.
43
+
44
+ Let’s say we had a decision “[0003-use-jest-for-testing.md](http://0003-use-jest-for-testing.md/)” but we recently learned that vitest is faster. Then we would want to record that but also update 0003 to reflect the fact that it’s no longer valid.
45
+
46
+ ```
47
+ adr new -s 3 Use vitest for testing
48
+ ```
49
+
50
+ The -s flag tells the tool to update record #3 with a link to the newly created decision.
51
+
52
+ ### **Linking decisions**
53
+
54
+ Sometimes there are situations when a new decision has another type of link to a previous record and not a supersede.
55
+
56
+ That can be expressed as follows:
57
+
58
+ ```
59
+ adr new -l "3:Amends:Amended by" use jest only for pact testing
60
+ ```
61
+
62
+ This will link the new and old issues together. The old one will get a link looking like “Amended by: Use jest only for pact testing” while the newly created ADR will have a section saying: “Amends: Use Jest For Testing”. Both with the appropriate numbering and navigational links set up.
63
+
64
+ ### **Other things**
65
+
66
+ There’s more to the tool. You can get help with
67
+
68
+ ```
69
+ adr help
70
+ ```
12
71
 
13
72
  ## Conventions
14
73
 
package/biome.json ADDED
@@ -0,0 +1,148 @@
1
+ {
2
+ "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3
+ "organizeImports": { "enabled": true },
4
+ "vcs": {
5
+ "enabled": false,
6
+ "clientKind": "git",
7
+ "useIgnoreFile": true,
8
+ "defaultBranch": "main"
9
+ },
10
+ "formatter": {
11
+ "enabled": true,
12
+ "indentStyle": "space",
13
+ "indentWidth": 2,
14
+ "lineWidth": 120,
15
+ "lineEnding": "lf",
16
+ "include": ["**/*.ts", "**/*.json"],
17
+ "ignore": [".cache/**"],
18
+ "attributePosition": "auto"
19
+ },
20
+ "files": { "include": ["**/*.ts", "**/*.json"], "ignore": ["package*.json"] },
21
+ "linter": {
22
+ "enabled": true,
23
+ "rules": {
24
+ "recommended": false,
25
+ "complexity": {
26
+ "noBannedTypes": "error",
27
+ "noExtraBooleanCast": "error",
28
+ "noMultipleSpacesInRegularExpressionLiterals": "error",
29
+ "noUselessCatch": "error",
30
+ "noUselessLoneBlockStatements": "error",
31
+ "noUselessTernary": "error",
32
+ "noUselessThisAlias": "error",
33
+ "noUselessTypeConstraint": "error",
34
+ "noVoid": "error",
35
+ "noWith": "error",
36
+ "useArrowFunction": "error",
37
+ "useLiteralKeys": "error"
38
+ },
39
+ "correctness": {
40
+ "noConstAssign": "error",
41
+ "noConstantCondition": "error",
42
+ "noEmptyCharacterClassInRegex": "error",
43
+ "noEmptyPattern": "error",
44
+ "noGlobalObjectCalls": "error",
45
+ "noInnerDeclarations": "error",
46
+ "noInvalidConstructorSuper": "error",
47
+ "noInvalidUseBeforeDeclaration": "error",
48
+ "noNewSymbol": "error",
49
+ "noNonoctalDecimalEscape": "error",
50
+ "noPrecisionLoss": "error",
51
+ "noSelfAssign": "error",
52
+ "noSetterReturn": "error",
53
+ "noSwitchDeclarations": "error",
54
+ "noUndeclaredVariables": "error",
55
+ "noUnreachable": "error",
56
+ "noUnreachableSuper": "error",
57
+ "noUnsafeFinally": "error",
58
+ "noUnsafeOptionalChaining": "error",
59
+ "noUnusedLabels": "error",
60
+ "noUnusedVariables": "error",
61
+ "useArrayLiterals": "off",
62
+ "useIsNan": "error",
63
+ "useValidForDirection": "error",
64
+ "useYield": "error"
65
+ },
66
+ "security": { "noGlobalEval": "error" },
67
+ "style": {
68
+ "noCommaOperator": "error",
69
+ "noNamespace": "off",
70
+ "noParameterAssign": "error",
71
+ "noUselessElse": "error",
72
+ "noVar": "off",
73
+ "useAsConstAssertion": "error",
74
+ "useBlockStatements": "error",
75
+ "useCollapsedElseIf": "error",
76
+ "useConst": "error",
77
+ "useShorthandAssign": "error",
78
+ "useSingleVarDeclarator": "off"
79
+ },
80
+ "suspicious": {
81
+ "noAssignInExpressions": "error",
82
+ "noAsyncPromiseExecutor": "error",
83
+ "noCatchAssign": "error",
84
+ "noClassAssign": "error",
85
+ "noCompareNegZero": "error",
86
+ "noConfusingLabels": "error",
87
+ "noConsoleLog": "off",
88
+ "noControlCharactersInRegex": "error",
89
+ "noDebugger": "error",
90
+ "noDoubleEquals": "error",
91
+ "noDuplicateCase": "error",
92
+ "noDuplicateClassMembers": "error",
93
+ "noDuplicateObjectKeys": "error",
94
+ "noDuplicateParameters": "error",
95
+ "noEmptyBlockStatements": "error",
96
+ "noExplicitAny": "error",
97
+ "noExtraNonNullAssertion": "error",
98
+ "noFallthroughSwitchClause": "error",
99
+ "noFunctionAssign": "error",
100
+ "noGlobalAssign": "error",
101
+ "noImportAssign": "error",
102
+ "noLabelVar": "error",
103
+ "noMisleadingCharacterClass": "error",
104
+ "noMisleadingInstantiator": "error",
105
+ "noPrototypeBuiltins": "error",
106
+ "noRedeclare": "error",
107
+ "noSelfCompare": "error",
108
+ "noShadowRestrictedNames": "error",
109
+ "noUnsafeDeclarationMerging": "error",
110
+ "noUnsafeNegation": "error",
111
+ "useGetterReturn": "error",
112
+ "useValidTypeof": "error"
113
+ }
114
+ },
115
+ "ignore": ["**/node_modules", "**/dist", "lib/murmurhash3.ts"]
116
+ },
117
+ "json": {
118
+ "formatter": {
119
+ "trailingCommas": "none",
120
+ "enabled": true
121
+ }
122
+ },
123
+ "javascript": {
124
+ "formatter": {
125
+ "quoteStyle": "single",
126
+ "enabled": true,
127
+ "semicolons": "always",
128
+ "quoteProperties": "asNeeded",
129
+ "trailingCommas": "none",
130
+ "bracketSpacing": true,
131
+ "bracketSameLine": true,
132
+ "attributePosition": "auto"
133
+ },
134
+ "globals": []
135
+ },
136
+ "overrides": [
137
+ {
138
+ "include": ["**/*.test.ts", "test/**/*.ts"],
139
+ "linter": {
140
+ "rules": {
141
+ "correctness": { "noInvalidUseBeforeDeclaration": "off" },
142
+ "style": { "noNonNullAssertion": "off" },
143
+ "suspicious": { "noEmptyBlockStatements": "off", "noExplicitAny": "off" }
144
+ }
145
+ }
146
+ }
147
+ ]
148
+ }
package/dist/index.js CHANGED
@@ -1,50 +1,13 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || function (mod) {
20
- if (mod && mod.__esModule) return mod;
21
- var result = {};
22
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
23
- __setModuleDefault(result, mod);
24
- return result;
25
- };
26
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
28
- return new (P || (P = Promise))(function (resolve, reject) {
29
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
30
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
31
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
32
- step((generator = generator.apply(thisArg, _arguments || [])).next());
33
- });
34
- };
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const commander_1 = require("commander");
40
- const version_1 = require("./version");
41
- const adr_1 = require("./lib/adr");
42
- const chalk_1 = __importDefault(require("chalk"));
43
- const config_1 = require("./lib/config");
44
- const path = __importStar(require("path"));
45
- const manipulator_1 = require("./lib/manipulator");
46
- const promises_1 = __importDefault(require("fs/promises"));
47
- const program = new commander_1.Command();
2
+ import * as path from 'path';
3
+ import chalk from 'chalk';
4
+ import { Command } from 'commander';
5
+ import fs from 'fs/promises';
6
+ import { generateToc, init, link, listAdrs, newAdr } from './lib/adr.js';
7
+ import { workingDir } from './lib/config.js';
8
+ import { getLinksFrom, getTitleFrom } from './lib/manipulator.js';
9
+ import { LIB_VERSION } from './version.js';
10
+ const program = new Command();
48
11
  const collectLinks = (val, memo) => {
49
12
  memo.push(val);
50
13
  return memo;
@@ -53,17 +16,17 @@ const collectSupersedes = (val, memo) => {
53
16
  memo.push(val);
54
17
  return memo;
55
18
  };
56
- const generateGraph = (options) => __awaiter(void 0, void 0, void 0, function* () {
19
+ const generateGraph = async (options) => {
57
20
  let text = 'digraph {\n';
58
21
  text += ' node [shape=plaintext];\n';
59
22
  text += ' subgraph {\n';
60
- const adrs = yield (0, adr_1.listAdrs)();
23
+ const adrs = await listAdrs();
61
24
  for (let i = 0; i < adrs.length; i++) {
62
25
  const n = i + 1;
63
26
  const adrPath = adrs[i];
64
- const contents = yield promises_1.default.readFile(adrPath, 'utf8');
65
- const title = (0, manipulator_1.getTitleFrom)(contents);
66
- text += ` _${n} [label="${title}"; URL="${(options === null || options === void 0 ? void 0 : options.prefix) || ''}${path.basename(adrPath, '.md')}${options === null || options === void 0 ? void 0 : options.extension}"];\n`;
27
+ const contents = await fs.readFile(adrPath, 'utf8');
28
+ const title = getTitleFrom(contents);
29
+ text += ` _${n} [label="${title}"; URL="${options?.prefix || ''}${path.basename(adrPath, '.md')}${options?.extension}"];\n`;
67
30
  if (n > 1) {
68
31
  text += ` _${n - 1} -> _${n} [style="dotted", weight=1];\n`;
69
32
  }
@@ -72,8 +35,8 @@ const generateGraph = (options) => __awaiter(void 0, void 0, void 0, function* (
72
35
  for (let i = 0; i < adrs.length; i++) {
73
36
  const n = i + 1;
74
37
  const adrPath = adrs[i];
75
- const contents = yield promises_1.default.readFile(adrPath, 'utf8');
76
- const linksInADR = (0, manipulator_1.getLinksFrom)(contents);
38
+ const contents = await fs.readFile(adrPath, 'utf8');
39
+ const linksInADR = getLinksFrom(contents);
77
40
  for (let j = 0; j < linksInADR.length; j++) {
78
41
  if (!linksInADR[j].label.endsWith('by')) {
79
42
  text += ` _${n} -> _${linksInADR[j].targetNumber} [label="${linksInADR[j].label}", weight=0]\n`;
@@ -82,21 +45,22 @@ const generateGraph = (options) => __awaiter(void 0, void 0, void 0, function* (
82
45
  }
83
46
  text += '}\n';
84
47
  console.log(text);
85
- });
86
- program.name('adr').version(version_1.LIB_VERSION).description('Manage Architecture Decision Logs');
87
- program.command('new')
48
+ };
49
+ program.name('adr').version(LIB_VERSION).description('Manage Architecture Decision Logs');
50
+ program
51
+ .command('new')
88
52
  .argument('<title...>', 'The title of the decision')
89
53
  .option('-q, --quiet', 'Do not ask for clarification. If multiple files match the search pattern, an error will be thrown.')
90
- .option('-s, --supersede <SUPERSEDE>', 'A reference (number or partial filename) of a previous decision that the new decision supercedes.\n'
91
- + 'A Markdown link to the superceded ADR is inserted into the Status section.\n'
92
- + 'The status of the superceded ADR is changed to record that it has been superceded by the new ADR.', collectSupersedes, [])
93
- .option('-l, --link "<TARGET:LINK:REVERSE-LINK>"', 'Links the new ADR to a previous ADR.\n'
94
- + `${chalk_1.default.bold('TARGET')} is a reference (number or partial filename) of a previous decision.\n`
95
- + `${chalk_1.default.bold('LINK')} is the description of the link created in the new ADR.\n`
96
- + `${chalk_1.default.bold('REVERSE-LINK')} is the description of the link created in the existing ADR that will refer to the new ADR`, collectLinks, [])
97
- .action((title, options) => __awaiter(void 0, void 0, void 0, function* () {
54
+ .option('-s, --supersede <SUPERSEDE>', 'A reference (number or partial filename) of a previous decision that the new decision supercedes.\n' +
55
+ 'A Markdown link to the superceded ADR is inserted into the Status section.\n' +
56
+ 'The status of the superceded ADR is changed to record that it has been superceded by the new ADR.', collectSupersedes, [])
57
+ .option('-l, --link "<TARGET:LINK:REVERSE-LINK>"', 'Links the new ADR to a previous ADR.\n' +
58
+ `${chalk.bold('TARGET')} is a reference (number or partial filename) of a previous decision.\n` +
59
+ `${chalk.bold('LINK')} is the description of the link created in the new ADR.\n` +
60
+ `${chalk.bold('REVERSE-LINK')} is the description of the link created in the existing ADR that will refer to the new ADR`, collectLinks, [])
61
+ .action(async (title, options) => {
98
62
  try {
99
- yield (0, adr_1.newAdr)(title.join(' '), {
63
+ await newAdr(title.join(' '), {
100
64
  supersedes: options.supersede,
101
65
  date: process.env.ADR_DATE,
102
66
  suppressPrompts: options.quiet || false,
@@ -104,32 +68,38 @@ program.command('new')
104
68
  });
105
69
  }
106
70
  catch (e) {
107
- program.error(chalk_1.default.red(e.message), { exitCode: 1 });
71
+ program.error(chalk.red(e.message), { exitCode: 1 });
108
72
  }
109
- }));
73
+ });
110
74
  const generate = program.command('generate');
111
- generate.command('toc')
75
+ generate
76
+ .command('toc')
112
77
  .option('-p, --prefix <PREFIX>', 'The prefix to use for each file link in the generated TOC.')
113
- .action((options) => (0, adr_1.generateToc)(options));
114
- generate.command('graph')
78
+ .action((options) => generateToc(options));
79
+ generate
80
+ .command('graph')
115
81
  .option('-p, --prefix <PREFIX>', 'Prefix each decision file link with PREFIX.')
116
82
  .option('-e, --extension <EXTENSION>', 'the file extension of the documents to which generated links refer. Defaults to .html', '.html')
117
- .action((options) => __awaiter(void 0, void 0, void 0, function* () {
118
- yield generateGraph(options);
119
- }));
120
- program.command('link')
83
+ .action(async (options) => {
84
+ await generateGraph(options);
85
+ });
86
+ program
87
+ .command('link')
121
88
  .argument('<SOURCE>', 'Full or Partial reference number to an ADR')
122
89
  .argument('<LINK>', 'The description of the link created in the SOURCE')
123
90
  .argument('<TARGET>', 'Full or Partial reference number to an ADR')
124
91
  .argument('<REVERSE-LINK>', 'The description of the link created in the TARGET')
125
92
  .option('-q, --quiet', 'Do not ask for clarification. If multiple files match the search pattern, an error will be thrown.')
126
- .action(adr_1.link);
127
- program.command('init').argument('[directory]', 'Initialize a new ADR directory').action((directory) => __awaiter(void 0, void 0, void 0, function* () {
128
- yield (0, adr_1.init)(directory);
129
- }));
130
- program.command('list').action(() => __awaiter(void 0, void 0, void 0, function* () {
131
- const adrs = yield (0, adr_1.listAdrs)();
132
- console.log(adrs.map(adr => path.relative((0, config_1.workingDir)(), adr)).join('\n'));
133
- }));
93
+ .action(link);
94
+ program
95
+ .command('init')
96
+ .argument('[directory]', 'Initialize a new ADR directory')
97
+ .action(async (directory) => {
98
+ await init(directory);
99
+ });
100
+ program.command('list').action(async () => {
101
+ const adrs = await listAdrs();
102
+ console.log(adrs.map((adr) => path.relative(workingDir(), adr)).join('\n'));
103
+ });
134
104
  program.parse();
135
105
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"src/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,yCAAoC;AACpC,uCAAwC;AACxC,mCAAsE;AACtE,kDAA0B;AAC1B,yCAA0C;AAC1C,2CAA6B;AAC7B,mDAA+D;AAC/D,2DAA6B;AAE7B,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,IAAc,EAAE,EAAE;IACnD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,IAAc,EAAE,EAAE;IACxD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CA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