@vnodes/cli 0.1.10 → 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.
Files changed (50) hide show
  1. package/dist/cli/bye/bye.d.ts +1 -1
  2. package/dist/cli/bye/bye.d.ts.map +1 -1
  3. package/dist/cli/bye/bye.js.map +1 -1
  4. package/dist/cli/cli.js +5 -3
  5. package/dist/cli/cli.js.map +1 -1
  6. package/dist/cli/hello/hello.d.ts +1 -1
  7. package/dist/cli/hello/hello.d.ts.map +1 -1
  8. package/dist/cli/hello/hello.js.map +1 -1
  9. package/dist/cli/rm/rm.d.ts +1 -1
  10. package/dist/cli/rm/rm.d.ts.map +1 -1
  11. package/dist/cli/rm/rm.js.map +1 -1
  12. package/dist/cli/suffix/suffix.d.ts +1 -1
  13. package/dist/cli/suffix/suffix.d.ts.map +1 -1
  14. package/dist/cli/suffix/suffix.js +11 -9
  15. package/dist/cli/suffix/suffix.js.map +1 -1
  16. package/dist/cli/wd/wd.d.ts +1 -1
  17. package/dist/cli/wd/wd.d.ts.map +1 -1
  18. package/dist/cli/wd/wd.js.map +1 -1
  19. package/dist/cli/workspace/files/.eslint/eslint.base.mjs.template +2 -1
  20. package/dist/cli/workspace/files/.eslint/module-boundries.mjs.template +7 -2
  21. package/dist/cli/workspace/files/.eslint/type-import.mjs.template +14 -0
  22. package/dist/cli/workspace/files/.husky/pre-commit.template +2 -1
  23. package/dist/cli/workspace/files/.prettierrc.template +1 -1
  24. package/dist/cli/workspace/files/.vscode/launch.json.template +23 -0
  25. package/dist/cli/workspace/files/.vscode/prisma.code-snippets.template +38 -0
  26. package/dist/cli/workspace/files/.vscode/settings.json.template +5 -2
  27. package/dist/cli/workspace/files/.vscode/ts.code-snippets.template +5 -1
  28. package/dist/cli/workspace/templates/nx.json.ejs +1 -1
  29. package/dist/cli/workspace/templates/package.json.ejs +2 -2
  30. package/dist/cli/workspace/workspace.d.ts +1 -1
  31. package/dist/cli/workspace/workspace.d.ts.map +1 -1
  32. package/dist/cli/workspace/workspace.js +13 -10
  33. package/dist/cli/workspace/workspace.js.map +1 -1
  34. package/dist/cli/workspace-version/workspace-version.d.ts +12 -0
  35. package/dist/cli/workspace-version/workspace-version.d.ts.map +1 -0
  36. package/dist/cli/workspace-version/workspace-version.js +17 -0
  37. package/dist/cli/workspace-version/workspace-version.js.map +1 -0
  38. package/dist/generators/project/api/.env.template +2 -2
  39. package/dist/generators/project/prisma/.env.template +2 -2
  40. package/dist/generators/project/prisma/package.json.template +1 -2
  41. package/dist/generators/project/project.d.ts +1 -0
  42. package/dist/generators/project/project.d.ts.map +1 -1
  43. package/dist/generators/project/project.js +2 -0
  44. package/dist/generators/project/project.js.map +1 -1
  45. package/dist/package.json +1 -1
  46. package/dist/utils/get-workspace-version.d.ts +2 -0
  47. package/dist/utils/get-workspace-version.d.ts.map +1 -0
  48. package/dist/utils/get-workspace-version.js +10 -0
  49. package/dist/utils/get-workspace-version.js.map +1 -0
  50. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Say bye
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"bye.d.ts","sourceRoot":"","sources":["../../../src/cli/bye/bye.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,QAKnC"}
1
+ {"version":3,"file":"bye.d.ts","sourceRoot":"","sources":["../../../src/cli/bye/bye.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,GAAG,CAAC,OAAO,EAAE,OAAO,QAKnC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/bye/bye.ts"],"sourcesContent":["import { Command } from 'commander';\n\n/**\n * Say bye\n *\n * ### Example\n * ````sh\n * vnodes bye --username YourName\n * ````\n * @param command main command instance\n */\nexport function bye(command: Command) {\n command\n .command('bye')\n .requiredOption('-u, --username <string>', 'What is your name')\n .action(({ username }) => console.log(`Hello, ${username}`));\n}\n"],"names":["bye","command","requiredOption","action","username","console","log"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,IAAIC,OAAgB;IAClCA,QACGA,OAAO,CAAC,OACRC,cAAc,CAAC,2BAA2B,qBAC1CC,MAAM,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAKC,QAAQC,GAAG,CAAC,CAAC,OAAO,EAAEF,UAAU;AAC9D"}
1
+ {"version":3,"sources":["../../../src/cli/bye/bye.ts"],"sourcesContent":["import { type Command } from 'commander';\n\n/**\n * Say bye\n *\n * ### Example\n * ````sh\n * vnodes bye --username YourName\n * ````\n * @param command main command instance\n */\nexport function bye(command: Command) {\n command\n .command('bye')\n .requiredOption('-u, --username <string>', 'What is your name')\n .action(({ username }) => console.log(`Hello, ${username}`));\n}\n"],"names":["bye","command","requiredOption","action","username","console","log"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,IAAIC,OAAgB;IAClCA,QACGA,OAAO,CAAC,OACRC,cAAc,CAAC,2BAA2B,qBAC1CC,MAAM,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAKC,QAAQC,GAAG,CAAC,CAAC,OAAO,EAAEF,UAAU;AAC9D"}
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,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Say hello to the user
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../../../src/cli/hello/hello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,QAKrC"}
1
+ {"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../../../src/cli/hello/hello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,OAAO,QAKrC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/hello/hello.ts"],"sourcesContent":["import { Command } from 'commander';\n\n/**\n * Say hello to the user\n *\n * ### Example\n * ````sh\n * vnodes hello --username YourName\n * ````\n * @param command main command instance\n */\nexport function hello(command: Command) {\n command\n .command('hello')\n .requiredOption('-u, --username <string>', 'What is your name')\n .action(({ username }) => console.log(`Hello, ${username}`));\n}\n"],"names":["hello","command","requiredOption","action","username","console","log"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,MAAMC,OAAgB;IACpCA,QACGA,OAAO,CAAC,SACRC,cAAc,CAAC,2BAA2B,qBAC1CC,MAAM,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAKC,QAAQC,GAAG,CAAC,CAAC,OAAO,EAAEF,UAAU;AAC9D"}
1
+ {"version":3,"sources":["../../../src/cli/hello/hello.ts"],"sourcesContent":["import { type Command } from 'commander';\n\n/**\n * Say hello to the user\n *\n * ### Example\n * ````sh\n * vnodes hello --username YourName\n * ````\n * @param command main command instance\n */\nexport function hello(command: Command) {\n command\n .command('hello')\n .requiredOption('-u, --username <string>', 'What is your name')\n .action(({ username }) => console.log(`Hello, ${username}`));\n}\n"],"names":["hello","command","requiredOption","action","username","console","log"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,MAAMC,OAAgB;IACpCA,QACGA,OAAO,CAAC,SACRC,cAAc,CAAC,2BAA2B,qBAC1CC,MAAM,CAAC,CAAC,EAAEC,QAAQ,EAAE,GAAKC,QAAQC,GAAG,CAAC,CAAC,OAAO,EAAEF,UAAU;AAC9D"}
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Remove files/directories
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../../src/cli/rm/rm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,QASlC"}
1
+ {"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../../src/cli/rm/rm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,QASlC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/rm/rm.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { rm as nodeRm } from 'node:fs/promises';\nimport { scope } from '@vnodes/fs';\nimport { cwd } from 'node:process';\n/**\n * Remove files/directories\n *\n * ### Example\n * ````sh\n * vnodes rm --path some/path/to/delete\n * ````\n * @param command main command instance\n */\nexport function rm(command: Command) {\n command\n .command('rm')\n .description('Remove all directories/files under the given path.')\n .requiredOption('-p, --path <string>', 'Path to delete')\n .action(async ({ path }) => {\n const resolve = scope(cwd());\n await nodeRm(resolve(path), { recursive: true, force: true, maxRetries: 3, retryDelay: 400 });\n });\n}\n"],"names":["rm","nodeRm","scope","cwd","command","description","requiredOption","action","path","resolve","recursive","force","maxRetries","retryDelay"],"mappings":"AACA,SAASA,MAAMC,MAAM,QAAQ,mBAAmB;AAChD,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,GAAG,QAAQ,eAAe;AACnC;;;;;;;;CAQC,GACD,OAAO,SAASH,GAAGI,OAAgB;IACjCA,QACGA,OAAO,CAAC,MACRC,WAAW,CAAC,sDACZC,cAAc,CAAC,uBAAuB,kBACtCC,MAAM,CAAC,OAAO,EAAEC,IAAI,EAAE;QACrB,MAAMC,UAAUP,MAAMC;QACtB,MAAMF,OAAOQ,QAAQD,OAAO;YAAEE,WAAW;YAAMC,OAAO;YAAMC,YAAY;YAAGC,YAAY;QAAI;IAC7F;AACJ"}
1
+ {"version":3,"sources":["../../../src/cli/rm/rm.ts"],"sourcesContent":["import { type Command } from 'commander';\nimport { rm as nodeRm } from 'node:fs/promises';\nimport { scope } from '@vnodes/fs';\nimport { cwd } from 'node:process';\n/**\n * Remove files/directories\n *\n * ### Example\n * ````sh\n * vnodes rm --path some/path/to/delete\n * ````\n * @param command main command instance\n */\nexport function rm(command: Command) {\n command\n .command('rm')\n .description('Remove all directories/files under the given path.')\n .requiredOption('-p, --path <string>', 'Path to delete')\n .action(async ({ path }) => {\n const resolve = scope(cwd());\n await nodeRm(resolve(path), { recursive: true, force: true, maxRetries: 3, retryDelay: 400 });\n });\n}\n"],"names":["rm","nodeRm","scope","cwd","command","description","requiredOption","action","path","resolve","recursive","force","maxRetries","retryDelay"],"mappings":"AACA,SAASA,MAAMC,MAAM,QAAQ,mBAAmB;AAChD,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,GAAG,QAAQ,eAAe;AACnC;;;;;;;;CAQC,GACD,OAAO,SAASH,GAAGI,OAAgB;IACjCA,QACGA,OAAO,CAAC,MACRC,WAAW,CAAC,sDACZC,cAAc,CAAC,uBAAuB,kBACtCC,MAAM,CAAC,OAAO,EAAEC,IAAI,EAAE;QACrB,MAAMC,UAAUP,MAAMC;QACtB,MAAMF,OAAOQ,QAAQD,OAAO;YAAEE,WAAW;YAAMC,OAAO;YAAMC,YAAY;YAAGC,YAAY;QAAI;IAC7F;AACJ"}
@@ -1,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Suffix file/files recursive (optional)
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"suffix.d.ts","sourceRoot":"","sources":["../../../src/cli/suffix/suffix.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;;;;;GAYG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,OAAO,QAsBtC"}
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,5 +1,6 @@
1
- import { readdirSync, renameSync } from 'node:fs';
1
+ import { readdir, rename } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
+ import { cwd } from 'node:process';
3
4
  /**
4
5
  * Suffix file/files recursive (optional)
5
6
  *
@@ -13,17 +14,18 @@ import { join } from 'node:path';
13
14
  * ````
14
15
  * @param command main command instance
15
16
  */ export function suffix(command) {
16
- 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 })=>{
17
- const absolutePaths = readdirSync('', {
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(), {
18
20
  recursive: !!recursive,
19
21
  withFileTypes: true
20
- }).filter((e)=>e.isFile()).map((e)=>join('./', e.parentPath, e.name));
21
- const createNewFilepath = (filePath)=>{
22
- return undo ? filePath.replace(new RegExp(`${suffix}$`), '') : `${filePath}${suffix}`;
22
+ });
23
+ const absolutePaths = foundDirs.filter((e)=>e.isFile()).map((e)=>join(e.parentPath, e.name));
24
+ const newFilepath = (filePath)=>{
25
+ return undo ? filePath.slice(0, -suffix.length) : `${filePath}${suffix}`;
23
26
  };
24
- for (const filePath of absolutePaths){
25
- renameSync(filePath, createNewFilepath(filePath));
26
- }
27
+ const asyncOperations = absolutePaths.map((filePath)=>()=>rename(filePath, newFilepath(filePath)));
28
+ await parallel(asyncOperations, PARALLEL);
27
29
  });
28
30
  }
29
31
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/suffix/suffix.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { readdirSync, renameSync } from 'node:fs';\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 absolutePaths = readdirSync('', {\n recursive: !!recursive,\n withFileTypes: true,\n })\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":["readdirSync","renameSync","join","suffix","command","option","requiredOption","action","recursive","undo","absolutePaths","withFileTypes","filter","e","isFile","map","parentPath","name","createNewFilepath","filePath","replace","RegExp"],"mappings":"AACA,SAASA,WAAW,EAAEC,UAAU,QAAQ,UAAU;AAClD,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,gBAAgBV,YAAY,IAAI;YACpCQ,WAAW,CAAC,CAACA;YACbG,eAAe;QACjB,GACGC,MAAM,CAAC,CAACC,IAAMA,EAAEC,MAAM,IACtBC,GAAG,CAAC,CAACF,IAAMX,KAAK,MAAMW,EAAEG,UAAU,EAAEH,EAAEI,IAAI;QAE7C,MAAMC,oBAAoB,CAACC;YACzB,OAAOV,OAAOU,SAASC,OAAO,CAAC,IAAIC,OAAO,GAAGlB,OAAO,CAAC,CAAC,GAAG,MAAM,GAAGgB,WAAWhB,QAAQ;QACvF;QAEA,KAAK,MAAMgB,YAAYT,cAAe;YACpCT,WAAWkB,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
- import { Command } from 'commander';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Print the current working directory
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"wd.d.ts","sourceRoot":"","sources":["../../../src/cli/wd/wd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,QAIlC"}
1
+ {"version":3,"file":"wd.d.ts","sourceRoot":"","sources":["../../../src/cli/wd/wd.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAGzC;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,QAIlC"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/wd/wd.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { cwd } from 'node:process';\n\n/**\n * Print the current working directory\n *\n * ### Example\n * ````sh\n * vnodes hello --username YourName\n * ````\n * @param command main command instance\n */\nexport function wd(command: Command) {\n command.command('wd').action(() => {\n console.log(cwd());\n });\n}\n"],"names":["cwd","wd","command","action","console","log"],"mappings":"AACA,SAASA,GAAG,QAAQ,eAAe;AAEnC;;;;;;;;CAQC,GACD,OAAO,SAASC,GAAGC,OAAgB;IACjCA,QAAQA,OAAO,CAAC,MAAMC,MAAM,CAAC;QAC3BC,QAAQC,GAAG,CAACL;IACd;AACF"}
1
+ {"version":3,"sources":["../../../src/cli/wd/wd.ts"],"sourcesContent":["import { type Command } from 'commander';\nimport { cwd } from 'node:process';\n\n/**\n * Print the current working directory\n *\n * ### Example\n * ````sh\n * vnodes hello --username YourName\n * ````\n * @param command main command instance\n */\nexport function wd(command: Command) {\n command.command('wd').action(() => {\n console.log(cwd());\n });\n}\n"],"names":["cwd","wd","command","action","console","log"],"mappings":"AACA,SAASA,GAAG,QAAQ,eAAe;AAEnC;;;;;;;;CAQC,GACD,OAAO,SAASC,GAAGC,OAAgB;IACjCA,QAAQA,OAAO,CAAC,MAAMC,MAAM,CAAC;QAC3BC,QAAQC,GAAG,CAACL;IACd;AACF"}
@@ -4,5 +4,6 @@ import dependencyCheck from './dependency-check.mjs';
4
4
  import moduleBoundries from './module-boundries.mjs';
5
5
  import noUndefined from './no-undefined.mjs';
6
6
  import nodeProtocol from './node-protocol.mjs';
7
+ import typeImport from './type-import.mjs';
7
8
 
8
- export default [...common, ...dependencyCheck, ...moduleBoundries, ...noUndefined, ...nodeProtocol];
9
+ export default [...common, ...dependencyCheck, ...moduleBoundries, ...noUndefined, ...nodeProtocol, ...typeImport];
@@ -9,13 +9,18 @@ export default [
9
9
  allow: ['^.*/eslint(\\.base)?\\.config\\.mjs$'],
10
10
  depConstraints: [
11
11
  {
12
- sourceTag: 'app:*',
13
- onlyDependOnLibsWithTags: ['lib:core', 'lib:module', 'lib:shared', 'lib:types'],
12
+ sourceTag: 'app:db',
13
+ onlyDependOnLibsWithTags: ['app:db', 'lib:core', 'lib:module', 'lib:shared', 'lib:types'],
14
14
  },
15
+
15
16
  {
16
17
  sourceTag: 'app:api',
17
18
  onlyDependOnLibsWithTags: ['app:db', 'lib:core', 'lib:module', 'lib:shared', 'lib:types'],
18
19
  },
20
+ {
21
+ sourceTag: 'app:cli',
22
+ onlyDependOnLibsWithTags: ['lib:core', 'lib:module', 'lib:shared', 'lib:types'],
23
+ },
19
24
  {
20
25
  sourceTag: 'lib:core',
21
26
  onlyDependOnLibsWithTags: ['lib:module', 'lib:shared', 'lib:types'],
@@ -0,0 +1,14 @@
1
+ export default [
2
+ {
3
+ files: ['**/*.ts', '**/*.js'],
4
+ rules: {
5
+ '@typescript-eslint/consistent-type-imports': [
6
+ 'error',
7
+ {
8
+ prefer: 'type-imports',
9
+ fixStyle: 'inline-type-imports',
10
+ },
11
+ ],
12
+ },
13
+ },
14
+ ];
@@ -1,9 +1,10 @@
1
1
  # #!/bin/bash
2
2
 
3
3
  pnpm nx affected -t prisma:generate --tuiAutoExit=true
4
- pnpm nx affected -t lint --tuiAutoExit=true
4
+ pnpm nx affected -t lint --fix --tuiAutoExit=true
5
5
  pnpm nx affected -t build --tuiAutoExit=true
6
6
  pnpm nx affected -t test --tuiAutoExit=true
7
+ git add .
7
8
 
8
9
 
9
10
 
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "singleQuote": true,
3
- "printWidth": 140
3
+ "printWidth": 120
4
4
  }
@@ -0,0 +1,23 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Debug @vnodes/sample-api with Nx",
8
+ "runtimeExecutable": "pnpm",
9
+ "runtimeArgs": ["exec", "nx", "serve", "@vnodes/sample-api"],
10
+ "env": {
11
+ "NODE_OPTIONS": "--inspect=9229"
12
+ },
13
+ "console": "integratedTerminal",
14
+ "internalConsoleOptions": "neverOpen",
15
+ "skipFiles": ["<node_internals>/**"],
16
+ "sourceMaps": true,
17
+ "outFiles": [
18
+ "${workspaceFolder}/apis/sample-api/dist/**/*.(m|c|)js",
19
+ "!**/node_modules/**"
20
+ ]
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "prisma model": {
3
+ "prefix": "model",
4
+ "body": [
5
+ "model $1 {",
6
+ " id Int @id @default(autoincrement())",
7
+ " createdAt DateTime @default(now()) @map(\"created_at\")",
8
+ " updatedAt DateTime @updatedAt @map(\"updated_at\")",
9
+ " deletedAt DateTime? @map(\"deleted_at\")",
10
+ " isActive Boolean @default(true) @map(\"is_active\")",
11
+ " createdBy User? @relation(fields: [createdByUserId], references: [id], onDelete: SetNull, onUpdate: Cascade)",
12
+ " createdByUserId Int? @map(\"created_by_user_id\")",
13
+ " name String @unique",
14
+ " description String?",
15
+ "",
16
+ "$0",
17
+ "@@map(\"${1/(^[A-Z])|(?<=[a-z0-9])([A-Z])/${1:/downcase}${2:+_${2:/downcase}/g}\")",
18
+ "}",
19
+ ],
20
+ "scope": "prisma"
21
+ },
22
+ "prisma model map": {
23
+ "prefix": "prisma model map",
24
+ "body": [
25
+ "model ${1}${2} {",
26
+ " ${1/([A-Z])/${1:/downcase}/g} $1 @relation(fields: [${1/([A-Z])/${1:/downcase}/g}Id], references: [id], onDelete: Cascade, onUpdate: Cascade)",
27
+ " ${1/([A-Z])/${1:/downcase}/g}Id Int @map(\"${1/([A-Z])/${1:/downcase}/g}_id\")",
28
+ "",
29
+ " ${2/([A-Z])/${1:/downcase}/g} $2 @relation(fields: [${2/([A-Z])/${1:/downcase}/g}Id], references: [id], onDelete: Cascade, onUpdate: Cascade)",
30
+ " ${2/([A-Z])/${1:/downcase}/g}Id Int @map(\"${2/([A-Z])/${1:/downcase}/g}_id\")",
31
+ "",
32
+ " @@unique([${1/([A-Z])/${1:/downcase}/g}Id, ${2/([A-Z])/${1:/downcase}/g}Id])",
33
+ " @@map(\"${1/([A-Z])/${1:/downcase}/g}_${2/([A-Z])/${1:/downcase}/g}s\")",
34
+ "}"
35
+ ],
36
+ "scope": "prisma"
37
+ }
38
+ }
@@ -17,11 +17,14 @@
17
17
  "[typescript]": {
18
18
  "editor.defaultFormatter": "esbenp.prettier-vscode",
19
19
  "editor.codeActionsOnSave": {
20
+ "source.organizeImports": "always",
21
+ "source.sortImports": "always",
22
+ "source.fixAll.ts": "always",
20
23
  "source.fixAll.prettier": "always",
21
24
  "source.fixAll.eslint": "always",
22
25
  "source.removeUnused.ts": "always",
23
26
  "source.addMissingImports.ts": "always",
24
- "source.removeUnusedImports": "always",
27
+ "source.removeUnusedImports": "always"
25
28
  }
26
- },
29
+ }
27
30
  }
@@ -10,7 +10,11 @@
10
10
  },
11
11
  "_dirname": {
12
12
  "prefix": "_dirname",
13
- "body": "const __dirname = dirname(fileURLToPath(import.meta.url));",
13
+ "body": [
14
+ "import { dirname, join } from 'path'",
15
+ "import { fileURLToPath } from 'url';",
16
+ "const __dirname = dirname(fileURLToPath(import.meta.url));"
17
+ ],
14
18
  "scope": "typescript"
15
19
  }
16
20
  }
@@ -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,4 +1,4 @@
1
- import { Command } from 'commander';
1
+ import { type Command } from 'commander';
2
2
  /**
3
3
  * Generate nx workspace
4
4
  *
@@ -1 +1 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../../src/cli/workspace/workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoCpC;;;;;;;;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"}
@@ -1,10 +1,10 @@
1
+ import { names } from '@nx/devkit';
1
2
  import { copyFilesGenerator, filesGenerator, readTextFile, writeTextFile } from '@vnodes/fs';
2
- import { basename, dirname, join, relative } from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
3
  import ejs from 'ejs';
5
- import { names } from '@nx/devkit';
6
4
  import { mkdir } from 'node:fs/promises';
7
- import { cwd } from 'node:process';
5
+ import { dirname, join, relative } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { getWorkspaceVersion } from '../../utils/get-workspace-version.js';
8
8
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
9
  async function geneateFiles(name) {
10
10
  const removeTemplateSuffix = (filePath)=>{
@@ -19,17 +19,20 @@ async function generateTemplates(name) {
19
19
  const templateRootDir = join(__dirname, 'templates');
20
20
  const templateFiles = filesGenerator(templateRootDir);
21
21
  for await (const filePath of templateFiles){
22
- const templateFilePath = join(filePath, basename(filePath));
23
- const templateFileContent = await readTextFile(templateFilePath);
24
- const targetTemplateFilePath = relative(cwd(), templateFilePath).slice(0, -'.ejs'.length);
25
- await mkdir(dirname(targetTemplateFilePath), {
22
+ const templateFileContent = await readTextFile(filePath);
23
+ const relativeTemplateFilePath = relative(templateRootDir, filePath).slice(0, -'.ejs'.length);
24
+ const targetFilePath = join(name, relativeTemplateFilePath);
25
+ await mkdir(dirname(targetFilePath), {
26
26
  recursive: true
27
27
  });
28
+ const workspaceVersion = await getWorkspaceVersion();
28
29
  const renderedContent = ejs.render(templateFileContent, {
29
30
  ...names(name),
30
- email: `${name}@${name}.com`
31
+ email: `${name}@${name}.com`,
32
+ workspaceVersion
31
33
  });
32
- await writeTextFile(targetTemplateFilePath, renderedContent);
34
+ await writeTextFile(targetFilePath, renderedContent);
35
+ console.log(`[ Created ] ${relativeTemplateFilePath} `);
33
36
  }
34
37
  }
35
38
  /**
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/workspace/workspace.ts"],"sourcesContent":["import { copyFilesGenerator, filesGenerator, readTextFile, writeTextFile } from '@vnodes/fs';\nimport { Command } from 'commander';\nimport { basename, dirname, join, relative } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport ejs from 'ejs';\nimport { names } from '@nx/devkit';\nimport { mkdir } from 'node:fs/promises';\nimport { cwd } from 'node:process';\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(join(__dirname, 'files'), join(name), removeTemplateSuffix);\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 templateFilePath = join(filePath, basename(filePath));\n const templateFileContent = await readTextFile(templateFilePath);\n const targetTemplateFilePath = relative(cwd(), templateFilePath).slice(0, -'.ejs'.length);\n\n await mkdir(dirname(targetTemplateFilePath), { recursive: true });\n const renderedContent = ejs.render(templateFileContent, { ...names(name), email: `${name}@${name}.com` });\n await writeTextFile(targetTemplateFilePath, renderedContent);\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":["copyFilesGenerator","filesGenerator","readTextFile","writeTextFile","basename","dirname","join","relative","fileURLToPath","ejs","names","mkdir","cwd","__dirname","url","geneateFiles","name","removeTemplateSuffix","filePath","slice","length","copyFilesGeneartor","entry","console","log","generateTemplates","templateRootDir","templateFiles","templateFilePath","templateFileContent","targetTemplateFilePath","recursive","renderedContent","render","email","workspace","command","description","requiredOption","action"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,cAAc,EAAEC,YAAY,EAAEC,aAAa,QAAQ,aAAa;AAE7F,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,YAAY;AAC9D,SAASC,aAAa,QAAQ,WAAW;AACzC,OAAOC,SAAS,MAAM;AACtB,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,GAAG,QAAQ,eAAe;AAEnC,MAAMC,YAAYR,QAAQG,cAAc,YAAYM,GAAG;AAEvD,eAAeC,aAAaC,IAAY;IACtC,MAAMC,uBAAuB,CAACC;QAC5B,OAAOA,SAASC,KAAK,CAAC,GAAG,CAAC,YAAYC,MAAM;IAC9C;IACA,MAAMC,qBAAqBrB,mBAAmBM,KAAKO,WAAW,UAAUP,KAAKU,OAAOC;IAEpF,WAAW,MAAMK,SAASD,mBAAoB;QAC5CE,QAAQC,GAAG,CAAC,CAAC,YAAY,EAAEF,OAAO;IACpC;AACF;AAEA,eAAeG,kBAAkBT,IAAY;IAC3C,MAAMU,kBAAkBpB,KAAKO,WAAW;IACxC,MAAMc,gBAAgB1B,eAAeyB;IAErC,WAAW,MAAMR,YAAYS,cAAe;QAC1C,MAAMC,mBAAmBtB,KAAKY,UAAUd,SAASc;QACjD,MAAMW,sBAAsB,MAAM3B,aAAa0B;QAC/C,MAAME,yBAAyBvB,SAASK,OAAOgB,kBAAkBT,KAAK,CAAC,GAAG,CAAC,OAAOC,MAAM;QAExF,MAAMT,MAAMN,QAAQyB,yBAAyB;YAAEC,WAAW;QAAK;QAC/D,MAAMC,kBAAkBvB,IAAIwB,MAAM,CAACJ,qBAAqB;YAAE,GAAGnB,MAAMM,KAAK;YAAEkB,OAAO,GAAGlB,KAAK,CAAC,EAAEA,KAAK,IAAI,CAAC;QAAC;QACvG,MAAMb,cAAc2B,wBAAwBE;IAC9C;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASG,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"}
@@ -3,5 +3,5 @@ APP_ID=<%- fileName %>
3
3
  APP_DESC=- [ ] Add description
4
4
  API_PREFIX=api
5
5
  PORT=3000
6
- DB_URL=postgres://<%- orgName %>:password@localhost:5432/<%- orgName %>?schema=<%- fileName %>
7
- DB_SCHEMA=<%- fileName %>
6
+ DB_URL=postgres://<%- orgName %>:password@localhost:5432/<%- orgName %>?schema=<%- commonShortName %>
7
+ DB_SCHEMA=<%- commonShortName %>
@@ -1,4 +1,4 @@
1
1
  PROFILE=DEV
2
2
  DB_MIGRATIONS_PATH=../../tmp/prisma/migrations/<%- fileName %>
3
- DB_URL=postgres://<%- orgName %>:password@localhost:5432/<%- orgName %>?schema=<%- fileName %>
4
- DB_SCHEMA=<%- fileName %>
3
+ DB_URL=postgres://<%- orgName %>:password@localhost:5432/<%- orgName %>?schema=<%- commonShortName %>
4
+ DB_SCHEMA=<%- commonShortName %>
@@ -65,8 +65,7 @@
65
65
  "build": {},
66
66
  "prisma:migrate": {},
67
67
  "prisma:reset": {},
68
- "prisma:generate": {},
69
- "doc": {}
68
+ "prisma:generate": {}
70
69
  }
71
70
  },
72
71
  "dependencies": {
@@ -10,6 +10,7 @@ export type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {
10
10
  tag: string;
11
11
  workspaceVersion: string;
12
12
  databaseProjectName: string;
13
+ commonShortName: string;
13
14
  } & ReturnType<typeof names>;
14
15
  export declare function normalizeProjectSchema(options: ProjectGeneratorSchema): NormalizedProjectGeneratorOptions;
15
16
  export declare function projectGenerator(tree: Tree, options: ProjectGeneratorSchema): Promise<void>;
@@ -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;AAEtF,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAK9E,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;CAC7B,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAE7B,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,iCAAiC,CAmBzG;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,iBAqBjF;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"}
@@ -38,6 +38,8 @@ export function normalizeProjectSchema(options) {
38
38
  } else {
39
39
  n.databaseProjectName = n.projectName + '-db';
40
40
  }
41
+ n.commonShortName = n.shortName.replace(/-api$/, '').replace(/-db$/, '');
42
+ n.workspaceVersion ??= '0.1.11';
41
43
  return {
42
44
  ...n,
43
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 { type ProjectGeneratorSchema, type ProjectType } from './schema.d.js';\nimport { fileURLToPath } from 'node:url';\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} & ReturnType<typeof names>;\n\nexport function normalizeProjectSchema(options: ProjectGeneratorSchema): NormalizedProjectGeneratorOptions {\n const n = { ...options } as NormalizedProjectGeneratorOptions;\n\n const shortName = basename(options.directory);\n\n n.shortName = shortName;\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 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, { ...normalizedOptions });\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","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;AAEpD,SAASC,aAAa,QAAQ,WAAW;AAEzC,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;AAYA,OAAO,SAASG,uBAAuBC,OAA+B;IACpE,MAAMC,IAAI;QAAE,GAAGD,OAAO;IAAC;IAEvB,MAAMJ,YAAYV,SAASc,QAAQE,SAAS;IAE5CD,EAAEL,SAAS,GAAGA;IACdK,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;IAEA,OAAO;QAAE,GAAGJ,CAAC;QAAE,GAAGjB,MAAMY,UAAU;IAAC;AACrC;AAEA,OAAO,eAAec,iBAAiBC,IAAU,EAAEX,OAA+B;IAChF,MAAMY,oBAAoBb,uBAAuBC;IAEjDjB,cAAc4B,MAAMC,kBAAkBT,UAAU,EAAES,kBAAkBR,UAAU,EAAE;QAAE,GAAGQ,iBAAiB;IAAC;IAEvG7B,cAAc4B,MAAMvB,KAAKE,WAAW,WAAWsB,kBAAkBR,UAAU,EAAE;QAC3E,GAAGQ,iBAAiB;IACtB;IAEA3B,WAAW0B,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,EAAEhB,QAAQE,SAAS,EAAE;QAChC;QAEA,OAAOW;IACT;IACA,MAAM/B,YAAY6B;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.10",
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.10",
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.10"
93
+ "@vnodes/fs": "0.1.12"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@types/ejs": "^3.1.5"