vovk-cli 0.0.1-draft.16 → 0.0.1-draft.18

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.
@@ -1,4 +1,4 @@
1
- export default function newModule({ what, moduleNameWithOptionalSegment, dryRun, dir: dirNameFlag, templates: templatesFlag, noSegmentUpdate, overwrite, }: {
1
+ export default function newModule({ what, moduleNameWithOptionalSegment, dryRun, dir: dirFlag, templates: templatesFlag, noSegmentUpdate, overwrite, }: {
2
2
  what: string[];
3
3
  moduleNameWithOptionalSegment: string;
4
4
  dryRun?: boolean;
@@ -18,7 +18,7 @@ function splitByLast(str, delimiter = '/') {
18
18
  const after = str.substring(index + delimiter.length);
19
19
  return [before, after];
20
20
  }
21
- export default async function newModule({ what, moduleNameWithOptionalSegment, dryRun, dir: dirNameFlag, templates: templatesFlag, noSegmentUpdate, overwrite, }) {
21
+ export default async function newModule({ what, moduleNameWithOptionalSegment, dryRun, dir: dirFlag, templates: templatesFlag, noSegmentUpdate, overwrite, }) {
22
22
  const { config, log, apiDir, cwd } = await getProjectInfo();
23
23
  let templates = config.templates;
24
24
  const [segmentName, moduleName] = splitByLast(moduleNameWithOptionalSegment);
@@ -60,21 +60,21 @@ export default async function newModule({ what, moduleNameWithOptionalSegment, d
60
60
  ? path.resolve(cwd, templatePath)
61
61
  : path.resolve(cwd, './node_modules', templatePath);
62
62
  const templateCode = await fs.readFile(templateAbsolutePath, 'utf-8');
63
- const { dir: renderedDirName, fileName, sourceName, compiledName, code, } = await render(templateCode, {
63
+ const { dir: renderedDir, fileName, sourceName, compiledName, code, } = await render(templateCode, {
64
64
  cwd,
65
65
  config,
66
66
  withService: what.includes('service'),
67
67
  segmentName,
68
68
  moduleName,
69
69
  });
70
- const dirName = dirNameFlag || renderedDirName;
71
- if (!dirName) {
72
- throw new Error(`The template for "${type}" does not provide a dirName`);
70
+ const dir = dirFlag || renderedDir;
71
+ if (!dir) {
72
+ throw new Error(`The template for "${type}" does not provide a dir`);
73
73
  }
74
74
  if (!fileName) {
75
75
  throw new Error(`The template for "${type}" does not provide a fileName`);
76
76
  }
77
- const absoluteModuleDir = path.join(cwd, dirName);
77
+ const absoluteModuleDir = path.join(cwd, dir);
78
78
  const absoluteModulePath = path.join(absoluteModuleDir, fileName);
79
79
  const prettiedCode = await prettify(code, absoluteModulePath);
80
80
  if (!dryRun) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.16",
3
+ "version": "0.0.1-draft.18",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },