@vnodes/cli 0.1.11 → 0.1.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.
package/dist/cli/cli.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import { program } from 'commander';
2
+ import { bye } from './bye/bye.js';
2
3
  import { hello } from './hello/hello.js';
3
- import { wd } from './wd/wd.js';
4
- import { suffix } from './suffix/suffix.js';
5
4
  import { rm } from './rm/rm.js';
6
- import { bye } from './bye/bye.js';
5
+ import { suffix } from './suffix/suffix.js';
6
+ import { wd } from './wd/wd.js';
7
+ import { workspaceVersion } from './workspace-version/workspace-version.js';
7
8
  import { workspace } from './workspace/workspace.js';
8
9
  program.name('Vnodes cli').description('Tools and generators').version('0.1.0').showHelpAfterError(true);
9
10
  [
11
+ workspaceVersion,
10
12
  hello,
11
13
  bye,
12
14
  wd,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { program } from 'commander';\nimport { hello } from './hello/hello.js';\nimport { wd } from './wd/wd.js';\nimport { suffix } from './suffix/suffix.js';\nimport { rm } from './rm/rm.js';\nimport { bye } from './bye/bye.js';\nimport { workspace } from './workspace/workspace.js';\n\nprogram.name('Vnodes cli').description('Tools and generators').version('0.1.0').showHelpAfterError(true);\n\n[hello, bye, wd, suffix, rm, workspace].map((c) => c(program));\n\nprogram.parse();\n"],"names":["program","hello","wd","suffix","rm","bye","workspace","name","description","version","showHelpAfterError","map","c","parse"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,EAAE,QAAQ,aAAa;AAChC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,aAAa;AAChC,SAASC,GAAG,QAAQ,eAAe;AACnC,SAASC,SAAS,QAAQ,2BAA2B;AAErDN,QAAQO,IAAI,CAAC,cAAcC,WAAW,CAAC,wBAAwBC,OAAO,CAAC,SAASC,kBAAkB,CAAC;AAEnG;IAACT;IAAOI;IAAKH;IAAIC;IAAQC;IAAIE;CAAU,CAACK,GAAG,CAAC,CAACC,IAAMA,EAAEZ;AAErDA,QAAQa,KAAK"}
1
+ {"version":3,"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { program } from 'commander';\nimport { bye } from './bye/bye.js';\nimport { hello } from './hello/hello.js';\nimport { rm } from './rm/rm.js';\nimport { suffix } from './suffix/suffix.js';\nimport { wd } from './wd/wd.js';\nimport { workspaceVersion } from './workspace-version/workspace-version.js';\nimport { workspace } from './workspace/workspace.js';\n\nprogram\n .name('Vnodes cli')\n .description('Tools and generators')\n .version('0.1.0')\n .showHelpAfterError(true);\n\n[workspaceVersion, hello, bye, wd, suffix, rm, workspace].map((c) => c(program));\n\nprogram.parse();\n"],"names":["program","bye","hello","rm","suffix","wd","workspaceVersion","workspace","name","description","version","showHelpAfterError","map","c","parse"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,GAAG,QAAQ,eAAe;AACnC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,EAAE,QAAQ,aAAa;AAChC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,aAAa;AAChC,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,SAAS,QAAQ,2BAA2B;AAErDP,QACGQ,IAAI,CAAC,cACLC,WAAW,CAAC,wBACZC,OAAO,CAAC,SACRC,kBAAkB,CAAC;AAEtB;IAACL;IAAkBJ;IAAOD;IAAKI;IAAID;IAAQD;IAAII;CAAU,CAACK,GAAG,CAAC,CAACC,IAAMA,EAAEb;AAEvEA,QAAQc,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"suffix.d.ts","sourceRoot":"","sources":["../../../src/cli/suffix/suffix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,QAwBtC"}
1
+ {"version":3,"file":"suffix.d.ts","sourceRoot":"","sources":["../../../src/cli/suffix/suffix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAKzC;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,QA4BtC"}
@@ -1,6 +1,6 @@
1
- import { renameSync } from 'node:fs';
2
- import { readdir } from 'node:fs/promises';
1
+ import { readdir, rename } from 'node:fs/promises';
3
2
  import { join } from 'node:path';
3
+ import { cwd } from 'node:process';
4
4
  /**
5
5
  * Suffix file/files recursive (optional)
6
6
  *
@@ -14,18 +14,18 @@ import { join } from 'node:path';
14
14
  * ````
15
15
  * @param command main command instance
16
16
  */ export function suffix(command) {
17
- command.command('suffix').option('-u, --undo', 'Remove the suffix from file names').option('-r, --recursive', 'Apply suffix to all files under sub directories').requiredOption('-s, --suffix <string>', 'Suffix to append to the file names').action(async ({ suffix, recursive, undo })=>{
18
- const foundDirs = await readdir('./', {
17
+ command.command('suffix').option('-u, --undo', 'Remove the suffix from file names').option('-r, --recursive', 'Apply suffix to all files under sub directories').option('-p, --parallel <>', 'How many concurrent operations', '4').requiredOption('-s, --suffix <string>', 'Suffix to append to the file names').action(async ({ suffix, parallel, recursive, undo })=>{
18
+ const PARALLEL = Number(parallel) || 4;
19
+ const foundDirs = await readdir(cwd(), {
19
20
  recursive: !!recursive,
20
21
  withFileTypes: true
21
22
  });
22
23
  const absolutePaths = foundDirs.filter((e)=>e.isFile()).map((e)=>join(e.parentPath, e.name));
23
- const createNewFilepath = (filePath)=>{
24
- return undo ? filePath.replace(new RegExp(`${suffix}$`), '') : `${filePath}${suffix}`;
24
+ const newFilepath = (filePath)=>{
25
+ return undo ? filePath.slice(0, -suffix.length) : `${filePath}${suffix}`;
25
26
  };
26
- for (const filePath of absolutePaths){
27
- renameSync(filePath, createNewFilepath(filePath));
28
- }
27
+ const asyncOperations = absolutePaths.map((filePath)=>()=>rename(filePath, newFilepath(filePath)));
28
+ await parallel(asyncOperations, PARALLEL);
29
29
  });
30
30
  }
31
31
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/suffix/suffix.ts"],"sourcesContent":["import { type Command } from 'commander';\nimport { renameSync } from 'node:fs';\nimport { readdir } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Suffix file/files recursive (optional)\n *\n * ### Example\n * ````sh\n * # Add .template suffix\n * vnodes suffix --s .template -r\n *\n * # Remove the .template suffix\n * vnodes suffix --s .template -r -u\n * ````\n * @param command main command instance\n */\nexport function suffix(command: Command) {\n command\n .command('suffix')\n .option('-u, --undo', 'Remove the suffix from file names')\n .option('-r, --recursive', 'Apply suffix to all files under sub directories')\n .requiredOption('-s, --suffix <string>', 'Suffix to append to the file names')\n .action(async ({ suffix, recursive, undo }) => {\n const foundDirs = await readdir('./', {\n recursive: !!recursive,\n withFileTypes: true,\n });\n\n const absolutePaths = foundDirs\n .filter((e) => e.isFile())\n .map((e) => join(e.parentPath, e.name));\n\n const createNewFilepath = (filePath: string) => {\n return undo ? filePath.replace(new RegExp(`${suffix}$`), '') : `${filePath}${suffix}`;\n };\n\n for (const filePath of absolutePaths) {\n renameSync(filePath, createNewFilepath(filePath));\n }\n });\n}\n"],"names":["renameSync","readdir","join","suffix","command","option","requiredOption","action","recursive","undo","foundDirs","withFileTypes","absolutePaths","filter","e","isFile","map","parentPath","name","createNewFilepath","filePath","replace","RegExp"],"mappings":"AACA,SAASA,UAAU,QAAQ,UAAU;AACrC,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SAASC,IAAI,QAAQ,YAAY;AAEjC;;;;;;;;;;;;CAYC,GACD,OAAO,SAASC,OAAOC,OAAgB;IACrCA,QACGA,OAAO,CAAC,UACRC,MAAM,CAAC,cAAc,qCACrBA,MAAM,CAAC,mBAAmB,mDAC1BC,cAAc,CAAC,yBAAyB,sCACxCC,MAAM,CAAC,OAAO,EAAEJ,MAAM,EAAEK,SAAS,EAAEC,IAAI,EAAE;QACxC,MAAMC,YAAY,MAAMT,QAAQ,MAAM;YACpCO,WAAW,CAAC,CAACA;YACbG,eAAe;QACjB;QAEA,MAAMC,gBAAgBF,UACnBG,MAAM,CAAC,CAACC,IAAMA,EAAEC,MAAM,IACtBC,GAAG,CAAC,CAACF,IAAMZ,KAAKY,EAAEG,UAAU,EAAEH,EAAEI,IAAI;QAEvC,MAAMC,oBAAoB,CAACC;YACzB,OAAOX,OAAOW,SAASC,OAAO,CAAC,IAAIC,OAAO,GAAGnB,OAAO,CAAC,CAAC,GAAG,MAAM,GAAGiB,WAAWjB,QAAQ;QACvF;QAEA,KAAK,MAAMiB,YAAYR,cAAe;YACpCZ,WAAWoB,UAAUD,kBAAkBC;QACzC;IACF;AACJ"}
1
+ {"version":3,"sources":["../../../src/cli/suffix/suffix.ts"],"sourcesContent":["import { type Command } from 'commander';\nimport { readdir, rename } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { cwd } from 'node:process';\n\n/**\n * Suffix file/files recursive (optional)\n *\n * ### Example\n * ````sh\n * # Add .template suffix\n * vnodes suffix --s .template -r\n *\n * # Remove the .template suffix\n * vnodes suffix --s .template -r -u\n * ````\n * @param command main command instance\n */\nexport function suffix(command: Command) {\n command\n .command('suffix')\n .option('-u, --undo', 'Remove the suffix from file names')\n .option('-r, --recursive', 'Apply suffix to all files under sub directories')\n .option('-p, --parallel <>', 'How many concurrent operations', '4')\n .requiredOption('-s, --suffix <string>', 'Suffix to append to the file names')\n .action(async ({ suffix, parallel, recursive, undo }) => {\n const PARALLEL = Number(parallel) || 4;\n const foundDirs = await readdir(cwd(), {\n recursive: !!recursive,\n withFileTypes: true,\n });\n\n const absolutePaths = foundDirs\n .filter((e) => e.isFile())\n .map((e) => join(e.parentPath, e.name));\n\n const newFilepath = (filePath: string) => {\n return undo ? filePath.slice(0, -suffix.length) : `${filePath}${suffix}`;\n };\n\n const asyncOperations = absolutePaths.map(\n (filePath) => () => rename(filePath, newFilepath(filePath)),\n );\n\n await parallel(asyncOperations, PARALLEL);\n });\n}\n"],"names":["readdir","rename","join","cwd","suffix","command","option","requiredOption","action","parallel","recursive","undo","PARALLEL","Number","foundDirs","withFileTypes","absolutePaths","filter","e","isFile","map","parentPath","name","newFilepath","filePath","slice","length","asyncOperations"],"mappings":"AACA,SAASA,OAAO,EAAEC,MAAM,QAAQ,mBAAmB;AACnD,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,GAAG,QAAQ,eAAe;AAEnC;;;;;;;;;;;;CAYC,GACD,OAAO,SAASC,OAAOC,OAAgB;IACrCA,QACGA,OAAO,CAAC,UACRC,MAAM,CAAC,cAAc,qCACrBA,MAAM,CAAC,mBAAmB,mDAC1BA,MAAM,CAAC,qBAAqB,kCAAkC,KAC9DC,cAAc,CAAC,yBAAyB,sCACxCC,MAAM,CAAC,OAAO,EAAEJ,MAAM,EAAEK,QAAQ,EAAEC,SAAS,EAAEC,IAAI,EAAE;QAClD,MAAMC,WAAWC,OAAOJ,aAAa;QACrC,MAAMK,YAAY,MAAMd,QAAQG,OAAO;YACrCO,WAAW,CAAC,CAACA;YACbK,eAAe;QACjB;QAEA,MAAMC,gBAAgBF,UACnBG,MAAM,CAAC,CAACC,IAAMA,EAAEC,MAAM,IACtBC,GAAG,CAAC,CAACF,IAAMhB,KAAKgB,EAAEG,UAAU,EAAEH,EAAEI,IAAI;QAEvC,MAAMC,cAAc,CAACC;YACnB,OAAOb,OAAOa,SAASC,KAAK,CAAC,GAAG,CAACrB,OAAOsB,MAAM,IAAI,GAAGF,WAAWpB,QAAQ;QAC1E;QAEA,MAAMuB,kBAAkBX,cAAcI,GAAG,CACvC,CAACI,WAAa,IAAMvB,OAAOuB,UAAUD,YAAYC;QAGnD,MAAMf,SAASkB,iBAAiBf;IAClC;AACJ"}
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "singleQuote": true,
3
- "printWidth": 140
3
+ "printWidth": 120
4
4
  }
@@ -11,8 +11,9 @@
11
11
  "_dirname": {
12
12
  "prefix": "_dirname",
13
13
  "body": [
14
- "import { dirname, join } from \"path\"",
15
- "const __dirname = dirname(fileURLToPath(import.meta.url));",
14
+ "import { dirname, join } from 'path'",
15
+ "import { fileURLToPath } from 'url';",
16
+ "const __dirname = dirname(fileURLToPath(import.meta.url));"
16
17
  ],
17
18
  "scope": "typescript"
18
19
  }
@@ -47,7 +47,7 @@
47
47
  "homePageUrl": "https://<%- fileName %>.github.io",
48
48
  "fundingUrl": "https://cash.app/$puqlib",
49
49
  "version": "0.0.1",
50
- "workspaceVersion": "workspace:*"
50
+ "workspaceVersion": "<%- workspaceVersion %>"
51
51
  },
52
52
  "@nx/plugin:plugin": {
53
53
  "compiler": "swc",
@@ -35,8 +35,8 @@
35
35
  "@swc/helpers": "~0.5.18",
36
36
  "@types/node": "20.19.9",
37
37
  "@vitest/coverage-v8": "~4.1.0",
38
- "@vnodes/cli": "0.1.20",
39
- "@vnodes/fs": "0.1.20",
38
+ "@vnodes/cli": "<%- workspaceVersion %>",
39
+ "@vnodes/fs": "<%- workspaceVersion %>",
40
40
  "chokidar": "^5.0.0",
41
41
  "dotenv": "^17.4.2",
42
42
  "esbuild": "^0.27.0",
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/cli/workspace/workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AA0CzC;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,QASzC"}
1
+ {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/cli/workspace/workspace.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAgDzC;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,QASzC"}
@@ -4,6 +4,7 @@ import ejs from 'ejs';
4
4
  import { mkdir } from 'node:fs/promises';
5
5
  import { dirname, join, relative } from 'node:path';
6
6
  import { fileURLToPath } from 'node:url';
7
+ import { getWorkspaceVersion } from '../../utils/get-workspace-version.js';
7
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
8
9
  async function geneateFiles(name) {
9
10
  const removeTemplateSuffix = (filePath)=>{
@@ -24,9 +25,11 @@ async function generateTemplates(name) {
24
25
  await mkdir(dirname(targetFilePath), {
25
26
  recursive: true
26
27
  });
28
+ const workspaceVersion = await getWorkspaceVersion();
27
29
  const renderedContent = ejs.render(templateFileContent, {
28
30
  ...names(name),
29
- email: `${name}@${name}.com`
31
+ email: `${name}@${name}.com`,
32
+ workspaceVersion
30
33
  });
31
34
  await writeTextFile(targetFilePath, renderedContent);
32
35
  console.log(`[ Created ] ${relativeTemplateFilePath} `);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/workspace/workspace.ts"],"sourcesContent":["import { names } from '@nx/devkit';\nimport { copyFilesGenerator, filesGenerator, readTextFile, writeTextFile } from '@vnodes/fs';\nimport { type Command } from 'commander';\nimport ejs from 'ejs';\nimport { mkdir } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nasync function geneateFiles(name: string) {\n const removeTemplateSuffix = (filePath: string) => {\n return filePath.slice(0, -'.template'.length);\n };\n const copyFilesGeneartor = copyFilesGenerator(\n join(__dirname, 'files'),\n join(name),\n removeTemplateSuffix,\n );\n\n for await (const entry of copyFilesGeneartor) {\n console.log(`[ Created ] ${entry}`);\n }\n}\n\nasync function generateTemplates(name: string) {\n const templateRootDir = join(__dirname, 'templates');\n const templateFiles = filesGenerator(templateRootDir);\n\n for await (const filePath of templateFiles) {\n const templateFileContent = await readTextFile(filePath);\n const relativeTemplateFilePath = relative(templateRootDir, filePath).slice(0, -'.ejs'.length);\n\n const targetFilePath = join(name, relativeTemplateFilePath);\n await mkdir(dirname(targetFilePath), { recursive: true });\n const renderedContent = ejs.render(templateFileContent, {\n ...names(name),\n email: `${name}@${name}.com`,\n });\n await writeTextFile(targetFilePath, renderedContent);\n console.log(`[ Created ] ${relativeTemplateFilePath} `);\n }\n}\n\n/**\n * Generate nx workspace\n *\n * ### Example\n * ````sh\n * vnodes workspace --name WorkSpaceName\n * ````\n * @param command main command instance\n */\nexport function workspace(command: Command) {\n command\n .command('workspace')\n .description('Generate a nx workspace')\n .requiredOption('-n, --name <string>', 'Project name')\n .action(async ({ name }) => {\n await geneateFiles(name);\n await generateTemplates(name);\n });\n}\n"],"names":["names","copyFilesGenerator","filesGenerator","readTextFile","writeTextFile","ejs","mkdir","dirname","join","relative","fileURLToPath","__dirname","url","geneateFiles","name","removeTemplateSuffix","filePath","slice","length","copyFilesGeneartor","entry","console","log","generateTemplates","templateRootDir","templateFiles","templateFileContent","relativeTemplateFilePath","targetFilePath","recursive","renderedContent","render","email","workspace","command","description","requiredOption","action"],"mappings":"AAAA,SAASA,KAAK,QAAQ,aAAa;AACnC,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,YAAY,EAAEC,aAAa,QAAQ,aAAa;AAE7F,OAAOC,SAAS,MAAM;AACtB,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,YAAY;AACpD,SAASC,aAAa,QAAQ,WAAW;AAEzC,MAAMC,YAAYJ,QAAQG,cAAc,YAAYE,GAAG;AAEvD,eAAeC,aAAaC,IAAY;IACtC,MAAMC,uBAAuB,CAACC;QAC5B,OAAOA,SAASC,KAAK,CAAC,GAAG,CAAC,YAAYC,MAAM;IAC9C;IACA,MAAMC,qBAAqBlB,mBACzBO,KAAKG,WAAW,UAChBH,KAAKM,OACLC;IAGF,WAAW,MAAMK,SAASD,mBAAoB;QAC5CE,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAEF,OAAO;IACpC;AACF;AAEA,eAAeG,kBAAkBT,IAAY;IAC3C,MAAMU,kBAAkBhB,KAAKG,WAAW;IACxC,MAAMc,gBAAgBvB,eAAesB;IAErC,WAAW,MAAMR,YAAYS,cAAe;QAC1C,MAAMC,sBAAsB,MAAMvB,aAAaa;QAC/C,MAAMW,2BAA2BlB,SAASe,iBAAiBR,UAAUC,KAAK,CAAC,GAAG,CAAC,OAAOC,MAAM;QAE5F,MAAMU,iBAAiBpB,KAAKM,MAAMa;QAClC,MAAMrB,MAAMC,QAAQqB,iBAAiB;YAAEC,WAAW;QAAK;QACvD,MAAMC,kBAAkBzB,IAAI0B,MAAM,CAACL,qBAAqB;YACtD,GAAG1B,MAAMc,KAAK;YACdkB,OAAO,GAAGlB,KAAK,CAAC,EAAEA,KAAK,IAAI,CAAC;QAC9B;QACA,MAAMV,cAAcwB,gBAAgBE;QACpCT,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAEK,yBAAyB,CAAC,CAAC;IACxD;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASM,UAAUC,OAAgB;IACxCA,QACGA,OAAO,CAAC,aACRC,WAAW,CAAC,2BACZC,cAAc,CAAC,uBAAuB,gBACtCC,MAAM,CAAC,OAAO,EAAEvB,IAAI,EAAE;QACrB,MAAMD,aAAaC;QACnB,MAAMS,kBAAkBT;IAC1B;AACJ"}
1
+ {"version":3,"sources":["../../../src/cli/workspace/workspace.ts"],"sourcesContent":["import { names } from '@nx/devkit';\nimport { copyFilesGenerator, filesGenerator, readTextFile, writeTextFile } from '@vnodes/fs';\nimport { type Command } from 'commander';\nimport ejs from 'ejs';\nimport { mkdir } from 'node:fs/promises';\nimport { dirname, join, relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { getWorkspaceVersion } from '../../utils/get-workspace-version.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nasync function geneateFiles(name: string) {\n const removeTemplateSuffix = (filePath: string) => {\n return filePath.slice(0, -'.template'.length);\n };\n const copyFilesGeneartor = copyFilesGenerator(\n join(__dirname, 'files'),\n join(name),\n removeTemplateSuffix,\n );\n\n for await (const entry of copyFilesGeneartor) {\n console.log(`[ Created ] ${entry}`);\n }\n}\n\nasync function generateTemplates(name: string) {\n const templateRootDir = join(__dirname, 'templates');\n const templateFiles = filesGenerator(templateRootDir);\n\n for await (const filePath of templateFiles) {\n const templateFileContent = await readTextFile(filePath);\n const relativeTemplateFilePath = relative(templateRootDir, filePath).slice(0, -'.ejs'.length);\n\n const targetFilePath = join(name, relativeTemplateFilePath);\n await mkdir(dirname(targetFilePath), { recursive: true });\n\n const workspaceVersion = await getWorkspaceVersion();\n\n const renderedContent = ejs.render(templateFileContent, {\n ...names(name),\n email: `${name}@${name}.com`,\n workspaceVersion,\n });\n\n await writeTextFile(targetFilePath, renderedContent);\n console.log(`[ Created ] ${relativeTemplateFilePath} `);\n }\n}\n\n/**\n * Generate nx workspace\n *\n * ### Example\n * ````sh\n * vnodes workspace --name WorkSpaceName\n * ````\n * @param command main command instance\n */\nexport function workspace(command: Command) {\n command\n .command('workspace')\n .description('Generate a nx workspace')\n .requiredOption('-n, --name <string>', 'Project name')\n .action(async ({ name }) => {\n await geneateFiles(name);\n await generateTemplates(name);\n });\n}\n"],"names":["names","copyFilesGenerator","filesGenerator","readTextFile","writeTextFile","ejs","mkdir","dirname","join","relative","fileURLToPath","getWorkspaceVersion","__dirname","url","geneateFiles","name","removeTemplateSuffix","filePath","slice","length","copyFilesGeneartor","entry","console","log","generateTemplates","templateRootDir","templateFiles","templateFileContent","relativeTemplateFilePath","targetFilePath","recursive","workspaceVersion","renderedContent","render","email","workspace","command","description","requiredOption","action"],"mappings":"AAAA,SAASA,KAAK,QAAQ,aAAa;AACnC,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,YAAY,EAAEC,aAAa,QAAQ,aAAa;AAE7F,OAAOC,SAAS,MAAM;AACtB,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,YAAY;AACpD,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,mBAAmB,QAAQ,uCAAuC;AAE3E,MAAMC,YAAYL,QAAQG,cAAc,YAAYG,GAAG;AAEvD,eAAeC,aAAaC,IAAY;IACtC,MAAMC,uBAAuB,CAACC;QAC5B,OAAOA,SAASC,KAAK,CAAC,GAAG,CAAC,YAAYC,MAAM;IAC9C;IACA,MAAMC,qBAAqBnB,mBACzBO,KAAKI,WAAW,UAChBJ,KAAKO,OACLC;IAGF,WAAW,MAAMK,SAASD,mBAAoB;QAC5CE,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAEF,OAAO;IACpC;AACF;AAEA,eAAeG,kBAAkBT,IAAY;IAC3C,MAAMU,kBAAkBjB,KAAKI,WAAW;IACxC,MAAMc,gBAAgBxB,eAAeuB;IAErC,WAAW,MAAMR,YAAYS,cAAe;QAC1C,MAAMC,sBAAsB,MAAMxB,aAAac;QAC/C,MAAMW,2BAA2BnB,SAASgB,iBAAiBR,UAAUC,KAAK,CAAC,GAAG,CAAC,OAAOC,MAAM;QAE5F,MAAMU,iBAAiBrB,KAAKO,MAAMa;QAClC,MAAMtB,MAAMC,QAAQsB,iBAAiB;YAAEC,WAAW;QAAK;QAEvD,MAAMC,mBAAmB,MAAMpB;QAE/B,MAAMqB,kBAAkB3B,IAAI4B,MAAM,CAACN,qBAAqB;YACtD,GAAG3B,MAAMe,KAAK;YACdmB,OAAO,GAAGnB,KAAK,CAAC,EAAEA,KAAK,IAAI,CAAC;YAC5BgB;QACF;QAEA,MAAM3B,cAAcyB,gBAAgBG;QACpCV,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAEK,yBAAyB,CAAC,CAAC;IACxD;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASO,UAAUC,OAAgB;IACxCA,QACGA,OAAO,CAAC,aACRC,WAAW,CAAC,2BACZC,cAAc,CAAC,uBAAuB,gBACtCC,MAAM,CAAC,OAAO,EAAExB,IAAI,EAAE;QACrB,MAAMD,aAAaC;QACnB,MAAMS,kBAAkBT;IAC1B;AACJ"}
@@ -0,0 +1,12 @@
1
+ import { type Command } from 'commander';
2
+ /**
3
+ * Say workspace-version
4
+ *
5
+ * ### Example
6
+ * ````sh
7
+ * vnodes workspace-version --username YourName
8
+ * ````
9
+ * @param command main command instance
10
+ */
11
+ export declare function workspaceVersion(command: Command): void;
12
+ //# sourceMappingURL=workspace-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-version.d.ts","sourceRoot":"","sources":["../../../src/cli/workspace-version/workspace-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,QAQhD"}
@@ -0,0 +1,17 @@
1
+ import { getWorkspaceVersion } from '../../utils/get-workspace-version.js';
2
+ /**
3
+ * Say workspace-version
4
+ *
5
+ * ### Example
6
+ * ````sh
7
+ * vnodes workspace-version --username YourName
8
+ * ````
9
+ * @param command main command instance
10
+ */ export function workspaceVersion(command) {
11
+ command.command('workspace-version').action(async ()=>{
12
+ const version = await getWorkspaceVersion();
13
+ console.log(version);
14
+ });
15
+ }
16
+
17
+ //# sourceMappingURL=workspace-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli/workspace-version/workspace-version.ts"],"sourcesContent":["import { type Command } from 'commander';\nimport { getWorkspaceVersion } from '../../utils/get-workspace-version.js';\n\n/**\n * Say workspace-version\n *\n * ### Example\n * ````sh\n * vnodes workspace-version --username YourName\n * ````\n * @param command main command instance\n */\nexport function workspaceVersion(command: Command) {\n command\n .command('workspace-version')\n\n .action(async () => {\n const version = await getWorkspaceVersion();\n console.log(version);\n });\n}\n"],"names":["getWorkspaceVersion","workspaceVersion","command","action","version","console","log"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,uCAAuC;AAE3E;;;;;;;;CAQC,GACD,OAAO,SAASC,iBAAiBC,OAAgB;IAC/CA,QACGA,OAAO,CAAC,qBAERC,MAAM,CAAC;QACN,MAAMC,UAAU,MAAMJ;QACtBK,QAAQC,GAAG,CAACF;IACd;AACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/generators/project/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,EAAc,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAGtF,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAI9E,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAaxD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAE3E;AAED,MAAM,MAAM,iCAAiC,GAAG,sBAAsB,GAAG;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAE7B,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,GAC9B,iCAAiC,CAsBnC;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,iBAuBjF;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/generators/project/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,KAAK,EAAc,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAGtF,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAI9E,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAaxD;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAE3E;AAED,MAAM,MAAM,iCAAiC,GAAG,sBAAsB,GAAG;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAE7B,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,GAC9B,iCAAiC,CAuBnC;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,iBAuBjF;AAED,eAAe,gBAAgB,CAAC"}
@@ -39,6 +39,7 @@ export function normalizeProjectSchema(options) {
39
39
  n.databaseProjectName = n.projectName + '-db';
40
40
  }
41
41
  n.commonShortName = n.shortName.replace(/-api$/, '').replace(/-db$/, '');
42
+ n.workspaceVersion ??= '0.1.11';
42
43
  return {
43
44
  ...n,
44
45
  ...names(shortName)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/generators/project/project.ts"],"sourcesContent":["import { formatFiles, generateFiles, names, updateJson, type Tree } from '@nx/devkit';\nimport { basename, dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { type ProjectGeneratorSchema, type ProjectType } from './schema.d.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport function autoTag(projectType: ProjectType): string {\n switch (projectType) {\n case 'lib': {\n return 'lib:shared';\n }\n case 'cli':\n case 'api': {\n return `app:${projectType}`;\n }\n case 'prisma': {\n return `app:db`;\n }\n }\n}\n\nexport function brandEmail(orgName: string, shortName: string, email: string) {\n return email.split('@').join(`+${orgName}-${shortName}@`);\n}\n\nexport type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {\n projectName: string;\n shortName: string;\n sourceRoot: string;\n targetRoot: string;\n tag: string;\n workspaceVersion: string;\n databaseProjectName: string;\n commonShortName: string;\n} & ReturnType<typeof names>;\n\nexport function normalizeProjectSchema(\n options: ProjectGeneratorSchema,\n): NormalizedProjectGeneratorOptions {\n const n = { ...options } as NormalizedProjectGeneratorOptions;\n\n const shortName = basename(options.directory);\n\n n.shortName = shortName;\n\n n.sourceRoot = join(__dirname, options.projectType);\n n.targetRoot = join(options.directory);\n n.projectName = `@${options.orgName}/${shortName}`;\n n.tag = autoTag(n.projectType);\n n.email = brandEmail(options.orgName, shortName, options.email);\n\n if (n.projectName.match(/-api$/)) {\n n.databaseProjectName = n.projectName.replace(/-api$/, '-db');\n } else {\n n.databaseProjectName = n.projectName + '-db';\n }\n\n n.commonShortName = n.shortName.replace(/-api$/, '').replace(/-db$/, '');\n\n return { ...n, ...names(shortName) };\n}\n\nexport async function projectGenerator(tree: Tree, options: ProjectGeneratorSchema) {\n const normalizedOptions = normalizeProjectSchema(options);\n\n generateFiles(tree, normalizedOptions.sourceRoot, normalizedOptions.targetRoot, {\n ...normalizedOptions,\n });\n\n generateFiles(tree, join(__dirname, 'common'), normalizedOptions.targetRoot, {\n ...normalizedOptions,\n });\n\n updateJson(tree, 'tsconfig.json', (value) => {\n if (!value.references) {\n value.references = [];\n }\n\n value.references.push({\n path: `./${options.directory}`,\n });\n\n return value;\n });\n await formatFiles(tree);\n}\n\nexport default projectGenerator;\n"],"names":["formatFiles","generateFiles","names","updateJson","basename","dirname","join","fileURLToPath","__dirname","url","autoTag","projectType","brandEmail","orgName","shortName","email","split","normalizeProjectSchema","options","n","directory","sourceRoot","targetRoot","projectName","tag","match","databaseProjectName","replace","commonShortName","projectGenerator","tree","normalizedOptions","value","references","push","path"],"mappings":"AAAA,SAASA,WAAW,EAAEC,aAAa,EAAEC,KAAK,EAAEC,UAAU,QAAmB,aAAa;AACtF,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AACpD,SAASC,aAAa,QAAQ,WAAW;AAGzC,MAAMC,YAAYH,QAAQE,cAAc,YAAYE,GAAG;AAEvD,OAAO,SAASC,QAAQC,WAAwB;IAC9C,OAAQA;QACN,KAAK;YAAO;gBACV,OAAO;YACT;QACA,KAAK;QACL,KAAK;YAAO;gBACV,OAAO,CAAC,IAAI,EAAEA,aAAa;YAC7B;QACA,KAAK;YAAU;gBACb,OAAO,CAAC,MAAM,CAAC;YACjB;IACF;AACF;AAEA,OAAO,SAASC,WAAWC,OAAe,EAAEC,SAAiB,EAAEC,KAAa;IAC1E,OAAOA,MAAMC,KAAK,CAAC,KAAKV,IAAI,CAAC,CAAC,CAAC,EAAEO,QAAQ,CAAC,EAAEC,UAAU,CAAC,CAAC;AAC1D;AAaA,OAAO,SAASG,uBACdC,OAA+B;IAE/B,MAAMC,IAAI;QAAE,GAAGD,OAAO;IAAC;IAEvB,MAAMJ,YAAYV,SAASc,QAAQE,SAAS;IAE5CD,EAAEL,SAAS,GAAGA;IAEdK,EAAEE,UAAU,GAAGf,KAAKE,WAAWU,QAAQP,WAAW;IAClDQ,EAAEG,UAAU,GAAGhB,KAAKY,QAAQE,SAAS;IACrCD,EAAEI,WAAW,GAAG,CAAC,CAAC,EAAEL,QAAQL,OAAO,CAAC,CAAC,EAAEC,WAAW;IAClDK,EAAEK,GAAG,GAAGd,QAAQS,EAAER,WAAW;IAC7BQ,EAAEJ,KAAK,GAAGH,WAAWM,QAAQL,OAAO,EAAEC,WAAWI,QAAQH,KAAK;IAE9D,IAAII,EAAEI,WAAW,CAACE,KAAK,CAAC,UAAU;QAChCN,EAAEO,mBAAmB,GAAGP,EAAEI,WAAW,CAACI,OAAO,CAAC,SAAS;IACzD,OAAO;QACLR,EAAEO,mBAAmB,GAAGP,EAAEI,WAAW,GAAG;IAC1C;IAEAJ,EAAES,eAAe,GAAGT,EAAEL,SAAS,CAACa,OAAO,CAAC,SAAS,IAAIA,OAAO,CAAC,QAAQ;IAErE,OAAO;QAAE,GAAGR,CAAC;QAAE,GAAGjB,MAAMY,UAAU;IAAC;AACrC;AAEA,OAAO,eAAee,iBAAiBC,IAAU,EAAEZ,OAA+B;IAChF,MAAMa,oBAAoBd,uBAAuBC;IAEjDjB,cAAc6B,MAAMC,kBAAkBV,UAAU,EAAEU,kBAAkBT,UAAU,EAAE;QAC9E,GAAGS,iBAAiB;IACtB;IAEA9B,cAAc6B,MAAMxB,KAAKE,WAAW,WAAWuB,kBAAkBT,UAAU,EAAE;QAC3E,GAAGS,iBAAiB;IACtB;IAEA5B,WAAW2B,MAAM,iBAAiB,CAACE;QACjC,IAAI,CAACA,MAAMC,UAAU,EAAE;YACrBD,MAAMC,UAAU,GAAG,EAAE;QACvB;QAEAD,MAAMC,UAAU,CAACC,IAAI,CAAC;YACpBC,MAAM,CAAC,EAAE,EAAEjB,QAAQE,SAAS,EAAE;QAChC;QAEA,OAAOY;IACT;IACA,MAAMhC,YAAY8B;AACpB;AAEA,eAAeD,iBAAiB"}
1
+ {"version":3,"sources":["../../../src/generators/project/project.ts"],"sourcesContent":["import { formatFiles, generateFiles, names, updateJson, type Tree } from '@nx/devkit';\nimport { basename, dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { type ProjectGeneratorSchema, type ProjectType } from './schema.d.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport function autoTag(projectType: ProjectType): string {\n switch (projectType) {\n case 'lib': {\n return 'lib:shared';\n }\n case 'cli':\n case 'api': {\n return `app:${projectType}`;\n }\n case 'prisma': {\n return `app:db`;\n }\n }\n}\n\nexport function brandEmail(orgName: string, shortName: string, email: string) {\n return email.split('@').join(`+${orgName}-${shortName}@`);\n}\n\nexport type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {\n projectName: string;\n shortName: string;\n sourceRoot: string;\n targetRoot: string;\n tag: string;\n workspaceVersion: string;\n databaseProjectName: string;\n commonShortName: string;\n} & ReturnType<typeof names>;\n\nexport function normalizeProjectSchema(\n options: ProjectGeneratorSchema,\n): NormalizedProjectGeneratorOptions {\n const n = { ...options } as NormalizedProjectGeneratorOptions;\n\n const shortName = basename(options.directory);\n\n n.shortName = shortName;\n\n n.sourceRoot = join(__dirname, options.projectType);\n n.targetRoot = join(options.directory);\n n.projectName = `@${options.orgName}/${shortName}`;\n n.tag = autoTag(n.projectType);\n n.email = brandEmail(options.orgName, shortName, options.email);\n\n if (n.projectName.match(/-api$/)) {\n n.databaseProjectName = n.projectName.replace(/-api$/, '-db');\n } else {\n n.databaseProjectName = n.projectName + '-db';\n }\n\n n.commonShortName = n.shortName.replace(/-api$/, '').replace(/-db$/, '');\n n.workspaceVersion ??= '0.1.11';\n\n return { ...n, ...names(shortName) };\n}\n\nexport async function projectGenerator(tree: Tree, options: ProjectGeneratorSchema) {\n const normalizedOptions = normalizeProjectSchema(options);\n\n generateFiles(tree, normalizedOptions.sourceRoot, normalizedOptions.targetRoot, {\n ...normalizedOptions,\n });\n\n generateFiles(tree, join(__dirname, 'common'), normalizedOptions.targetRoot, {\n ...normalizedOptions,\n });\n\n updateJson(tree, 'tsconfig.json', (value) => {\n if (!value.references) {\n value.references = [];\n }\n\n value.references.push({\n path: `./${options.directory}`,\n });\n\n return value;\n });\n await formatFiles(tree);\n}\n\nexport default projectGenerator;\n"],"names":["formatFiles","generateFiles","names","updateJson","basename","dirname","join","fileURLToPath","__dirname","url","autoTag","projectType","brandEmail","orgName","shortName","email","split","normalizeProjectSchema","options","n","directory","sourceRoot","targetRoot","projectName","tag","match","databaseProjectName","replace","commonShortName","workspaceVersion","projectGenerator","tree","normalizedOptions","value","references","push","path"],"mappings":"AAAA,SAASA,WAAW,EAAEC,aAAa,EAAEC,KAAK,EAAEC,UAAU,QAAmB,aAAa;AACtF,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AACpD,SAASC,aAAa,QAAQ,WAAW;AAGzC,MAAMC,YAAYH,QAAQE,cAAc,YAAYE,GAAG;AAEvD,OAAO,SAASC,QAAQC,WAAwB;IAC9C,OAAQA;QACN,KAAK;YAAO;gBACV,OAAO;YACT;QACA,KAAK;QACL,KAAK;YAAO;gBACV,OAAO,CAAC,IAAI,EAAEA,aAAa;YAC7B;QACA,KAAK;YAAU;gBACb,OAAO,CAAC,MAAM,CAAC;YACjB;IACF;AACF;AAEA,OAAO,SAASC,WAAWC,OAAe,EAAEC,SAAiB,EAAEC,KAAa;IAC1E,OAAOA,MAAMC,KAAK,CAAC,KAAKV,IAAI,CAAC,CAAC,CAAC,EAAEO,QAAQ,CAAC,EAAEC,UAAU,CAAC,CAAC;AAC1D;AAaA,OAAO,SAASG,uBACdC,OAA+B;IAE/B,MAAMC,IAAI;QAAE,GAAGD,OAAO;IAAC;IAEvB,MAAMJ,YAAYV,SAASc,QAAQE,SAAS;IAE5CD,EAAEL,SAAS,GAAGA;IAEdK,EAAEE,UAAU,GAAGf,KAAKE,WAAWU,QAAQP,WAAW;IAClDQ,EAAEG,UAAU,GAAGhB,KAAKY,QAAQE,SAAS;IACrCD,EAAEI,WAAW,GAAG,CAAC,CAAC,EAAEL,QAAQL,OAAO,CAAC,CAAC,EAAEC,WAAW;IAClDK,EAAEK,GAAG,GAAGd,QAAQS,EAAER,WAAW;IAC7BQ,EAAEJ,KAAK,GAAGH,WAAWM,QAAQL,OAAO,EAAEC,WAAWI,QAAQH,KAAK;IAE9D,IAAII,EAAEI,WAAW,CAACE,KAAK,CAAC,UAAU;QAChCN,EAAEO,mBAAmB,GAAGP,EAAEI,WAAW,CAACI,OAAO,CAAC,SAAS;IACzD,OAAO;QACLR,EAAEO,mBAAmB,GAAGP,EAAEI,WAAW,GAAG;IAC1C;IAEAJ,EAAES,eAAe,GAAGT,EAAEL,SAAS,CAACa,OAAO,CAAC,SAAS,IAAIA,OAAO,CAAC,QAAQ;IACrER,EAAEU,gBAAgB,KAAK;IAEvB,OAAO;QAAE,GAAGV,CAAC;QAAE,GAAGjB,MAAMY,UAAU;IAAC;AACrC;AAEA,OAAO,eAAegB,iBAAiBC,IAAU,EAAEb,OAA+B;IAChF,MAAMc,oBAAoBf,uBAAuBC;IAEjDjB,cAAc8B,MAAMC,kBAAkBX,UAAU,EAAEW,kBAAkBV,UAAU,EAAE;QAC9E,GAAGU,iBAAiB;IACtB;IAEA/B,cAAc8B,MAAMzB,KAAKE,WAAW,WAAWwB,kBAAkBV,UAAU,EAAE;QAC3E,GAAGU,iBAAiB;IACtB;IAEA7B,WAAW4B,MAAM,iBAAiB,CAACE;QACjC,IAAI,CAACA,MAAMC,UAAU,EAAE;YACrBD,MAAMC,UAAU,GAAG,EAAE;QACvB;QAEAD,MAAMC,UAAU,CAACC,IAAI,CAAC;YACpBC,MAAM,CAAC,EAAE,EAAElB,QAAQE,SAAS,EAAE;QAChC;QAEA,OAAOa;IACT;IACA,MAAMjC,YAAY+B;AACpB;AAEA,eAAeD,iBAAiB"}
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vnodes/cli",
3
3
  "description": "Vnodes cli",
4
- "version": "0.1.11",
4
+ "version": "0.1.12",
5
5
  "author": {
6
6
  "email": "robert.brightline+vnodes-prisma@gmail.com",
7
7
  "name": "Robert Brightline",
@@ -0,0 +1,2 @@
1
+ export declare function getWorkspaceVersion(): Promise<string>;
2
+ //# sourceMappingURL=get-workspace-version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-workspace-version.d.ts","sourceRoot":"","sources":["../../src/utils/get-workspace-version.ts"],"names":[],"mappings":"AAMA,wBAAsB,mBAAmB,oBAIxC"}
@@ -0,0 +1,10 @@
1
+ import { readJsonFile } from '@vnodes/fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __dirname = dirname(fileURLToPath(import.meta.url));
5
+ export async function getWorkspaceVersion() {
6
+ const packageJson = await readJsonFile(join(__dirname, '../package.json'));
7
+ return packageJson.version;
8
+ }
9
+
10
+ //# sourceMappingURL=get-workspace-version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/get-workspace-version.ts"],"sourcesContent":["import { readJsonFile } from '@vnodes/fs';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async function getWorkspaceVersion() {\n const packageJson = await readJsonFile<{ version: string }>(join(__dirname, '../package.json'));\n\n return packageJson.version;\n}\n"],"names":["readJsonFile","dirname","join","fileURLToPath","__dirname","url","getWorkspaceVersion","packageJson","version"],"mappings":"AAAA,SAASA,YAAY,QAAQ,aAAa;AAC1C,SAASC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAC1C,SAASC,aAAa,QAAQ,WAAW;AAEzC,MAAMC,YAAYH,QAAQE,cAAc,YAAYE,GAAG;AAEvD,OAAO,eAAeC;IACpB,MAAMC,cAAc,MAAMP,aAAkCE,KAAKE,WAAW;IAE5E,OAAOG,YAAYC,OAAO;AAC5B"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vnodes/cli",
3
3
  "description": "Vnodes cli",
4
- "version": "0.1.11",
4
+ "version": "0.1.12",
5
5
  "author": {
6
6
  "email": "robert.brightline+vnodes-prisma@gmail.com",
7
7
  "name": "Robert Brightline",
@@ -90,7 +90,7 @@
90
90
  "@swc/helpers": "~0.5.18",
91
91
  "commander": "^15.0.0",
92
92
  "ejs": "^6.0.1",
93
- "@vnodes/fs": "0.1.11"
93
+ "@vnodes/fs": "0.1.12"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@types/ejs": "^3.1.5"