Skip to content

Commit

Permalink
use cwd() so passed in paths are relative to where the command was ca…
Browse files Browse the repository at this point in the history
…lled
  • Loading branch information
gitsome committed Sep 11, 2019
1 parent cc075fd commit 37edad3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,32 +18,32 @@ const commandLineArgs = yargs
.help('help')
.argv

const jsonSchemaSourceDirectory = path.resolve(__dirname, commandLineArgs.source);
const jsonSchemaSourceDirectory = path.resolve(process.cwd(), commandLineArgs.source);

let interfaceTarget;
if (commandLineArgs.i) {
interfaceTarget = path.resolve(__dirname, commandLineArgs.source);
interfaceTarget = path.resolve(process.cwd(), commandLineArgs.source);
} else {
interfaceTarget = path.join(jsonSchemaSourceDirectory, '..', 'json-schema-interfaces');
}

let validatorTarget;
if (commandLineArgs.v) {
validatorTarget = path.resolve(__dirname, commandLineArgs.source);
validatorTarget = path.resolve(process.cwd(), commandLineArgs.source);
} else {
validatorTarget = path.join(jsonSchemaSourceDirectory, '..', 'json-schema-validators');
}

let patterns = {};
if (commandLineArgs.patterns) {
patterns = require(path.resolve(__dirname, commandLineArgs.patterns));
patterns = require(path.resolve(process.cwd(), commandLineArgs.patterns));
}

const SOURCE_JSON_SCHEMA_DIR = jsonSchemaSourceDirectory;
const TARGET_TYPESCRIPT_INTERFACE_DIR = interfaceTarget;
const TARGET_VALIDATORS_DIR = validatorTarget;

const TEMPORARY_DIR = path.resolve(__dirname, './json-schema-transformation-tmp');
const TEMPORARY_DIR = path.resolve(process.cwd(), './json-schema-transformation-tmp');
const TEMPORARY_SCHEMA_DIR = path.join(TEMPORARY_DIR, 'schema');

console.log("JSON SCHEMA LOCATION:", SOURCE_JSON_SCHEMA_DIR);
Expand Down

0 comments on commit 37edad3

Please sign in to comment.