From 7d86613108eda7ad2e9705739999137979ed6160 Mon Sep 17 00:00:00 2001 From: Kerem Sevencan Date: Wed, 14 Apr 2021 16:33:30 +0200 Subject: [PATCH] fix folder path --- README.md | 8 ++++---- package.json | 2 +- src/commands/init.ts | 8 +++----- src/commands/toc.ts | 7 ++----- src/config.ts | 4 +++- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 6f953e6..52f36ec 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ $ npm install -g adr-tool $ adr-tool COMMAND running command... $ adr-tool (-v|--version|version) -adr-tool/0.0.0 darwin-x64 node-v14.16.0 +adr-tool/0.0.1 darwin-x64 node-v14.16.0 $ adr-tool --help [COMMAND] USAGE $ adr-tool COMMAND @@ -51,7 +51,7 @@ EXAMPLE a decision created on ./docs/adr/0001-use-adr-tool.md ``` -_See code: [src/commands/create.ts](https://github.com/keremciu/adr-tool/blob/v0.0.0/src/commands/create.ts)_ +_See code: [src/commands/create.ts](https://github.com/keremciu/adr-tool/blob/v0.0.1/src/commands/create.ts)_ ## `adr-tool help [COMMAND]` @@ -86,7 +86,7 @@ EXAMPLE ./docs/adr folder is created! ``` -_See code: [src/commands/init.ts](https://github.com/keremciu/adr-tool/blob/v0.0.0/src/commands/init.ts)_ +_See code: [src/commands/init.ts](https://github.com/keremciu/adr-tool/blob/v0.0.1/src/commands/init.ts)_ ## `adr-tool toc` @@ -104,5 +104,5 @@ EXAMPLE ./docs/adr/README.md file is created! ``` -_See code: [src/commands/toc.ts](https://github.com/keremciu/adr-tool/blob/v0.0.0/src/commands/toc.ts)_ +_See code: [src/commands/toc.ts](https://github.com/keremciu/adr-tool/blob/v0.0.1/src/commands/toc.ts)_ diff --git a/package.json b/package.json index 8a54c62..9a67150 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "adr-tool", "description": "easy CLI for ADR docs", - "version": "0.0.1", + "version": "0.0.2", "author": "Kerem Sevencan @keremciu", "bin": { "adr-tool": "./bin/run" diff --git a/src/commands/init.ts b/src/commands/init.ts index 8f5a457..174d6c1 100644 --- a/src/commands/init.ts +++ b/src/commands/init.ts @@ -1,14 +1,12 @@ const fs = require('fs') -const path = require('path') import {Command, flags} from '@oclif/command' import {error} from '@oclif/errors' -import {adrDir, cliDir} from '../config' +import {adrDir, cliTemplatesPath} from '../config' -const cliTemplates = path.join(cliDir + '/../templates/') -const cliTemplateFile = cliTemplates + 'template.md' -const cliTOCFile = cliTemplates + 'toc.md' +const cliTemplateFile = cliTemplatesPath + 'template.md' +const cliTOCFile = cliTemplatesPath + 'toc.md' export default class Init extends Command { static description = 'create docs/adr folder and copies template.md and README.md' diff --git a/src/commands/toc.ts b/src/commands/toc.ts index be1cffe..d99d3bf 100644 --- a/src/commands/toc.ts +++ b/src/commands/toc.ts @@ -1,14 +1,11 @@ const fs = require('fs') -const path = require('path') import {Command, flags} from '@oclif/command' import {error} from '@oclif/errors' -import {adrDir, cliDir} from '../config' +import {adrDir, cliTemplatesPath} from '../config' -const cliTemplates = path.join(cliDir + '/../templates/') - -const cliTOCFile = cliTemplates + 'toc.md' +const cliTOCFile = cliTemplatesPath + 'toc.md' export default class Toc extends Command { static description = 'create docs/adr/README.md file' diff --git a/src/config.ts b/src/config.ts index 76f93ee..1d9ed0c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -3,4 +3,6 @@ const fs = require('fs') export const workDir = process.cwd() export const adrDir = workDir + '/docs/adr/' -export const cliDir = path.dirname(fs.realpathSync(__filename)) + +const cliDir = path.dirname(fs.realpathSync(__filename)) +export const cliTemplatesPath = path.join(cliDir + '/templates/')