@vnodes/cli 0.1.8 → 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.
- package/dist/cli/bye/bye.d.ts +12 -0
- package/dist/cli/bye/bye.d.ts.map +1 -0
- package/dist/cli/bye/bye.js +13 -0
- package/dist/cli/bye/bye.js.map +1 -0
- package/dist/cli/cli.js +5 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/wd/wd.js +1 -1
- package/dist/cli/wd/wd.js.map +1 -1
- package/dist/cli/workspace/files/.eslint/allow-self-import.mjs.template +17 -0
- package/dist/cli/workspace/files/.eslint/common.mjs.template +22 -0
- package/dist/cli/workspace/files/.eslint/dependency-check.mjs.template +22 -0
- package/dist/cli/workspace/files/.eslint/eslint.base.mjs.template +8 -0
- package/dist/cli/workspace/files/.eslint/module-boundries.mjs.template +40 -0
- package/dist/cli/workspace/files/.eslint/no-undefined.mjs.template +16 -0
- package/dist/cli/workspace/files/.eslint/node-protocol.mjs.template +13 -0
- package/dist/cli/workspace/files/.eslint/plugin-check.mjs.template +11 -0
- package/dist/cli/workspace/files/.github/workflows/ci.yml.template +79 -0
- package/dist/cli/workspace/files/.gitignore.template +52 -0
- package/dist/cli/workspace/files/.husky/_/.gitignore.template +1 -0
- package/dist/cli/workspace/files/.husky/_/applypatch-msg.template +2 -0
- package/dist/cli/workspace/files/.husky/_/commit-msg.template +2 -0
- package/dist/cli/workspace/files/.husky/_/h.template +22 -0
- package/dist/cli/workspace/files/.husky/_/husky.sh.template +9 -0
- package/dist/cli/workspace/files/.husky/_/post-applypatch.template +2 -0
- package/dist/cli/workspace/files/.husky/_/post-checkout.template +2 -0
- package/dist/cli/workspace/files/.husky/_/post-commit.template +2 -0
- package/dist/cli/workspace/files/.husky/_/post-merge.template +2 -0
- package/dist/cli/workspace/files/.husky/_/post-rewrite.template +2 -0
- package/dist/cli/workspace/files/.husky/_/pre-applypatch.template +2 -0
- package/dist/cli/workspace/files/.husky/_/pre-auto-gc.template +2 -0
- package/dist/cli/workspace/files/.husky/_/pre-commit.template +2 -0
- package/dist/cli/workspace/files/.husky/_/pre-merge-commit.template +2 -0
- package/dist/cli/workspace/files/.husky/_/pre-push.template +2 -0
- package/dist/cli/workspace/files/.husky/_/pre-rebase.template +2 -0
- package/dist/cli/workspace/files/.husky/_/prepare-commit-msg.template +2 -0
- package/dist/cli/workspace/files/.husky/commit-msg.template +24 -0
- package/dist/cli/workspace/files/.husky/pre-commit.template +11 -0
- package/dist/cli/workspace/files/.prettierignore.template +5 -0
- package/dist/cli/workspace/files/.prettierrc.template +4 -0
- package/dist/cli/workspace/files/.verdaccio/config.yml.template +28 -0
- package/dist/cli/workspace/files/.vscode/_.code-snippets.template +8 -0
- package/dist/cli/workspace/files/.vscode/cli.code-snippets.template +25 -0
- package/dist/cli/workspace/files/.vscode/extensions.json.template +14 -0
- package/dist/cli/workspace/files/.vscode/nest.code-snippets.template +16 -0
- package/dist/cli/workspace/files/.vscode/settings.json.template +27 -0
- package/dist/cli/workspace/files/.vscode/ts.code-snippets.template +16 -0
- package/dist/cli/workspace/files/eslint.config.mjs.template +4 -0
- package/dist/cli/workspace/files/pnpm-workspace.yaml.template +13 -0
- package/dist/cli/workspace/files/tsconfig.json.template +5 -0
- package/dist/cli/workspace/files/vitest.workspace.ts.template +4 -0
- package/dist/cli/workspace/templates/README.md.ejs +34 -0
- package/dist/cli/workspace/templates/nx.json.ejs +127 -0
- package/dist/cli/workspace/templates/package.json.ejs +63 -0
- package/dist/cli/workspace/templates/project.json.ejs +14 -0
- package/dist/cli/workspace/templates/tsconfig.base.json.ejs +38 -0
- package/dist/cli/workspace/workspace.d.ts +12 -0
- package/dist/cli/workspace/workspace.d.ts.map +1 -0
- package/dist/cli/workspace/workspace.js +54 -0
- package/dist/cli/workspace/workspace.js.map +1 -0
- package/dist/generators/command/command.d.ts +5 -0
- package/dist/generators/command/command.d.ts.map +1 -0
- package/dist/generators/command/command.js +18 -0
- package/dist/generators/command/command.js.map +1 -0
- package/dist/generators/command/files/__fileName__.ts.template +17 -0
- package/dist/generators/command/schema.d.js +3 -0
- package/dist/generators/command/schema.d.js.map +1 -0
- package/dist/generators/command/schema.d.ts +3 -0
- package/dist/generators/command/schema.json +18 -0
- package/dist/generators/generator/files/__fileName__.ts.template +18 -0
- package/dist/generators/generator/files/files/__fileName__.json.template.template +3 -0
- package/dist/generators/generator/files/schema.d.ts.template +3 -0
- package/dist/generators/generator/files/schema.json.template +18 -0
- package/dist/generators/generator/generator.d.ts +5 -0
- package/dist/generators/generator/generator.d.ts.map +1 -0
- package/dist/generators/generator/generator.js +25 -0
- package/dist/generators/generator/generator.js.map +1 -0
- package/dist/generators/generator/schema.d.js +3 -0
- package/dist/generators/generator/schema.d.js.map +1 -0
- package/dist/generators/generator/schema.d.ts +3 -0
- package/dist/generators/generator/schema.json +18 -0
- package/dist/generators/hello/files/__fileName__.json.template +3 -0
- package/dist/generators/hello/hello.d.ts +5 -0
- package/dist/generators/hello/hello.d.ts.map +1 -0
- package/dist/generators/hello/hello.js +16 -0
- package/dist/generators/hello/hello.js.map +1 -0
- package/dist/generators/hello/schema.d.js +3 -0
- package/dist/generators/hello/schema.d.js.map +1 -0
- package/dist/generators/hello/schema.d.ts +3 -0
- package/dist/generators/hello/schema.json +18 -0
- package/dist/generators/project/cli/bin/__fileName__.mjs.template +3 -0
- package/dist/generators/project/cli/eslint.config.mjs.template +4 -0
- package/dist/generators/project/cli/generators.json.template +9 -0
- package/dist/generators/project/cli/package.json.template +96 -0
- package/dist/generators/project/cli/src/cli/cli.ts.template +11 -0
- package/dist/generators/project/cli/src/cli/hello/hello.ts.template +17 -0
- package/dist/generators/project/cli/src/generators/hello/files/hello.template.template +1 -0
- package/dist/generators/project/cli/src/generators/hello/hello.spec.ts.template +7 -0
- package/dist/generators/project/cli/src/generators/hello/hello.ts.template +19 -0
- package/dist/generators/project/cli/src/generators/hello/schema.d.ts.template +3 -0
- package/dist/generators/project/cli/src/generators/hello/schema.json.template +18 -0
- package/dist/generators/project/cli/src/index.ts.template +4 -0
- package/dist/generators/project/prisma/.env.template +0 -1
- package/dist/generators/project/prisma/package.json.template +4 -6
- package/dist/generators/project/prisma/prisma.config.ts.template +4 -10
- package/dist/generators/project/project.d.ts +1 -0
- package/dist/generators/project/project.d.ts.map +1 -1
- package/dist/generators/project/project.js +7 -7
- package/dist/generators/project/project.js.map +1 -1
- package/dist/generators/project/schema.json +2 -12
- package/dist/package.json +6 -2
- package/dist/peer-dependencies.d.ts +2 -0
- package/dist/peer-dependencies.d.ts.map +1 -0
- package/dist/peer-dependencies.js +3 -0
- package/dist/peer-dependencies.js.map +1 -0
- package/dist/utils/infer-project-configuration.d.ts +3 -0
- package/dist/utils/infer-project-configuration.d.ts.map +1 -0
- package/dist/utils/infer-project-configuration.js +13 -0
- package/dist/utils/infer-project-configuration.js.map +1 -0
- package/generators.json +16 -1
- package/package.json +6 -2
- package/dist/generators/project/api/.swcrc.template +0 -29
- package/dist/generators/project/api/prisma.config.ts.template +0 -12
- package/dist/generators/project/api/tsconfig.app.json.template +0 -14
- /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 @@
|
|
|
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,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,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 @@
|
|
|
1
|
+
Hello, There
|
|
@@ -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,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
|
+
}
|
|
@@ -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,19 +1,13 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import { defineConfig } from 'prisma/config';
|
|
3
|
-
import {
|
|
3
|
+
import { env } from '@vnodes/env';
|
|
4
4
|
|
|
5
5
|
export default defineConfig({
|
|
6
|
-
schema:
|
|
7
|
-
EnvKey.DB_PRISMA_SCHEMA_PATH,
|
|
8
|
-
EnvDefault.DB_PRISMA_SCHEMA_PATH,
|
|
9
|
-
),
|
|
6
|
+
schema: env.DB_PRISMA_SCHEMA_PATH_OR_DEFAULT,
|
|
10
7
|
migrations: {
|
|
11
|
-
path:
|
|
12
|
-
EnvKey.DB_MIGRATIONS_PATH,
|
|
13
|
-
EnvDefault.DB_MIGRATIONS_PATH,
|
|
14
|
-
),
|
|
8
|
+
path: env.DB_MIGRATIONS_PATH_OR_DEFAULT,
|
|
15
9
|
},
|
|
16
10
|
datasource: {
|
|
17
|
-
url:
|
|
11
|
+
url: env.DB_URL_OR_THROW,
|
|
18
12
|
},
|
|
19
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,
|
|
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 `
|
|
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
|
|
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 =
|
|
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 {
|
|
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.
|
|
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 @@
|
|
|
1
|
+
{"version":3,"file":"peer-dependencies.d.ts","sourceRoot":"","sources":["../src/peer-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/peer-dependencies.ts"],"sourcesContent":["import 'ejs';\n"],"names":[],"mappings":"AAAA,OAAO,MAAM"}
|
|
@@ -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.
|
|
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
|
-
"
|
|
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
|
-
}
|
|
File without changes
|