@vnodes/cli 0.1.7 → 0.1.9

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 (125) hide show
  1. package/dist/cli/bye/bye.d.ts +12 -0
  2. package/dist/cli/bye/bye.d.ts.map +1 -0
  3. package/dist/cli/bye/bye.js +13 -0
  4. package/dist/cli/bye/bye.js.map +1 -0
  5. package/dist/cli/cli.js +5 -1
  6. package/dist/cli/cli.js.map +1 -1
  7. package/dist/cli/wd/wd.js +1 -1
  8. package/dist/cli/wd/wd.js.map +1 -1
  9. package/dist/cli/workspace/files/.eslint/allow-self-import.mjs.template +17 -0
  10. package/dist/cli/workspace/files/.eslint/common.mjs.template +22 -0
  11. package/dist/cli/workspace/files/.eslint/dependency-check.mjs.template +22 -0
  12. package/dist/cli/workspace/files/.eslint/eslint.base.mjs.template +8 -0
  13. package/dist/cli/workspace/files/.eslint/module-boundries.mjs.template +40 -0
  14. package/dist/cli/workspace/files/.eslint/no-undefined.mjs.template +16 -0
  15. package/dist/cli/workspace/files/.eslint/node-protocol.mjs.template +13 -0
  16. package/dist/cli/workspace/files/.eslint/plugin-check.mjs.template +11 -0
  17. package/dist/cli/workspace/files/.github/workflows/ci.yml.template +79 -0
  18. package/dist/cli/workspace/files/.gitignore.template +52 -0
  19. package/dist/cli/workspace/files/.husky/_/.gitignore.template +1 -0
  20. package/dist/cli/workspace/files/.husky/_/applypatch-msg.template +2 -0
  21. package/dist/cli/workspace/files/.husky/_/commit-msg.template +2 -0
  22. package/dist/cli/workspace/files/.husky/_/h.template +22 -0
  23. package/dist/cli/workspace/files/.husky/_/husky.sh.template +9 -0
  24. package/dist/cli/workspace/files/.husky/_/post-applypatch.template +2 -0
  25. package/dist/cli/workspace/files/.husky/_/post-checkout.template +2 -0
  26. package/dist/cli/workspace/files/.husky/_/post-commit.template +2 -0
  27. package/dist/cli/workspace/files/.husky/_/post-merge.template +2 -0
  28. package/dist/cli/workspace/files/.husky/_/post-rewrite.template +2 -0
  29. package/dist/cli/workspace/files/.husky/_/pre-applypatch.template +2 -0
  30. package/dist/cli/workspace/files/.husky/_/pre-auto-gc.template +2 -0
  31. package/dist/cli/workspace/files/.husky/_/pre-commit.template +2 -0
  32. package/dist/cli/workspace/files/.husky/_/pre-merge-commit.template +2 -0
  33. package/dist/cli/workspace/files/.husky/_/pre-push.template +2 -0
  34. package/dist/cli/workspace/files/.husky/_/pre-rebase.template +2 -0
  35. package/dist/cli/workspace/files/.husky/_/prepare-commit-msg.template +2 -0
  36. package/dist/cli/workspace/files/.husky/commit-msg.template +24 -0
  37. package/dist/cli/workspace/files/.husky/pre-commit.template +11 -0
  38. package/dist/cli/workspace/files/.prettierignore.template +5 -0
  39. package/dist/cli/workspace/files/.prettierrc.template +4 -0
  40. package/dist/cli/workspace/files/.verdaccio/config.yml.template +28 -0
  41. package/dist/cli/workspace/files/.vscode/_.code-snippets.template +8 -0
  42. package/dist/cli/workspace/files/.vscode/cli.code-snippets.template +25 -0
  43. package/dist/cli/workspace/files/.vscode/extensions.json.template +14 -0
  44. package/dist/cli/workspace/files/.vscode/nest.code-snippets.template +16 -0
  45. package/dist/cli/workspace/files/.vscode/settings.json.template +27 -0
  46. package/dist/cli/workspace/files/.vscode/ts.code-snippets.template +16 -0
  47. package/dist/cli/workspace/files/eslint.config.mjs.template +4 -0
  48. package/dist/cli/workspace/files/pnpm-workspace.yaml.template +13 -0
  49. package/dist/cli/workspace/files/tsconfig.json.template +5 -0
  50. package/dist/cli/workspace/files/vitest.workspace.ts.template +4 -0
  51. package/dist/cli/workspace/templates/README.md.ejs +34 -0
  52. package/dist/cli/workspace/templates/nx.json.ejs +127 -0
  53. package/dist/cli/workspace/templates/package.json.ejs +63 -0
  54. package/dist/cli/workspace/templates/project.json.ejs +14 -0
  55. package/dist/cli/workspace/templates/tsconfig.base.json.ejs +38 -0
  56. package/dist/cli/workspace/workspace.d.ts +12 -0
  57. package/dist/cli/workspace/workspace.d.ts.map +1 -0
  58. package/dist/cli/workspace/workspace.js +54 -0
  59. package/dist/cli/workspace/workspace.js.map +1 -0
  60. package/dist/generators/command/command.d.ts +5 -0
  61. package/dist/generators/command/command.d.ts.map +1 -0
  62. package/dist/generators/command/command.js +18 -0
  63. package/dist/generators/command/command.js.map +1 -0
  64. package/dist/generators/command/files/__fileName__.ts.template +17 -0
  65. package/dist/generators/command/schema.d.js +3 -0
  66. package/dist/generators/command/schema.d.js.map +1 -0
  67. package/dist/generators/command/schema.d.ts +3 -0
  68. package/dist/generators/command/schema.json +18 -0
  69. package/dist/generators/generator/files/__fileName__.ts.template +18 -0
  70. package/dist/generators/generator/files/files/__fileName__.json.template.template +3 -0
  71. package/dist/generators/generator/files/schema.d.ts.template +3 -0
  72. package/dist/generators/generator/files/schema.json.template +18 -0
  73. package/dist/generators/generator/generator.d.ts +5 -0
  74. package/dist/generators/generator/generator.d.ts.map +1 -0
  75. package/dist/generators/generator/generator.js +25 -0
  76. package/dist/generators/generator/generator.js.map +1 -0
  77. package/dist/generators/generator/schema.d.js +3 -0
  78. package/dist/generators/generator/schema.d.js.map +1 -0
  79. package/dist/generators/generator/schema.d.ts +3 -0
  80. package/dist/generators/generator/schema.json +18 -0
  81. package/dist/generators/hello/files/__fileName__.json.template +3 -0
  82. package/dist/generators/hello/hello.d.ts +5 -0
  83. package/dist/generators/hello/hello.d.ts.map +1 -0
  84. package/dist/generators/hello/hello.js +16 -0
  85. package/dist/generators/hello/hello.js.map +1 -0
  86. package/dist/generators/hello/schema.d.js +3 -0
  87. package/dist/generators/hello/schema.d.js.map +1 -0
  88. package/dist/generators/hello/schema.d.ts +3 -0
  89. package/dist/generators/hello/schema.json +18 -0
  90. package/dist/generators/project/cli/bin/__fileName__.mjs.template +3 -0
  91. package/dist/generators/project/cli/eslint.config.mjs.template +4 -0
  92. package/dist/generators/project/cli/generators.json.template +9 -0
  93. package/dist/generators/project/cli/package.json.template +96 -0
  94. package/dist/generators/project/cli/src/cli/cli.ts.template +11 -0
  95. package/dist/generators/project/cli/src/cli/hello/hello.ts.template +17 -0
  96. package/dist/generators/project/cli/src/generators/hello/files/hello.template.template +1 -0
  97. package/dist/generators/project/cli/src/generators/hello/hello.spec.ts.template +7 -0
  98. package/dist/generators/project/cli/src/generators/hello/hello.ts.template +19 -0
  99. package/dist/generators/project/cli/src/generators/hello/schema.d.ts.template +3 -0
  100. package/dist/generators/project/cli/src/generators/hello/schema.json.template +18 -0
  101. package/dist/generators/project/cli/src/index.ts.template +4 -0
  102. package/dist/generators/project/prisma/.env.template +4 -3
  103. package/dist/generators/project/prisma/package.json.template +4 -6
  104. package/dist/generators/project/prisma/prisma.config.ts.template +4 -3
  105. package/dist/generators/project/project.d.ts +1 -0
  106. package/dist/generators/project/project.d.ts.map +1 -1
  107. package/dist/generators/project/project.js +7 -7
  108. package/dist/generators/project/project.js.map +1 -1
  109. package/dist/generators/project/schema.json +2 -12
  110. package/dist/package.json +6 -2
  111. package/dist/peer-dependencies.d.ts +2 -0
  112. package/dist/peer-dependencies.d.ts.map +1 -0
  113. package/dist/peer-dependencies.js +3 -0
  114. package/dist/peer-dependencies.js.map +1 -0
  115. package/dist/utils/infer-project-configuration.d.ts +3 -0
  116. package/dist/utils/infer-project-configuration.d.ts.map +1 -0
  117. package/dist/utils/infer-project-configuration.js +13 -0
  118. package/dist/utils/infer-project-configuration.js.map +1 -0
  119. package/generators.json +16 -1
  120. package/package.json +6 -2
  121. package/dist/generators/project/api/.swcrc.template +0 -29
  122. package/dist/generators/project/api/prisma.config.ts.template +0 -12
  123. package/dist/generators/project/api/tsconfig.app.json.template +0 -14
  124. package/dist/generators/project/prisma/.npmignore.template +0 -1
  125. /package/dist/generators/project/{lib → common}/.swcrc.template +0 -0
@@ -0,0 +1,16 @@
1
+ import { formatFiles, generateFiles, names } from '@nx/devkit';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { basename, dirname, join } from 'node:path';
4
+ const __dirname = dirname(fileURLToPath(import.meta.url));
5
+ export async function helloGenerator(tree, options) {
6
+ const sourceRoot = join(__dirname, 'files');
7
+ const name = basename(options.directory);
8
+ const targetRoot = options.directory;
9
+ generateFiles(tree, sourceRoot, targetRoot, {
10
+ ...names(name)
11
+ });
12
+ await formatFiles(tree);
13
+ }
14
+ export default helloGenerator;
15
+
16
+ //# sourceMappingURL=hello.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/hello/hello.ts"],"sourcesContent":["import { formatFiles, generateFiles, names, type Tree } from '@nx/devkit';\n\nimport type { HelloGeneratorSchema } from './schema.js';\nimport { fileURLToPath } from 'node:url';\nimport { basename, dirname, join } from 'node:path';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async function helloGenerator(tree: Tree, options: HelloGeneratorSchema) {\n const sourceRoot = join(__dirname, 'files');\n\n const name = basename(options.directory);\n\n const targetRoot = options.directory;\n\n generateFiles(tree, sourceRoot, targetRoot, { ...names(name) });\n await formatFiles(tree);\n}\n\nexport default helloGenerator;\n"],"names":["formatFiles","generateFiles","names","fileURLToPath","basename","dirname","join","__dirname","url","helloGenerator","tree","options","sourceRoot","name","directory","targetRoot"],"mappings":"AAAA,SAASA,WAAW,EAAEC,aAAa,EAAEC,KAAK,QAAmB,aAAa;AAG1E,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAEpD,MAAMC,YAAYF,QAAQF,cAAc,YAAYK,GAAG;AAEvD,OAAO,eAAeC,eAAeC,IAAU,EAAEC,OAA6B;IAC5E,MAAMC,aAAaN,KAAKC,WAAW;IAEnC,MAAMM,OAAOT,SAASO,QAAQG,SAAS;IAEvC,MAAMC,aAAaJ,QAAQG,SAAS;IAEpCb,cAAcS,MAAME,YAAYG,YAAY;QAAE,GAAGb,MAAMW,KAAK;IAAC;IAC7D,MAAMb,YAAYU;AACpB;AAEA,eAAeD,eAAe"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=schema.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/hello/schema.d.ts"],"sourcesContent":["export interface HelloGeneratorSchema {\n directory: string;\n}\n"],"names":[],"mappings":"AAAA,WAEC"}
@@ -0,0 +1,3 @@
1
+ export interface HelloGeneratorSchema {
2
+ directory: string;
3
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "Hello",
4
+ "title": "Generate a hello file",
5
+ "type": "object",
6
+ "properties": {
7
+ "directory": {
8
+ "type": "string",
9
+ "description": "",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What directory would you like to use?"
15
+ }
16
+ },
17
+ "required": ["directory"]
18
+ }
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import '../dist/cli/cli.js';
@@ -0,0 +1,4 @@
1
+ import baseConfig from '../../eslint.config.mjs';
2
+ import pluginCheck from '../../.eslint/plugin-check.mjs';
3
+
4
+ export default [...baseConfig, ...pluginCheck];
@@ -0,0 +1,9 @@
1
+ {
2
+ "generators": {
3
+ "project": {
4
+ "factory": "./dist/generators/hello/hello.js",
5
+ "schema": "./dist/generators/hello/schema.json",
6
+ "description": "hello generator"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,96 @@
1
+ {
2
+
3
+ "name": "<%- projectName %>",
4
+ "description":"- [ ] Add project description",
5
+ "version": "<%- version %>",
6
+ "author": {
7
+ "email": "<%- email %>",
8
+ "name": "<%- authorName %>",
9
+ "url": "<%- homePageUrl %>"
10
+ },
11
+ "bugs": {
12
+ "email": "<%- email %>",
13
+ "url": "https://github.com/<%- orgName %>/<%- repoName %>/issues"
14
+ },
15
+ "homepage": "<%- homePageUrl %>/<%- directory %>",
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "tag": "latest"
19
+ },
20
+ "funding": [
21
+ "<%- fundingUrl %>"
22
+ ],
23
+ "bin":{
24
+ "<%- fileName %>":"./bin/<%- fileName %>.mjs"
25
+ },
26
+ "keywords": [
27
+ "nx",
28
+ "cli",
29
+ "plugin"
30
+ ],
31
+ "type": "module",
32
+ "main": "./dist/index.js",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ "./package.json": "./package.json",
37
+ ".": {
38
+ "@vnodes/source": "./dist/index.ts",
39
+ "types": "./dist/index.d.ts",
40
+ "import": "./dist/index.js",
41
+ "default": "./dist/index.js"
42
+ }
43
+ },
44
+ "files": [
45
+ "bin",
46
+ "assets",
47
+ "dist",
48
+ "generators.json"
49
+ ],
50
+ "nx": {
51
+ "sourceRoot": "plugins/cli/src",
52
+ "tags": [
53
+ "<%- tag %>"
54
+ ],
55
+ "targets": {
56
+ "build": {
57
+ "executor": "@nx/js:swc",
58
+ "outputs": [
59
+ "{options.outputPath}"
60
+ ],
61
+ "options": {
62
+ "clean": true,
63
+ "outputPath": "{projectRoot}/dist",
64
+ "main": "{projectRoot}/src/index.ts",
65
+ "tsConfig": "{projectRoot}/tsconfig.lib.json",
66
+ "skipTypeCheck": false,
67
+ "stripLeadingPaths": true,
68
+ "assets": [
69
+ {
70
+ "input": "{projectRoot}/src",
71
+ "glob": "**/!(*.ts)",
72
+ "output": "."
73
+ },
74
+ {
75
+ "input": "{projectRoot}/src",
76
+ "glob": "**/*.d.ts",
77
+ "output": "."
78
+ }
79
+ ]
80
+ }
81
+ },
82
+ "lint": {
83
+ "dependsOn": [
84
+ "build"
85
+ ]
86
+ },
87
+ "doc": {}
88
+ }
89
+ },
90
+ "dependencies": {
91
+ "@nx/devkit": "22.7.5",
92
+ "@swc/helpers": "~0.5.18",
93
+ "commander": "^15.0.0"
94
+ },
95
+ "generators": "./generators.json"
96
+ }
@@ -0,0 +1,11 @@
1
+ import { program } from 'commander';
2
+ import { hello } from './hello/hello.js';
3
+ program
4
+ .name('<%- fileName %>')
5
+ .description('<%- fileName %> description')
6
+ .version('0.1.0')
7
+ .showHelpAfterError(true);
8
+
9
+ [hello].map((c) => c(program));
10
+
11
+ program.parse();
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+
3
+ /**
4
+ * Say hello to the user
5
+ *
6
+ * ### Example
7
+ * ````sh
8
+ * vnodes hello --username YourName
9
+ * ````
10
+ * @param command main command instance
11
+ */
12
+ export function hello(command: Command) {
13
+ command
14
+ .command('hello')
15
+ .requiredOption('-u, --username <string>', 'What is your name')
16
+ .action(({ username }) => console.log(`Hello, ${username}`));
17
+ }
@@ -0,0 +1,7 @@
1
+
2
+
3
+ describe('hello generator', () => {
4
+
5
+ it('should work', ()=>expect(1).toEqual(1) )
6
+
7
+ });
@@ -0,0 +1,19 @@
1
+ import { formatFiles, generateFiles, names, type Tree } from '@nx/devkit';
2
+ import type { HelloGeneratorSchema } from './schema.js';
3
+ import { fileURLToPath } from 'url';
4
+ import { dirname, join } from 'path';
5
+
6
+ const __dirname = dirname(fileURLToPath(import.meta.url));
7
+
8
+ export async function helloGenerator(tree: Tree, options: HelloGeneratorSchema) {
9
+ const sourceRoot = join(__dirname, 'files');
10
+
11
+ const name = options.directory.split('/').pop();
12
+
13
+ if (!name) throw new Error(`Could not extract the name from directory ${options.directory}`);
14
+ const targetRoot = options.directory;
15
+ generateFiles(tree, sourceRoot, targetRoot, { ...names(name) });
16
+ await formatFiles(tree);
17
+ }
18
+
19
+ export default helloGenerator;
@@ -0,0 +1,3 @@
1
+ export interface HelloGeneratorSchema {
2
+ directory: string;
3
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "Hello",
4
+ "title": "Generate a hello file",
5
+ "type": "object",
6
+ "properties": {
7
+ "directory": {
8
+ "type": "string",
9
+ "description": "",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What directory would you like to use?"
15
+ }
16
+ },
17
+ "required": ["directory"]
18
+ }
@@ -0,0 +1,4 @@
1
+ // @index(['./generators/**/*.ts','./cli/*/**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)
2
+ export * from './cli/hello/hello.js';
3
+ export * from './generators/hello/hello.js';
4
+ export * from './generators/hello/schema.d.js';
@@ -1,3 +1,4 @@
1
- PROFILE=PROD
2
- DB_URL=postgres://vnodes:password@localhost:5432/vnodes?schema=test
3
- DB_SCHEMA=test
1
+ PROFILE=DEV
2
+ DB_MIGRATIONS_PATH=../../tmp/prisma/migrations/<%- fileName %>
3
+ DB_URL=postgres://<%- orgName %>:password@localhost:5432/<%- orgName %>?schema=<%- fileName %>
4
+ DB_SCHEMA=<%- fileName %>
@@ -29,7 +29,9 @@
29
29
  "files": [
30
30
  "bin",
31
31
  "dist",
32
- "assets"
32
+ "assets",
33
+ "prisma",
34
+ "prisma.config.ts"
33
35
  ],
34
36
  "type": "module",
35
37
  "main": "./dist/index.js",
@@ -60,11 +62,7 @@
60
62
  "<%- tag %>"
61
63
  ],
62
64
  "targets": {
63
- "build": {
64
- "dependsOn": [
65
- "prisma:generate"
66
- ]
67
- },
65
+ "build": {},
68
66
  "prisma:migrate": {},
69
67
  "prisma:reset": {},
70
68
  "prisma:generate": {},
@@ -1,12 +1,13 @@
1
1
  import 'dotenv/config';
2
2
  import { defineConfig } from 'prisma/config';
3
+ import { env } from '@vnodes/env';
3
4
 
4
5
  export default defineConfig({
5
- schema: 'prisma/schema.prisma',
6
+ schema: env.DB_PRISMA_SCHEMA_PATH_OR_DEFAULT,
6
7
  migrations: {
7
- path: 'prisma/migrations',
8
+ path: env.DB_MIGRATIONS_PATH_OR_DEFAULT,
8
9
  },
9
10
  datasource: {
10
- url: process.env['DB_URL']!,
11
+ url: env.DB_URL_OR_THROW,
11
12
  },
12
13
  });
@@ -1,6 +1,7 @@
1
1
  import { names, type Tree } from '@nx/devkit';
2
2
  import { type ProjectGeneratorSchema, type ProjectType } from './schema.d.js';
3
3
  export declare function autoTag(projectType: ProjectType): string;
4
+ export declare function brandEmail(orgName: string, shortName: string, email: string): string;
4
5
  export type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {
5
6
  projectName: string;
6
7
  shortName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/generators/project/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,KAAK,sBAAsB,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAK9E,wBAAgB,OAAO,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAaxD;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;CAC1B,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAE7B,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,GAC9B,iCAAiC,CAoBnC;AAED,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sBAAsB,iBA2BhC;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;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;CAC1B,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC;AAE7B,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,GAAG,iCAAiC,CAazG;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,iBAqBjF;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { formatFiles, generateFiles, names, updateJson } from '@nx/devkit';
2
- import { dirname, join } from 'node:path';
2
+ import { basename, dirname, join } from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  const __dirname = dirname(fileURLToPath(import.meta.url));
5
5
  export function autoTag(projectType) {
@@ -15,24 +15,24 @@ export function autoTag(projectType) {
15
15
  }
16
16
  case 'prisma':
17
17
  {
18
- return `lib:core`;
18
+ return `app:db`;
19
19
  }
20
20
  }
21
21
  }
22
+ export function brandEmail(orgName, shortName, email) {
23
+ return email.split('@').join(`+${orgName}-${shortName}@`);
24
+ }
22
25
  export function normalizeProjectSchema(options) {
23
26
  const normalizedOptions = {
24
27
  ...options
25
28
  };
26
- const shortName = options.directory.split('/').pop();
27
- if (typeof shortName !== 'string') {
28
- throw new Error(`Could not resolve the short name of the project form ${options.directory}`);
29
- }
29
+ const shortName = basename(options.directory);
30
30
  normalizedOptions.shortName = shortName;
31
31
  normalizedOptions.sourceRoot = join(__dirname, options.projectType);
32
32
  normalizedOptions.targetRoot = join(options.directory);
33
33
  normalizedOptions.projectName = `@${options.orgName}/${shortName}`;
34
34
  normalizedOptions.tag = autoTag(normalizedOptions.projectType);
35
- normalizedOptions.email = options.email.split('@').join(`+${options.orgName}-${shortName}@`);
35
+ normalizedOptions.email = brandEmail(options.orgName, shortName, options.email);
36
36
  return {
37
37
  ...normalizedOptions,
38
38
  ...names(shortName)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/generators/project/project.ts"],"sourcesContent":["import {\n formatFiles,\n generateFiles,\n names,\n updateJson,\n type Tree,\n} from '@nx/devkit';\nimport { 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 `lib:core`;\n }\n }\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} & ReturnType<typeof names>;\n\nexport function normalizeProjectSchema(\n options: ProjectGeneratorSchema,\n): NormalizedProjectGeneratorOptions {\n const normalizedOptions = { ...options } as NormalizedProjectGeneratorOptions;\n\n const shortName = options.directory.split('/').pop();\n\n if (typeof shortName !== 'string') {\n throw new Error(\n `Could not resolve the short name of the project form ${options.directory}`,\n );\n }\n normalizedOptions.shortName = shortName;\n normalizedOptions.sourceRoot = join(__dirname, options.projectType);\n normalizedOptions.targetRoot = join(options.directory);\n normalizedOptions.projectName = `@${options.orgName}/${shortName}`;\n normalizedOptions.tag = autoTag(normalizedOptions.projectType);\n normalizedOptions.email = options.email\n .split('@')\n .join(`+${options.orgName}-${shortName}@`);\n\n return { ...normalizedOptions, ...names(shortName) };\n}\n\nexport async function projectGenerator(\n tree: Tree,\n options: ProjectGeneratorSchema,\n) {\n const normalizedOptions = normalizeProjectSchema(options);\n\n generateFiles(\n tree,\n normalizedOptions.sourceRoot,\n 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","dirname","join","fileURLToPath","__dirname","url","autoTag","projectType","normalizeProjectSchema","options","normalizedOptions","shortName","directory","split","pop","Error","sourceRoot","targetRoot","projectName","orgName","tag","email","projectGenerator","tree","value","references","push","path"],"mappings":"AAAA,SACEA,WAAW,EACXC,aAAa,EACbC,KAAK,EACLC,UAAU,QAEL,aAAa;AACpB,SAASC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAE1C,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,QAAQ,CAAC;YACnB;IACF;AACF;AAWA,OAAO,SAASC,uBACdC,OAA+B;IAE/B,MAAMC,oBAAoB;QAAE,GAAGD,OAAO;IAAC;IAEvC,MAAME,YAAYF,QAAQG,SAAS,CAACC,KAAK,CAAC,KAAKC,GAAG;IAElD,IAAI,OAAOH,cAAc,UAAU;QACjC,MAAM,IAAII,MACR,CAAC,qDAAqD,EAAEN,QAAQG,SAAS,EAAE;IAE/E;IACAF,kBAAkBC,SAAS,GAAGA;IAC9BD,kBAAkBM,UAAU,GAAGd,KAAKE,WAAWK,QAAQF,WAAW;IAClEG,kBAAkBO,UAAU,GAAGf,KAAKO,QAAQG,SAAS;IACrDF,kBAAkBQ,WAAW,GAAG,CAAC,CAAC,EAAET,QAAQU,OAAO,CAAC,CAAC,EAAER,WAAW;IAClED,kBAAkBU,GAAG,GAAGd,QAAQI,kBAAkBH,WAAW;IAC7DG,kBAAkBW,KAAK,GAAGZ,QAAQY,KAAK,CACpCR,KAAK,CAAC,KACNX,IAAI,CAAC,CAAC,CAAC,EAAEO,QAAQU,OAAO,CAAC,CAAC,EAAER,UAAU,CAAC,CAAC;IAE3C,OAAO;QAAE,GAAGD,iBAAiB;QAAE,GAAGX,MAAMY,UAAU;IAAC;AACrD;AAEA,OAAO,eAAeW,iBACpBC,IAAU,EACVd,OAA+B;IAE/B,MAAMC,oBAAoBF,uBAAuBC;IAEjDX,cACEyB,MACAb,kBAAkBM,UAAU,EAC5BN,kBAAkBO,UAAU,EAC5B;QAAE,GAAGP,iBAAiB;IAAC;IAGzBZ,cAAcyB,MAAMrB,KAAKE,WAAW,WAAWM,kBAAkBO,UAAU,EAAE;QAC3E,GAAGP,iBAAiB;IACtB;IAEAV,WAAWuB,MAAM,iBAAiB,CAACC;QACjC,IAAI,CAACA,MAAMC,UAAU,EAAE;YACrBD,MAAMC,UAAU,GAAG,EAAE;QACvB;QAEAD,MAAMC,UAAU,CAACC,IAAI,CAAC;YACpBC,MAAM,CAAC,EAAE,EAAElB,QAAQG,SAAS,EAAE;QAChC;QAEA,OAAOY;IACT;IACA,MAAM3B,YAAY0B;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 { 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} & ReturnType<typeof names>;\n\nexport function normalizeProjectSchema(options: ProjectGeneratorSchema): NormalizedProjectGeneratorOptions {\n const normalizedOptions = { ...options } as NormalizedProjectGeneratorOptions;\n\n const shortName = basename(options.directory);\n\n normalizedOptions.shortName = shortName;\n normalizedOptions.sourceRoot = join(__dirname, options.projectType);\n normalizedOptions.targetRoot = join(options.directory);\n normalizedOptions.projectName = `@${options.orgName}/${shortName}`;\n normalizedOptions.tag = autoTag(normalizedOptions.projectType);\n normalizedOptions.email = brandEmail(options.orgName, shortName, options.email);\n\n return { ...normalizedOptions, ...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","normalizedOptions","directory","sourceRoot","targetRoot","projectName","tag","projectGenerator","tree","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;AAWA,OAAO,SAASG,uBAAuBC,OAA+B;IACpE,MAAMC,oBAAoB;QAAE,GAAGD,OAAO;IAAC;IAEvC,MAAMJ,YAAYV,SAASc,QAAQE,SAAS;IAE5CD,kBAAkBL,SAAS,GAAGA;IAC9BK,kBAAkBE,UAAU,GAAGf,KAAKE,WAAWU,QAAQP,WAAW;IAClEQ,kBAAkBG,UAAU,GAAGhB,KAAKY,QAAQE,SAAS;IACrDD,kBAAkBI,WAAW,GAAG,CAAC,CAAC,EAAEL,QAAQL,OAAO,CAAC,CAAC,EAAEC,WAAW;IAClEK,kBAAkBK,GAAG,GAAGd,QAAQS,kBAAkBR,WAAW;IAC7DQ,kBAAkBJ,KAAK,GAAGH,WAAWM,QAAQL,OAAO,EAAEC,WAAWI,QAAQH,KAAK;IAE9E,OAAO;QAAE,GAAGI,iBAAiB;QAAE,GAAGjB,MAAMY,UAAU;IAAC;AACrD;AAEA,OAAO,eAAeW,iBAAiBC,IAAU,EAAER,OAA+B;IAChF,MAAMC,oBAAoBF,uBAAuBC;IAEjDjB,cAAcyB,MAAMP,kBAAkBE,UAAU,EAAEF,kBAAkBG,UAAU,EAAE;QAAE,GAAGH,iBAAiB;IAAC;IAEvGlB,cAAcyB,MAAMpB,KAAKE,WAAW,WAAWW,kBAAkBG,UAAU,EAAE;QAC3E,GAAGH,iBAAiB;IACtB;IAEAhB,WAAWuB,MAAM,iBAAiB,CAACC;QACjC,IAAI,CAACA,MAAMC,UAAU,EAAE;YACrBD,MAAMC,UAAU,GAAG,EAAE;QACvB;QAEAD,MAAMC,UAAU,CAACC,IAAI,CAAC;YACpBC,MAAM,CAAC,EAAE,EAAEZ,QAAQE,SAAS,EAAE;QAChC;QAEA,OAAOO;IACT;IACA,MAAM3B,YAAY0B;AACpB;AAEA,eAAeD,iBAAiB"}
@@ -16,7 +16,7 @@
16
16
  "projectType": {
17
17
  "type": "string",
18
18
  "description": "Project projectType",
19
- "enum": ["lib", "api", "prisma"],
19
+ "enum": ["lib", "api", "prisma", "cli"],
20
20
  "$default": {
21
21
  "$source": "argv",
22
22
  "index": 1
@@ -87,15 +87,5 @@
87
87
  "x-prompt": "What is the current version of vnodes packages?"
88
88
  }
89
89
  },
90
- "required": [
91
- "directory",
92
- "projectType",
93
- "orgName",
94
- "repoName",
95
- "homePageUrl",
96
- "email",
97
- "fundingUrl",
98
- "authorName",
99
- "workspaceVersion"
100
- ]
90
+ "required": ["directory", "projectType", "orgName", "repoName", "homePageUrl", "email", "fundingUrl", "authorName", "workspaceVersion"]
101
91
  }
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.7",
4
+ "version": "0.1.9",
5
5
  "author": {
6
6
  "email": "robert.brightline+vnodes-prisma@gmail.com",
7
7
  "name": "Robert Brightline",
@@ -89,7 +89,11 @@
89
89
  "@nx/devkit": "22.7.5",
90
90
  "@swc/helpers": "~0.5.18",
91
91
  "@vnodes/fs": "workspace:*",
92
- "commander": "^15.0.0"
92
+ "commander": "^15.0.0",
93
+ "ejs": "^6.0.1"
94
+ },
95
+ "devDependencies": {
96
+ "@types/ejs": "^3.1.5"
93
97
  },
94
98
  "generators": "./generators.json"
95
99
  }
@@ -0,0 +1,2 @@
1
+ import 'ejs';
2
+ //# sourceMappingURL=peer-dependencies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"peer-dependencies.d.ts","sourceRoot":"","sources":["../src/peer-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ import 'ejs';
2
+
3
+ //# sourceMappingURL=peer-dependencies.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/peer-dependencies.ts"],"sourcesContent":["import 'ejs';\n"],"names":[],"mappings":"AAAA,OAAO,MAAM"}
@@ -0,0 +1,3 @@
1
+ import { type ProjectConfiguration, type Tree } from '@nx/devkit';
2
+ export declare function inferProjectConfiguration(tree: Tree): ProjectConfiguration;
3
+ //# sourceMappingURL=infer-project-configuration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"infer-project-configuration.d.ts","sourceRoot":"","sources":["../../src/utils/infer-project-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,oBAAoB,EAAE,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE/E,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,GAAG,oBAAoB,CAW1E"}
@@ -0,0 +1,13 @@
1
+ import { getProjects } from '@nx/devkit';
2
+ export function inferProjectConfiguration(tree) {
3
+ const cwd = process.cwd();
4
+ const projects = getProjects(tree);
5
+ for (const p of projects.values()){
6
+ if (cwd.includes(p.root)) {
7
+ return p;
8
+ }
9
+ }
10
+ throw new Error(`Project not found`);
11
+ }
12
+
13
+ //# sourceMappingURL=infer-project-configuration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/infer-project-configuration.ts"],"sourcesContent":["import { getProjects, type ProjectConfiguration, type Tree } from '@nx/devkit';\n\nexport function inferProjectConfiguration(tree: Tree): ProjectConfiguration {\n const cwd = process.cwd();\n\n const projects = getProjects(tree);\n\n for (const p of projects.values()) {\n if (cwd.includes(p.root)) {\n return p;\n }\n }\n throw new Error(`Project not found`);\n}\n"],"names":["getProjects","inferProjectConfiguration","tree","cwd","process","projects","p","values","includes","root","Error"],"mappings":"AAAA,SAASA,WAAW,QAA8C,aAAa;AAE/E,OAAO,SAASC,0BAA0BC,IAAU;IAClD,MAAMC,MAAMC,QAAQD,GAAG;IAEvB,MAAME,WAAWL,YAAYE;IAE7B,KAAK,MAAMI,KAAKD,SAASE,MAAM,GAAI;QACjC,IAAIJ,IAAIK,QAAQ,CAACF,EAAEG,IAAI,GAAG;YACxB,OAAOH;QACT;IACF;IACA,MAAM,IAAII,MAAM,CAAC,iBAAiB,CAAC;AACrC"}
package/generators.json CHANGED
@@ -4,6 +4,21 @@
4
4
  "factory": "./dist/generators/project/project.js",
5
5
  "schema": "./dist/generators/project/schema.json",
6
6
  "description": "project generator"
7
+ },
8
+ "hello": {
9
+ "factory": "./dist/generators/hello/hello.js",
10
+ "schema": "./dist/generators/hello/schema.json",
11
+ "description": "hello generator"
12
+ },
13
+ "generator": {
14
+ "factory": "./dist/generators/generator/generator.js",
15
+ "schema": "./dist/generators/generator/schema.json",
16
+ "description": "generator generator"
17
+ },
18
+ "command": {
19
+ "factory": "./dist/generators/command/command.js",
20
+ "schema": "./dist/generators/command/schema.json",
21
+ "description": "command generator"
7
22
  }
8
23
  }
9
- }
24
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vnodes/cli",
3
3
  "description": "Vnodes cli",
4
- "version": "0.1.7",
4
+ "version": "0.1.9",
5
5
  "author": {
6
6
  "email": "robert.brightline+vnodes-prisma@gmail.com",
7
7
  "name": "Robert Brightline",
@@ -89,7 +89,11 @@
89
89
  "@nx/devkit": "22.7.5",
90
90
  "@swc/helpers": "~0.5.18",
91
91
  "commander": "^15.0.0",
92
- "@vnodes/fs": "0.1.7"
92
+ "ejs": "^6.0.1",
93
+ "@vnodes/fs": "0.1.9"
94
+ },
95
+ "devDependencies": {
96
+ "@types/ejs": "^3.1.5"
93
97
  },
94
98
  "generators": "./generators.json"
95
99
  }
@@ -1,29 +0,0 @@
1
- {
2
- "jsc": {
3
- "target": "es2022",
4
- "parser": {
5
- "syntax": "typescript",
6
- "decorators": true,
7
- "dynamicImport": true
8
- },
9
- "transform": {
10
- "decoratorMetadata": true,
11
- "legacyDecorator": true,
12
- "verbatimModuleSyntax": true
13
- },
14
- "keepClassNames": true,
15
- "externalHelpers": true,
16
- "loose": false,
17
- "preserveAllComments": true,
18
- "paths": {}
19
- },
20
- "module": {
21
- "type": "nodenext",
22
- "strict": true,
23
- "strictMode": true
24
- },
25
- "sourceMaps": true,
26
- "exclude": [
27
- ".*\\.spec\\.ts$"
28
- ]
29
- }
@@ -1,12 +0,0 @@
1
- import 'dotenv/config';
2
- import { defineConfig } from 'prisma/config';
3
-
4
- export default defineConfig({
5
- schema: 'prisma/schema.prisma',
6
- migrations: {
7
- path: 'prisma/migrations',
8
- },
9
- datasource: {
10
- url: process.env['DB_URL']!,
11
- },
12
- });
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.base.json",
3
- "compilerOptions": {
4
- "rootDir": "src",
5
- "outDir": "dist",
6
- "emitDeclarationOnly": false
7
- },
8
- "include": [
9
- "src/**/*.ts"
10
- ],
11
- "exclude": [
12
- "src/**/*.spec.ts"
13
- ]
14
- }
@@ -1 +0,0 @@
1
- dist/package.json