@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
+ {
2
+ "enum": {
3
+ "prefix": "enum",
4
+ "body": [
5
+ "export const $1 = { } as const;",
6
+ "export type $1 = keyof typeof $1;",
7
+ "export const $1s = Object.keys($1) as Readonly<$1[]>;",
8
+ ],
9
+ "scope": "typescript"
10
+ },
11
+ "_dirname": {
12
+ "prefix": "_dirname",
13
+ "body": "const __dirname = dirname(fileURLToPath(import.meta.url));",
14
+ "scope": "typescript"
15
+ }
16
+ }
@@ -0,0 +1,4 @@
1
+ import nx from '@nx/eslint-plugin';
2
+ import eslintBase from './.eslint/eslint.base.mjs';
3
+
4
+ export default [...eslintBase];
@@ -0,0 +1,13 @@
1
+ packages:
2
+ - 'packages/*'
3
+ - 'plugins/*'
4
+ - 'apis/*'
5
+ allowBuilds:
6
+ '@prisma/engines': true
7
+ '@scarf/scarf': true
8
+ '@swc/core': true
9
+ esbuild: true
10
+ nx: true
11
+ prisma: true
12
+ unrs-resolver: true
13
+ autoInstallPeers: true
@@ -0,0 +1,5 @@
1
+ {
2
+ "extends": "./tsconfig.base.json",
3
+ "compileOnSave": false,
4
+ "references": []
5
+ }
@@ -0,0 +1,4 @@
1
+ export default [
2
+ '**/vite.config.{mjs,js,ts,mts}',
3
+ '**/vitest.config.{mjs,js,ts,mts}',
4
+ ];
@@ -0,0 +1,34 @@
1
+ ![Npm version](https://img.shields.io/npm/v/@<%- fileName %>/source)
2
+ ![Npm downloads](https://img.shields.io/npm/dm/@<%- fileName %>/source)
3
+ ![Build Status](https://img.shields.io/github/actions/workflow/status/<%- fileName %>/<%- fileName %>/ci.yml)
4
+ ![Bundle size](https://img.shields.io/bundlephobia/min/@<%- fileName %>/source)
5
+
6
+ <p align="center">
7
+ <img srcset="./assets/favicon.png, https://<%- fileName %>.github.io/favicon.png" alt="Logo" width="200" height="200" style="border-radius: 100%"/>
8
+ </p>
9
+
10
+ ## @<%- fileName %>/source
11
+
12
+ - [ ] Add project description for @<%- fileName %>/source
13
+
14
+ ## Installation
15
+
16
+ ```bash
17
+ pnpm add -D @<%- fileName %>/source
18
+ ```
19
+
20
+ ## 💖 Support My Work
21
+
22
+ If you find my open-source contributions or the **@<%- fileName %>/source** project helpful, consider supporting my work. Your sponsorship helps me maintain these projects and explore new enterprise patterns.
23
+
24
+ [![CashApp](https://img.shields.io/badge/Sponsor%20me-%23EA4AAA.svg?style=for-the-badge&logo=github-sponsors&logoColor=white)](<https://cash.app/$puqlib>)
25
+
26
+ ---
27
+
28
+ ## 🤝 Connect with Me
29
+
30
+ <p align="left">
31
+ <a href="mailto:<%- email %>">
32
+ <img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white" />
33
+ </a>
34
+ </p>
@@ -0,0 +1,127 @@
1
+ {
2
+ "$schema": "./node_modules/nx/schemas/nx-schema.json",
3
+ "analytics": false,
4
+ "namedInputs": {
5
+ "default": ["{projectRoot}/**/*", "sharedGlobals"],
6
+ "production": [
7
+ "default",
8
+ "!{projectRoot}/.eslintrc.json",
9
+ "!{projectRoot}/eslint.config.mjs",
10
+ "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)",
11
+ "!{projectRoot}/tsconfig.spec.json"
12
+ ],
13
+ "sharedGlobals": ["{workspaceRoot}/.github/workflows/ci.yml"]
14
+ },
15
+ "plugins": [
16
+ {
17
+ "plugin": "@nx/eslint/plugin",
18
+ "options": {
19
+ "targetName": "lint"
20
+ }
21
+ },
22
+ {
23
+ "plugin": "@nx/vitest",
24
+ "options": {
25
+ "testTargetName": "test",
26
+ "ciTargetName": "test-ci",
27
+ "testMode": "watch"
28
+ }
29
+ }
30
+ ],
31
+ "generators": {
32
+ "@nx/js:library": {
33
+ "bundler": "swc",
34
+ "unitTestRunner": "vitest",
35
+ "linter": "eslint",
36
+ "publishable": true,
37
+ "strict": true,
38
+ "skipTypeCheck": false,
39
+ "tags": "lib:shared"
40
+ },
41
+ "@vnodes/cli:project": {
42
+ "funding": "https://cash.app/$puqlib",
43
+ "authorName": "Robert Brightline",
44
+ "orgName": "<%- fileName %>",
45
+ "repoName": "<%- fileName %>",
46
+ "email": "robert.brightline@gmail.com",
47
+ "homePageUrl": "https://<%- fileName %>.github.io",
48
+ "fundingUrl": "https://cash.app/$puqlib",
49
+ "version": "0.0.1",
50
+ "workspaceVersion": "workspace:*"
51
+ },
52
+ "@nx/plugin:plugin": {
53
+ "compiler": "swc",
54
+ "unitTestRunner": "vitest",
55
+ "linter": "eslint",
56
+ "publishable": true,
57
+ "strict": true,
58
+ "skipTypeCheck": false,
59
+ "tags": "app:cli"
60
+ }
61
+ },
62
+ "targetDefaults": {
63
+ "@nx/js:swc": {
64
+ "cache": true,
65
+ "inputs": ["production", "^production"]
66
+ },
67
+ "test": {
68
+ "inputs": ["default", "^default"]
69
+ },
70
+ "build": {
71
+ "executor": "@nx/js:swc",
72
+ "cache": true,
73
+ "dependsOn": ["^build"],
74
+ "inputs": ["production", "^production"],
75
+ "outputs": ["{options.outputPath}"],
76
+ "options": {
77
+ "outputPath": "{projectRoot}/dist",
78
+ "main": "{projectRoot}/src/main.ts",
79
+ "tsConfig": "{projectRoot}/tsconfig.lib.json",
80
+ "skipTypeCheck": false,
81
+ "stripLeadingPaths": true
82
+ }
83
+ },
84
+ "serve": {
85
+ "executor": "@nx/js:node",
86
+ "options": {
87
+ "buildTarget": "build",
88
+ "watch": true
89
+ }
90
+ },
91
+ "prisma:migrate": {
92
+ "executor": "nx:run-commands",
93
+ "inputs": ["default"],
94
+ "options": {
95
+ "command": "pnpm prisma migrate dev --name updated",
96
+ "cwd": "{projectRoot}"
97
+ }
98
+ },
99
+ "prisma:reset": {
100
+ "executor": "nx:run-commands",
101
+ "inputs": ["default"],
102
+ "options": {
103
+ "command": "pnpm prisma migrate reset -f",
104
+ "cwd": "{projectRoot}"
105
+ }
106
+ },
107
+ "prisma:generate": {
108
+ "executor": "nx:run-commands",
109
+ "inputs": ["default"],
110
+ "options": {
111
+ "command": "pnpm prisma generate",
112
+ "cwd": "{projectRoot}"
113
+ }
114
+ },
115
+ "doc": {
116
+ "executor": "nx:run-commands",
117
+
118
+ "inputs": ["^default"],
119
+ "options": {
120
+ "command": "pnpm typedoc --entryPoints {projectRoot}/src/index.ts --out public/{projectRoot} --tsconfig {projectRoot}/tsconfig.lib.json --skipErrorChecking true"
121
+ }
122
+ }
123
+ },
124
+ "release": {
125
+ "projects": ["tag:lib:*", "tag:app:cli"]
126
+ }
127
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@<%- fileName %>/source",
3
+ "version": "0.0.0",
4
+ "license": "MIT",
5
+ "scripts": {
6
+ "prepare": "husky"
7
+ },
8
+ "private": true,
9
+ "nx": {
10
+ "includedScripts": [],
11
+ "targets": {
12
+ "local-registry": {
13
+ "executor": "@nx/js:verdaccio",
14
+ "options": {
15
+ "port": 4873,
16
+ "config": ".verdaccio/config.yml",
17
+ "storage": "tmp/local-registry/storage"
18
+ }
19
+ }
20
+ }
21
+ },
22
+ "devDependencies": {
23
+ "@eslint/js": "^9.8.0",
24
+ "@nx/esbuild": "22.7.5",
25
+ "@nx/eslint": "22.7.5",
26
+ "@nx/eslint-plugin": "22.7.5",
27
+ "@nx/js": "22.7.5",
28
+ "@nx/node": "^22.7.5",
29
+ "@nx/plugin": "^22.7.5",
30
+ "@nx/vite": "22.7.5",
31
+ "@nx/vitest": "22.7.5",
32
+ "@swc-node/register": "~1.11.1",
33
+ "@swc/cli": "~0.8.0",
34
+ "@swc/core": "~1.15.5",
35
+ "@swc/helpers": "~0.5.18",
36
+ "@types/node": "20.19.9",
37
+ "@vitest/coverage-v8": "~4.1.0",
38
+ "@vnodes/cli": "0.1.20",
39
+ "@vnodes/fs": "0.1.20",
40
+ "chokidar": "^5.0.0",
41
+ "dotenv": "^17.4.2",
42
+ "esbuild": "^0.27.0",
43
+ "eslint": "^9.8.0",
44
+ "eslint-config-prettier": "^10.0.0",
45
+ "eslint-plugin-unicorn": "^66.0.0",
46
+ "husky": "^9.1.7",
47
+ "jsdom": "^27.1.0",
48
+ "jsonc-eslint-parser": "^2.1.0",
49
+ "nx": "22.7.5",
50
+ "prettier": "~3.6.2",
51
+ "prisma": "^7.8.0",
52
+ "tslib": "^2.3.0",
53
+ "typedoc": "^0.28.19",
54
+ "typescript": "~5.9.2",
55
+ "typescript-eslint": "^8.40.0",
56
+ "verdaccio": "^6.3.2",
57
+ "vite": "^8.0.0",
58
+ "vitest": "~4.1.0"
59
+ },
60
+ "dependencies": {
61
+ "@nx/devkit": "22.7.5"
62
+ }
63
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@<%- fileName %>/source",
3
+ "$schema": "node_modules/nx/schemas/project-schema.json",
4
+ "targets": {
5
+ "local-registry": {
6
+ "executor": "@nx/js:verdaccio",
7
+ "options": {
8
+ "port": 4873,
9
+ "config": ".verdaccio/config.yml",
10
+ "storage": "tmp/local-registry/storage"
11
+ }
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "compilerOptions": {
3
+ "composite": true,
4
+ "emitDeclarationOnly": true,
5
+ "forceConsistentCasingInFileNames": true,
6
+ "declarationMap": true,
7
+ "importHelpers": true,
8
+ "isolatedModules": false,
9
+ "allowUnusedLabels": true,
10
+ "lib": [
11
+ "ES2022"
12
+ ],
13
+ "types": [
14
+ "node"
15
+ ],
16
+ "module": "nodenext",
17
+ "moduleResolution": "nodenext",
18
+ "exactOptionalPropertyTypes": true,
19
+ "experimentalDecorators": true,
20
+ "emitDecoratorMetadata": true,
21
+ "noUnusedParameters": false,
22
+ "noUnusedLocals": true,
23
+ "verbatimModuleSyntax": true,
24
+ "noEmitOnError": true,
25
+ "noFallthroughCasesInSwitch": true,
26
+ "noImplicitOverride": true,
27
+ "noImplicitReturns": true,
28
+ "skipLibCheck": true,
29
+ "strict": true,
30
+ "strictFunctionTypes": true,
31
+ "strictPropertyInitialization": false,
32
+ "strictNullChecks": true,
33
+ "target": "es2022",
34
+ "customConditions": [
35
+ "@<%- fileName %>/source"
36
+ ]
37
+ }
38
+ }
@@ -0,0 +1,12 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Say workspace
4
+ *
5
+ * ### Example
6
+ * ````sh
7
+ * vnodes workspace --username YourName
8
+ * ````
9
+ * @param command main command instance
10
+ */
11
+ export declare function workspace(command: Command): void;
12
+ //# sourceMappingURL=workspace.d.ts.map
@@ -0,0 +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;AAiCpC;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,OAAO,QASzC"}
@@ -0,0 +1,54 @@
1
+ import { copyFiles } from '@vnodes/fs';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { readdir } from 'node:fs/promises';
5
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
6
+ import ejs from 'ejs';
7
+ import { names } from '@nx/devkit';
8
+ const __dirname = dirname(fileURLToPath(import.meta.url));
9
+ async function geneateFiles(name) {
10
+ await copyFiles(join(__dirname, 'files'), join(name), (filePath)=>{
11
+ return filePath.slice(0, -'.template'.length);
12
+ });
13
+ }
14
+ async function generateTemplates(name) {
15
+ const templateRootDir = join(__dirname, 'templates');
16
+ const templateFiles = await readdir(templateRootDir, {
17
+ recursive: true,
18
+ withFileTypes: true
19
+ });
20
+ for (const t of templateFiles){
21
+ if (!t.isFile()) continue;
22
+ const templateFilePath = join(t.parentPath, t.name);
23
+ const templateFileContent = readFileSync(templateFilePath, {
24
+ encoding: 'utf-8'
25
+ });
26
+ const targetTemplateFilePath = join('./', name, templateFilePath.replace(templateRootDir, '')).slice(0, -'.ejs'.length);
27
+ mkdirSync(dirname(targetTemplateFilePath), {
28
+ recursive: true
29
+ });
30
+ const renderedContent = ejs.render(templateFileContent, {
31
+ ...names(name),
32
+ email: `${name}@${name}.com`
33
+ });
34
+ writeFileSync(targetTemplateFilePath, renderedContent, {
35
+ encoding: 'utf-8'
36
+ });
37
+ }
38
+ }
39
+ /**
40
+ * Say workspace
41
+ *
42
+ * ### Example
43
+ * ````sh
44
+ * vnodes workspace --username YourName
45
+ * ````
46
+ * @param command main command instance
47
+ */ export function workspace(command) {
48
+ command.command('workspace').description('Generate a nx workspace').requiredOption('-n, --name <string>', 'Project name').action(async ({ name })=>{
49
+ await geneateFiles(name);
50
+ await generateTemplates(name);
51
+ });
52
+ }
53
+
54
+ //# sourceMappingURL=workspace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/cli/workspace/workspace.ts"],"sourcesContent":["import { copyFiles } from '@vnodes/fs';\nimport { Command } from 'commander';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { readdir } from 'node:fs/promises';\nimport { mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport ejs from 'ejs';\nimport { names } from '@nx/devkit';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nasync function geneateFiles(name: string) {\n await copyFiles(join(__dirname, 'files'), join(name), (filePath: string) => {\n return filePath.slice(0, -'.template'.length);\n });\n}\n\nasync function generateTemplates(name: string) {\n const templateRootDir = join(__dirname, 'templates');\n const templateFiles = await readdir(templateRootDir, { recursive: true, withFileTypes: true });\n\n for (const t of templateFiles) {\n if (!t.isFile()) continue;\n\n const templateFilePath = join(t.parentPath, t.name);\n const templateFileContent = readFileSync(templateFilePath, { encoding: 'utf-8' });\n const targetTemplateFilePath = join('./', name, templateFilePath.replace(templateRootDir, '')).slice(0, -'.ejs'.length);\n\n mkdirSync(dirname(targetTemplateFilePath), { recursive: true });\n const renderedContent = ejs.render(templateFileContent, { ...names(name), email: `${name}@${name}.com` });\n writeFileSync(targetTemplateFilePath, renderedContent, { encoding: 'utf-8' });\n }\n}\n\n/**\n * Say workspace\n *\n * ### Example\n * ````sh\n * vnodes workspace --username YourName\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":["copyFiles","dirname","join","fileURLToPath","readdir","mkdirSync","readFileSync","writeFileSync","ejs","names","__dirname","url","geneateFiles","name","filePath","slice","length","generateTemplates","templateRootDir","templateFiles","recursive","withFileTypes","t","isFile","templateFilePath","parentPath","templateFileContent","encoding","targetTemplateFilePath","replace","renderedContent","render","email","workspace","command","description","requiredOption","action"],"mappings":"AAAA,SAASA,SAAS,QAAQ,aAAa;AAEvC,SAASC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAC1C,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,OAAO,QAAQ,mBAAmB;AAC3C,SAASC,SAAS,EAAEC,YAAY,EAAEC,aAAa,QAAQ,UAAU;AACjE,OAAOC,SAAS,MAAM;AACtB,SAASC,KAAK,QAAQ,aAAa;AAEnC,MAAMC,YAAYT,QAAQE,cAAc,YAAYQ,GAAG;AAEvD,eAAeC,aAAaC,IAAY;IACtC,MAAMb,UAAUE,KAAKQ,WAAW,UAAUR,KAAKW,OAAO,CAACC;QACrD,OAAOA,SAASC,KAAK,CAAC,GAAG,CAAC,YAAYC,MAAM;IAC9C;AACF;AAEA,eAAeC,kBAAkBJ,IAAY;IAC3C,MAAMK,kBAAkBhB,KAAKQ,WAAW;IACxC,MAAMS,gBAAgB,MAAMf,QAAQc,iBAAiB;QAAEE,WAAW;QAAMC,eAAe;IAAK;IAE5F,KAAK,MAAMC,KAAKH,cAAe;QAC7B,IAAI,CAACG,EAAEC,MAAM,IAAI;QAEjB,MAAMC,mBAAmBtB,KAAKoB,EAAEG,UAAU,EAAEH,EAAET,IAAI;QAClD,MAAMa,sBAAsBpB,aAAakB,kBAAkB;YAAEG,UAAU;QAAQ;QAC/E,MAAMC,yBAAyB1B,KAAK,MAAMW,MAAMW,iBAAiBK,OAAO,CAACX,iBAAiB,KAAKH,KAAK,CAAC,GAAG,CAAC,OAAOC,MAAM;QAEtHX,UAAUJ,QAAQ2B,yBAAyB;YAAER,WAAW;QAAK;QAC7D,MAAMU,kBAAkBtB,IAAIuB,MAAM,CAACL,qBAAqB;YAAE,GAAGjB,MAAMI,KAAK;YAAEmB,OAAO,GAAGnB,KAAK,CAAC,EAAEA,KAAK,IAAI,CAAC;QAAC;QACvGN,cAAcqB,wBAAwBE,iBAAiB;YAAEH,UAAU;QAAQ;IAC7E;AACF;AAEA;;;;;;;;CAQC,GACD,OAAO,SAASM,UAAUC,OAAgB;IACxCA,QACGA,OAAO,CAAC,aACRC,WAAW,CAAC,2BACZC,cAAc,CAAC,uBAAuB,gBACtCC,MAAM,CAAC,OAAO,EAAExB,IAAI,EAAE;QACrB,MAAMD,aAAaC;QACnB,MAAMI,kBAAkBJ;IAC1B;AACJ"}
@@ -0,0 +1,5 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { CommandGeneratorSchema } from './schema.js';
3
+ export declare function commandGenerator(tree: Tree, options: CommandGeneratorSchema): Promise<void>;
4
+ export default commandGenerator;
5
+ //# sourceMappingURL=command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../../src/generators/command/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAO1D,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,iBAQjF;AAED,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { formatFiles, generateFiles, names } from '@nx/devkit';
2
+ import { fileURLToPath } from 'node:url';
3
+ import { dirname, join } from 'node:path';
4
+ import { inferProjectConfiguration } from '../../utils/infer-project-configuration.js';
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ export async function commandGenerator(tree, options) {
7
+ const sourceRoot = join(__dirname, 'files');
8
+ const projectConfig = inferProjectConfiguration(tree);
9
+ const projectRoot = projectConfig.root;
10
+ const targetRoot = `${projectRoot}/src/cli/${options.name}`;
11
+ generateFiles(tree, sourceRoot, targetRoot, {
12
+ ...names(options.name)
13
+ });
14
+ await formatFiles(tree);
15
+ }
16
+ export default commandGenerator;
17
+
18
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/command/command.ts"],"sourcesContent":["import { formatFiles, generateFiles, names, type Tree } from '@nx/devkit';\n\nimport type { CommandGeneratorSchema } from './schema.js';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, join } from 'node:path';\nimport { inferProjectConfiguration } from '../../utils/infer-project-configuration.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async function commandGenerator(tree: Tree, options: CommandGeneratorSchema) {\n const sourceRoot = join(__dirname, 'files');\n const projectConfig = inferProjectConfiguration(tree);\n const projectRoot = projectConfig.root;\n const targetRoot = `${projectRoot}/src/cli/${options.name}`;\n\n generateFiles(tree, sourceRoot, targetRoot, { ...names(options.name) });\n await formatFiles(tree);\n}\n\nexport default commandGenerator;\n"],"names":["formatFiles","generateFiles","names","fileURLToPath","dirname","join","inferProjectConfiguration","__dirname","url","commandGenerator","tree","options","sourceRoot","projectConfig","projectRoot","root","targetRoot","name"],"mappings":"AAAA,SAASA,WAAW,EAAEC,aAAa,EAAEC,KAAK,QAAmB,aAAa;AAG1E,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAC1C,SAASC,yBAAyB,QAAQ,6CAA6C;AAEvF,MAAMC,YAAYH,QAAQD,cAAc,YAAYK,GAAG;AAEvD,OAAO,eAAeC,iBAAiBC,IAAU,EAAEC,OAA+B;IAChF,MAAMC,aAAaP,KAAKE,WAAW;IACnC,MAAMM,gBAAgBP,0BAA0BI;IAChD,MAAMI,cAAcD,cAAcE,IAAI;IACtC,MAAMC,aAAa,GAAGF,YAAY,SAAS,EAAEH,QAAQM,IAAI,EAAE;IAE3DhB,cAAcS,MAAME,YAAYI,YAAY;QAAE,GAAGd,MAAMS,QAAQM,IAAI,CAAC;IAAC;IACrE,MAAMjB,YAAYU;AACpB;AAEA,eAAeD,iBAAiB"}
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+
3
+ /**
4
+ * Say <%- fileName %>
5
+ *
6
+ * ### Example
7
+ * ````sh
8
+ * vnodes <%- fileName %> --username YourName
9
+ * ````
10
+ * @param command main command instance
11
+ */
12
+ export function <%- fileName %>(command: Command) {
13
+ command
14
+ .command('<%- fileName %>')
15
+ .requiredOption('-u, --username <string>', 'What is your name')
16
+ .action(({ username }) => console.log(`Hello, ${username}`));
17
+ }
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=schema.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/command/schema.d.ts"],"sourcesContent":["export interface CommandGeneratorSchema {\n name: string;\n}\n"],"names":[],"mappings":"AAAA,WAEC"}
@@ -0,0 +1,3 @@
1
+ export interface CommandGeneratorSchema {
2
+ name: string;
3
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "command",
4
+ "title": "Command",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What name would you like to use?"
15
+ }
16
+ },
17
+ "required": ["name"]
18
+ }
@@ -0,0 +1,18 @@
1
+ import { formatFiles, generateFiles, names, type Tree } from '@nx/devkit';
2
+
3
+ import type { <%- className %>GeneratorSchema } from './schema.js';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { dirname, join, basename } from 'node:path';
6
+
7
+ const __dirname = dirname(fileURLToPath(import.meta.url));
8
+
9
+ export async function <%- propertyName %>Generator(tree: Tree, options: <%- className %>GeneratorSchema) {
10
+ const name = basename(options.directory);
11
+ const sourceRoot = join(__dirname, 'files');
12
+ const targetRoot = options.directory;
13
+
14
+ generateFiles(tree, sourceRoot, targetRoot, { ...names(name) });
15
+ await formatFiles(tree);
16
+ }
17
+
18
+ export default <%- propertyName %>Generator;
@@ -0,0 +1,3 @@
1
+ export interface <%- className %>GeneratorSchema {
2
+ directory: string;
3
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "<%- propertyName %>",
4
+ "title": "<%- className %>",
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,5 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import { type GeneratorGeneratorSchema } from './schema.js';
3
+ export declare function generatorGenerator(tree: Tree, options: GeneratorGeneratorSchema): Promise<void>;
4
+ export default generatorGenerator;
5
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generators/generator/generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAEtF,OAAO,EAAE,KAAK,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAO5D,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,wBAAwB,iBAkBrF;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { formatFiles, generateFiles, names, updateJson } from '@nx/devkit';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { inferProjectConfiguration } from '../../utils/infer-project-configuration.js';
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ export async function generatorGenerator(tree, options) {
7
+ const sourceRoot = join(__dirname, 'files');
8
+ const projectConfig = inferProjectConfiguration(tree);
9
+ const generatorRoot = join(projectConfig.root, 'src', 'generators', options.name);
10
+ generateFiles(tree, sourceRoot, generatorRoot, {
11
+ ...names(options.name)
12
+ });
13
+ updateJson(tree, join(projectConfig.root, 'generators.json'), (value)=>{
14
+ value.generators[options.name] = {
15
+ factory: `./dist/generators/${options.name}/${options.name}.js`,
16
+ schema: `./dist/generators/${options.name}/schema.json`,
17
+ description: `${options.name} generator`
18
+ };
19
+ return value;
20
+ });
21
+ await formatFiles(tree);
22
+ }
23
+ export default generatorGenerator;
24
+
25
+ //# sourceMappingURL=generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/generator/generator.ts"],"sourcesContent":["import { formatFiles, generateFiles, names, updateJson, type Tree } from '@nx/devkit';\n\nimport { type GeneratorGeneratorSchema } from './schema.js';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { inferProjectConfiguration } from '../../utils/infer-project-configuration.js';\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\nexport async function generatorGenerator(tree: Tree, options: GeneratorGeneratorSchema) {\n const sourceRoot = join(__dirname, 'files');\n\n const projectConfig = inferProjectConfiguration(tree);\n\n const generatorRoot = join(projectConfig.root, 'src', 'generators', options.name);\n\n generateFiles(tree, sourceRoot, generatorRoot, { ...names(options.name) });\n\n updateJson(tree, join(projectConfig.root, 'generators.json'), (value) => {\n value.generators[options.name] = {\n factory: `./dist/generators/${options.name}/${options.name}.js`,\n schema: `./dist/generators/${options.name}/schema.json`,\n description: `${options.name} generator`,\n };\n return value;\n });\n await formatFiles(tree);\n}\n\nexport default generatorGenerator;\n"],"names":["formatFiles","generateFiles","names","updateJson","dirname","join","fileURLToPath","inferProjectConfiguration","__dirname","url","generatorGenerator","tree","options","sourceRoot","projectConfig","generatorRoot","root","name","value","generators","factory","schema","description"],"mappings":"AAAA,SAASA,WAAW,EAAEC,aAAa,EAAEC,KAAK,EAAEC,UAAU,QAAmB,aAAa;AAGtF,SAASC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AAC1C,SAASC,aAAa,QAAQ,WAAW;AACzC,SAASC,yBAAyB,QAAQ,6CAA6C;AAEvF,MAAMC,YAAYJ,QAAQE,cAAc,YAAYG,GAAG;AAEvD,OAAO,eAAeC,mBAAmBC,IAAU,EAAEC,OAAiC;IACpF,MAAMC,aAAaR,KAAKG,WAAW;IAEnC,MAAMM,gBAAgBP,0BAA0BI;IAEhD,MAAMI,gBAAgBV,KAAKS,cAAcE,IAAI,EAAE,OAAO,cAAcJ,QAAQK,IAAI;IAEhFhB,cAAcU,MAAME,YAAYE,eAAe;QAAE,GAAGb,MAAMU,QAAQK,IAAI,CAAC;IAAC;IAExEd,WAAWQ,MAAMN,KAAKS,cAAcE,IAAI,EAAE,oBAAoB,CAACE;QAC7DA,MAAMC,UAAU,CAACP,QAAQK,IAAI,CAAC,GAAG;YAC/BG,SAAS,CAAC,kBAAkB,EAAER,QAAQK,IAAI,CAAC,CAAC,EAAEL,QAAQK,IAAI,CAAC,GAAG,CAAC;YAC/DI,QAAQ,CAAC,kBAAkB,EAAET,QAAQK,IAAI,CAAC,YAAY,CAAC;YACvDK,aAAa,GAAGV,QAAQK,IAAI,CAAC,UAAU,CAAC;QAC1C;QACA,OAAOC;IACT;IACA,MAAMlB,YAAYW;AACpB;AAEA,eAAeD,mBAAmB"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=schema.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/generator/schema.d.ts"],"sourcesContent":["export interface GeneratorGeneratorSchema {\n name: string;\n}\n"],"names":[],"mappings":"AAAA,WAEC"}
@@ -0,0 +1,3 @@
1
+ export interface GeneratorGeneratorSchema {
2
+ name: string;
3
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "Generator",
4
+ "title": "Generate Generator",
5
+ "type": "object",
6
+ "properties": {
7
+ "name": {
8
+ "type": "string",
9
+ "description": "Generator name",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What name would you like to use?"
15
+ }
16
+ },
17
+ "required": ["name"]
18
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "<%- propertyName %>":"<%- fileName %>"
3
+ }
@@ -0,0 +1,5 @@
1
+ import { type Tree } from '@nx/devkit';
2
+ import type { HelloGeneratorSchema } from './schema.js';
3
+ export declare function helloGenerator(tree: Tree, options: HelloGeneratorSchema): Promise<void>;
4
+ export default helloGenerator;
5
+ //# sourceMappingURL=hello.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hello.d.ts","sourceRoot":"","sources":["../../../src/generators/hello/hello.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAMxD,wBAAsB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,oBAAoB,iBAS7E;AAED,eAAe,cAAc,CAAC"}