@vnodes/cli 0.1.5 → 0.1.7
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/README.md +0 -1
- package/dist/cli/cli.js +3 -1
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/rm/rm.d.ts +12 -0
- package/dist/cli/rm/rm.d.ts.map +1 -0
- package/dist/cli/rm/rm.js +22 -0
- package/dist/cli/rm/rm.js.map +1 -0
- package/dist/generators/project/api/.env.template +4 -3
- package/dist/generators/project/api/package.json.template +12 -27
- package/dist/generators/project/api/src/app/resources/resource.module.ts.template +1 -1
- package/dist/generators/project/api/src/app/resources/sample/sample.controller.ts.template +1 -1
- package/dist/generators/project/api/src/app/resources/sample/sample.module.ts.template +1 -1
- package/dist/generators/project/common/.npmignore.template +1 -0
- package/dist/generators/project/common/README.md.template +0 -1
- package/dist/generators/project/common/bin/__fileName__.mjs.template +4 -0
- package/dist/generators/project/{lib → common}/tsconfig.json.template +1 -1
- package/dist/generators/project/common/vitest.config.mts.template +2 -2
- package/dist/generators/project/lib/package.json.template +4 -0
- package/dist/generators/project/prisma/.env.template +3 -0
- package/dist/generators/project/prisma/.npmignore.template +1 -0
- package/dist/generators/project/prisma/package.json.template +83 -0
- package/dist/generators/project/prisma/prisma/schema.prisma.template +14 -0
- package/dist/generators/project/prisma/prisma.config.ts.template +12 -0
- package/dist/generators/project/project.d.ts +2 -1
- package/dist/generators/project/project.d.ts.map +1 -1
- package/dist/generators/project/project.js +18 -15
- package/dist/generators/project/project.js.map +1 -1
- package/dist/generators/project/schema.d.js.map +1 -1
- package/dist/generators/project/schema.d.ts +1 -1
- package/dist/generators/project/schema.json +13 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -1
- package/package.json +3 -2
- package/dist/generators/project/api/.gitignore.template +0 -4
- package/dist/generators/project/api/.npmignore.template +0 -2
- package/dist/generators/project/api/eslint.config.mjs.template +0 -5
- package/dist/generators/project/api/tsconfig.json.template +0 -16
- package/dist/generators/project/lib/.npmignore.template +0 -2
- /package/dist/generators/project/{lib → common}/eslint.config.mjs.template +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|

|
|
3
3
|

|
|
4
|
-

|
|
5
4
|

|
|
6
5
|
|
|
7
6
|
<p align="center">
|
package/dist/cli/cli.js
CHANGED
|
@@ -2,11 +2,13 @@ import { program } from 'commander';
|
|
|
2
2
|
import { hello } from './hello/hello.js';
|
|
3
3
|
import { wd } from './wd/wd.js';
|
|
4
4
|
import { suffix } from './suffix/suffix.js';
|
|
5
|
+
import { rm } from './rm/rm.js';
|
|
5
6
|
program.name('Vnodes cli').description('Tools and generators').version('0.1.0').showHelpAfterError(true);
|
|
6
7
|
[
|
|
7
8
|
hello,
|
|
8
9
|
wd,
|
|
9
|
-
suffix
|
|
10
|
+
suffix,
|
|
11
|
+
rm
|
|
10
12
|
].map((c)=>c(program));
|
|
11
13
|
program.parse();
|
|
12
14
|
|
package/dist/cli/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { program } from 'commander';\nimport { hello } from './hello/hello.js';\nimport { wd } from './wd/wd.js';\nimport { suffix } from './suffix/suffix.js';\n\nprogram\n .name('Vnodes cli')\n .description('Tools and generators')\n .version('0.1.0')\n .showHelpAfterError(true);\n\n[hello, wd, suffix].map((c) => c(program));\n\nprogram.parse();\n"],"names":["program","hello","wd","suffix","name","description","version","showHelpAfterError","map","c","parse"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,EAAE,QAAQ,aAAa;AAChC,SAASC,MAAM,QAAQ,qBAAqB;
|
|
1
|
+
{"version":3,"sources":["../../src/cli/cli.ts"],"sourcesContent":["import { program } from 'commander';\nimport { hello } from './hello/hello.js';\nimport { wd } from './wd/wd.js';\nimport { suffix } from './suffix/suffix.js';\nimport { rm } from './rm/rm.js';\n\nprogram\n .name('Vnodes cli')\n .description('Tools and generators')\n .version('0.1.0')\n .showHelpAfterError(true);\n\n[hello, wd, suffix, rm].map((c) => c(program));\n\nprogram.parse();\n"],"names":["program","hello","wd","suffix","rm","name","description","version","showHelpAfterError","map","c","parse"],"mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,EAAE,QAAQ,aAAa;AAChC,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,aAAa;AAEhCJ,QACGK,IAAI,CAAC,cACLC,WAAW,CAAC,wBACZC,OAAO,CAAC,SACRC,kBAAkB,CAAC;AAEtB;IAACP;IAAOC;IAAIC;IAAQC;CAAG,CAACK,GAAG,CAAC,CAACC,IAAMA,EAAEV;AAErCA,QAAQW,KAAK"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
/**
|
|
3
|
+
* Remove files/directories
|
|
4
|
+
*
|
|
5
|
+
* ### Example
|
|
6
|
+
* ````sh
|
|
7
|
+
* vnodes rm --username YourName
|
|
8
|
+
* ````
|
|
9
|
+
* @param command main command instance
|
|
10
|
+
*/
|
|
11
|
+
export declare function rm(command: Command): void;
|
|
12
|
+
//# sourceMappingURL=rm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rm.d.ts","sourceRoot":"","sources":["../../../src/cli/rm/rm.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC;;;;;;;;GAQG;AACH,wBAAgB,EAAE,CAAC,OAAO,EAAE,OAAO,QAQlC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { rmSync } from 'node:fs';
|
|
2
|
+
import { scope } from '@vnodes/fs';
|
|
3
|
+
import { cwd } from 'node:process';
|
|
4
|
+
/**
|
|
5
|
+
* Remove files/directories
|
|
6
|
+
*
|
|
7
|
+
* ### Example
|
|
8
|
+
* ````sh
|
|
9
|
+
* vnodes rm --username YourName
|
|
10
|
+
* ````
|
|
11
|
+
* @param command main command instance
|
|
12
|
+
*/ export function rm(command) {
|
|
13
|
+
command.command('rm').requiredOption('-p, --path <string>', 'What is your name').action(({ path })=>{
|
|
14
|
+
const resolve = scope(cwd());
|
|
15
|
+
rmSync(resolve(path), {
|
|
16
|
+
recursive: true,
|
|
17
|
+
force: true
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
//# sourceMappingURL=rm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cli/rm/rm.ts"],"sourcesContent":["import { Command } from 'commander';\nimport { rmSync } from 'node:fs';\nimport { scope } from '@vnodes/fs';\nimport { cwd } from 'node:process';\n/**\n * Remove files/directories\n *\n * ### Example\n * ````sh\n * vnodes rm --username YourName\n * ````\n * @param command main command instance\n */\nexport function rm(command: Command) {\n command\n .command('rm')\n .requiredOption('-p, --path <string>', 'What is your name')\n .action(({ path }) => {\n const resolve = scope(cwd());\n rmSync(resolve(path), { recursive: true, force: true });\n });\n}\n"],"names":["rmSync","scope","cwd","rm","command","requiredOption","action","path","resolve","recursive","force"],"mappings":"AACA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,GAAG,QAAQ,eAAe;AACnC;;;;;;;;CAQC,GACD,OAAO,SAASC,GAAGC,OAAgB;IACjCA,QACGA,OAAO,CAAC,MACRC,cAAc,CAAC,uBAAuB,qBACtCC,MAAM,CAAC,CAAC,EAAEC,IAAI,EAAE;QACf,MAAMC,UAAUP,MAAMC;QACtBF,OAAOQ,QAAQD,OAAO;YAAEE,WAAW;YAAMC,OAAO;QAAK;IACvD;AACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
PROFILE=
|
|
1
|
+
PROFILE=DEV
|
|
2
2
|
APP_ID=<%- fileName %>
|
|
3
|
+
APP_DESC=- [ ] Add description
|
|
3
4
|
API_PREFIX=api
|
|
4
5
|
PORT=3000
|
|
5
|
-
DB_URL=postgres
|
|
6
|
-
DB_SCHEMA=<%- fileName %>
|
|
6
|
+
DB_URL=postgres://<%- orgName %>:password@localhost:5432/<%- orgName %>?schema=<%- fileName %>
|
|
7
|
+
DB_SCHEMA=<%- fileName %>
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
"funding": [
|
|
21
21
|
"<%- fundingUrl %>"
|
|
22
22
|
],
|
|
23
|
+
"bin":{
|
|
24
|
+
"<%- fileName %>":"./bin/<%- fileName %>.mjs"
|
|
25
|
+
},
|
|
23
26
|
"files": [
|
|
27
|
+
"bin",
|
|
24
28
|
"dist",
|
|
25
29
|
"assets"
|
|
26
30
|
],
|
|
@@ -34,16 +38,6 @@
|
|
|
34
38
|
"types": "./dist/src/index.d.ts",
|
|
35
39
|
"import": "./dist/src/index.js",
|
|
36
40
|
"default": "./dist/src/index.js"
|
|
37
|
-
},
|
|
38
|
-
"./client": {
|
|
39
|
-
"types": "./dist/src/generated/prisma/client.d.ts",
|
|
40
|
-
"import": "./dist/src/generated/prisma/client.js",
|
|
41
|
-
"default": "./dist/src/generated/prisma/client.js"
|
|
42
|
-
},
|
|
43
|
-
"./browser": {
|
|
44
|
-
"types": "./dist/src/generated/prisma/browser.d.ts",
|
|
45
|
-
"import": "./dist/src/generated/prisma/browser.js",
|
|
46
|
-
"default": "./dist/src/generated/prisma/browser.js"
|
|
47
41
|
}
|
|
48
42
|
},
|
|
49
43
|
"nx": {
|
|
@@ -52,19 +46,8 @@
|
|
|
52
46
|
"<%- tag %>"
|
|
53
47
|
],
|
|
54
48
|
"targets": {
|
|
55
|
-
"build": {
|
|
56
|
-
"options": {
|
|
57
|
-
"stripLeadingPaths": false
|
|
58
|
-
},
|
|
59
|
-
"dependsOn": [
|
|
60
|
-
"prisma:generate"
|
|
61
|
-
]
|
|
62
|
-
},
|
|
63
|
-
"preserve": {},
|
|
49
|
+
"build": {},
|
|
64
50
|
"serve": {},
|
|
65
|
-
"prisma:migrate": {},
|
|
66
|
-
"prisma:reset": {},
|
|
67
|
-
"prisma:generate": {},
|
|
68
51
|
"doc":{}
|
|
69
52
|
}
|
|
70
53
|
},
|
|
@@ -83,8 +66,9 @@
|
|
|
83
66
|
"@nestjs/throttler": "^6.5.0",
|
|
84
67
|
"@prisma/adapter-pg": "^7.8.0",
|
|
85
68
|
"@prisma/client": "^7.8.0",
|
|
86
|
-
"@vnodes/nest": "
|
|
87
|
-
"@vnodes/prisma": "
|
|
69
|
+
"@vnodes/nest": "<%- workspaceVersion %>",
|
|
70
|
+
"@vnodes/prisma": "<%- workspaceVersion %>",
|
|
71
|
+
"<%- projectName %>-db": "workspace:*",
|
|
88
72
|
"cache-manager": "^7.2.8",
|
|
89
73
|
"class-transformer": "^0.5.1",
|
|
90
74
|
"class-validator": "^0.15.1",
|
|
@@ -103,9 +87,10 @@
|
|
|
103
87
|
"@nestjs/throttler": "^6.5.0",
|
|
104
88
|
"@prisma/adapter-pg": "^7.8.0",
|
|
105
89
|
"@prisma/client": "^7.8.0",
|
|
106
|
-
"@vnodes/nest": "
|
|
107
|
-
"@vnodes/prisma": "
|
|
108
|
-
"@vnodes/types": "
|
|
90
|
+
"@vnodes/nest": "<%- workspaceVersion %>",
|
|
91
|
+
"@vnodes/prisma": "<%- workspaceVersion %>",
|
|
92
|
+
"@vnodes/types": "<%- workspaceVersion %>",
|
|
93
|
+
"<%- projectName %>-db": "workspace:*",
|
|
109
94
|
"cache-manager": "^7.2.8",
|
|
110
95
|
"class-transformer": "^0.5.1",
|
|
111
96
|
"class-validator": "^0.15.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module } from '@vnodes/nest';
|
|
2
2
|
import { SampleModule } from './sample/sample.module.js';
|
|
3
3
|
import { PrismaModule } from '@vnodes/prisma';
|
|
4
|
-
import { PrismaClient } from '
|
|
4
|
+
import { PrismaClient } from '<%- projectName %>-db/client'';
|
|
5
5
|
|
|
6
6
|
@Module({
|
|
7
7
|
imports: [PrismaModule.forRoot({ client: PrismaClient }), SampleModule],
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@vnodes/nest';
|
|
13
13
|
import { SampleCreateDto } from './sample.dto.js';
|
|
14
14
|
import { InjectDelegate } from '@vnodes/prisma';
|
|
15
|
-
import { Prisma } from '
|
|
15
|
+
import { Prisma } from '<%- projectName %>-db/client';
|
|
16
16
|
|
|
17
17
|
@ResourceController('samples')
|
|
18
18
|
export class SampleController {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Module } from '@vnodes/nest';
|
|
2
2
|
import { SampleController } from './sample.controller.js';
|
|
3
3
|
import { PrismaModule } from '@vnodes/prisma';
|
|
4
|
-
import { Prisma } from '
|
|
4
|
+
import { Prisma } from '<%- projectName %>-db/client'';
|
|
5
5
|
|
|
6
6
|
@Module({
|
|
7
7
|
imports: [PrismaModule.forFeature({ models: [Prisma.ModelName.Sample] })],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist/package.json
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|

|
|
2
2
|

|
|
3
3
|

|
|
4
|
-

|
|
5
4
|

|
|
6
5
|
|
|
7
6
|
<p align="center">
|
|
@@ -2,9 +2,9 @@ import { defineConfig } from 'vitest/config';
|
|
|
2
2
|
|
|
3
3
|
export default defineConfig(() => ({
|
|
4
4
|
root: __dirname,
|
|
5
|
-
cacheDir: '../../node_modules/.vite
|
|
5
|
+
cacheDir: '../../node_modules/.vite/<%- directory %>',
|
|
6
6
|
test: {
|
|
7
|
-
name: '
|
|
7
|
+
name: '<%- projectName %>',
|
|
8
8
|
watch: false,
|
|
9
9
|
globals: true,
|
|
10
10
|
environment: 'node',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
dist/package.json
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "<%- projectName %>",
|
|
3
|
+
"description":"- [ ] Add project description",
|
|
4
|
+
"version": "<%- version %>",
|
|
5
|
+
"author": {
|
|
6
|
+
"email": "<%- email %>",
|
|
7
|
+
"name": "<%- authorName %>",
|
|
8
|
+
"url": "<%- homePageUrl %>"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"database",
|
|
12
|
+
"prisma"
|
|
13
|
+
],
|
|
14
|
+
"bugs": {
|
|
15
|
+
"email": "<%- email %>",
|
|
16
|
+
"url": "https://github.com/<%- orgName %>/<%- repoName %>/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "<%- homePageUrl %>/<%- directory %>",
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"access": "public",
|
|
21
|
+
"tag": "latest"
|
|
22
|
+
},
|
|
23
|
+
"funding": [
|
|
24
|
+
"<%- fundingUrl %>"
|
|
25
|
+
],
|
|
26
|
+
"bin":{
|
|
27
|
+
"<%- fileName %>":"./bin/<%- fileName %>.mjs"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin",
|
|
31
|
+
"dist",
|
|
32
|
+
"assets"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"module": "./dist/index.js",
|
|
38
|
+
"exports": {
|
|
39
|
+
"./package.json": "./package.json",
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"import": "./dist/index.js",
|
|
43
|
+
"default": "./dist/index.js"
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
"./client": {
|
|
47
|
+
"types": "./dist/generated/prisma/client.d.ts",
|
|
48
|
+
"import": "./dist/generated/prisma/client.js",
|
|
49
|
+
"default": "./dist/generated/prisma/client.js"
|
|
50
|
+
},
|
|
51
|
+
"./browser": {
|
|
52
|
+
"types": "./dist/generated/prisma/browser.d.ts",
|
|
53
|
+
"import": "./dist/generated/prisma/browser.js",
|
|
54
|
+
"default": "./dist/generated/prisma/browser.js"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"nx": {
|
|
58
|
+
"sourceRoot": "<%- directory %>/src",
|
|
59
|
+
"tags": [
|
|
60
|
+
"<%- tag %>"
|
|
61
|
+
],
|
|
62
|
+
"targets": {
|
|
63
|
+
"build": {
|
|
64
|
+
"dependsOn": [
|
|
65
|
+
"prisma:generate"
|
|
66
|
+
]
|
|
67
|
+
},
|
|
68
|
+
"prisma:migrate": {},
|
|
69
|
+
"prisma:reset": {},
|
|
70
|
+
"prisma:generate": {},
|
|
71
|
+
"doc": {}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@swc/helpers": "~0.5.18"
|
|
76
|
+
},
|
|
77
|
+
"peerDependencies": {
|
|
78
|
+
"@prisma/client": "^7.8.0"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@prisma/client": "^7.8.0"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { names, type Tree } from '@nx/devkit';
|
|
2
2
|
import { type ProjectGeneratorSchema, type ProjectType } from './schema.d.js';
|
|
3
|
+
export declare function autoTag(projectType: ProjectType): string;
|
|
3
4
|
export type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {
|
|
4
5
|
projectName: string;
|
|
5
6
|
shortName: string;
|
|
6
7
|
sourceRoot: string;
|
|
7
8
|
targetRoot: string;
|
|
8
9
|
tag: string;
|
|
10
|
+
workspaceVersion: string;
|
|
9
11
|
} & ReturnType<typeof names>;
|
|
10
12
|
export declare function normalizeProjectSchema(options: ProjectGeneratorSchema): NormalizedProjectGeneratorOptions;
|
|
11
|
-
export declare function autoTag(projectType: ProjectType): string;
|
|
12
13
|
export declare function projectGenerator(tree: Tree, options: ProjectGeneratorSchema): Promise<void>;
|
|
13
14
|
export default projectGenerator;
|
|
14
15
|
//# sourceMappingURL=project.d.ts.map
|
|
@@ -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;
|
|
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,8 +1,24 @@
|
|
|
1
1
|
import { formatFiles, generateFiles, names, updateJson } from '@nx/devkit';
|
|
2
2
|
import { dirname, join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
const
|
|
5
|
-
|
|
4
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
5
|
+
export function autoTag(projectType) {
|
|
6
|
+
switch(projectType){
|
|
7
|
+
case 'lib':
|
|
8
|
+
{
|
|
9
|
+
return 'lib:shared';
|
|
10
|
+
}
|
|
11
|
+
case 'cli':
|
|
12
|
+
case 'api':
|
|
13
|
+
{
|
|
14
|
+
return `app:${projectType}`;
|
|
15
|
+
}
|
|
16
|
+
case 'prisma':
|
|
17
|
+
{
|
|
18
|
+
return `lib:core`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
6
22
|
export function normalizeProjectSchema(options) {
|
|
7
23
|
const normalizedOptions = {
|
|
8
24
|
...options
|
|
@@ -22,19 +38,6 @@ export function normalizeProjectSchema(options) {
|
|
|
22
38
|
...names(shortName)
|
|
23
39
|
};
|
|
24
40
|
}
|
|
25
|
-
export function autoTag(projectType) {
|
|
26
|
-
switch(projectType){
|
|
27
|
-
case 'lib':
|
|
28
|
-
{
|
|
29
|
-
return 'lib:shared';
|
|
30
|
-
}
|
|
31
|
-
case 'cli':
|
|
32
|
-
case 'api':
|
|
33
|
-
{
|
|
34
|
-
return `app:${projectType}`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
41
|
export async function projectGenerator(tree, options) {
|
|
39
42
|
const normalizedOptions = normalizeProjectSchema(options);
|
|
40
43
|
generateFiles(tree, normalizedOptions.sourceRoot, normalizedOptions.targetRoot, {
|
|
@@ -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
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/generators/project/schema.d.ts"],"sourcesContent":["export type ProjectType = 'lib' | 'api' | 'cli';\n\nexport interface ProjectGeneratorSchema {\n /**\n * Project directory ex. `libs/types`\n */\n directory: string;\n\n /**\n * Project type such as `lib`, `api`\n */\n projectType: ProjectType;\n\n /**\n * Orgnaization name such as `vnodes` will be used the create the `projectName` `(@vnodes/project-name)`\n */\n orgName: string;\n\n /**\n * Repository name will be used the create relative links/urls for documentation\n */\n repoName: string;\n\n /**\n * The homepage url that serve the documentation for the project\n */\n homePageUrl: string;\n\n /**\n * Author's email addresss\n */\n email: string;\n\n /**\n * Funding url\n */\n fundingUrl: string;\n\n /**\n * Author's full name\n */\n authorName: string;\n}\n"],"names":[],"mappings":"AAEA,WAwCC"}
|
|
1
|
+
{"version":3,"sources":["../../../src/generators/project/schema.d.ts"],"sourcesContent":["export type ProjectType = 'lib' | 'api' | 'cli' | 'prisma';\n\nexport interface ProjectGeneratorSchema {\n /**\n * Project directory ex. `libs/types`\n */\n directory: string;\n\n /**\n * Project type such as `lib`, `api`\n */\n projectType: ProjectType;\n\n /**\n * Orgnaization name such as `vnodes` will be used the create the `projectName` `(@vnodes/project-name)`\n */\n orgName: string;\n\n /**\n * Repository name will be used the create relative links/urls for documentation\n */\n repoName: string;\n\n /**\n * The homepage url that serve the documentation for the project\n */\n homePageUrl: string;\n\n /**\n * Author's email addresss\n */\n email: string;\n\n /**\n * Funding url\n */\n fundingUrl: string;\n\n /**\n * Author's full name\n */\n authorName: string;\n}\n"],"names":[],"mappings":"AAEA,WAwCC"}
|
|
@@ -16,10 +16,7 @@
|
|
|
16
16
|
"projectType": {
|
|
17
17
|
"type": "string",
|
|
18
18
|
"description": "Project projectType",
|
|
19
|
-
"enum": [
|
|
20
|
-
"lib",
|
|
21
|
-
"api"
|
|
22
|
-
],
|
|
19
|
+
"enum": ["lib", "api", "prisma"],
|
|
23
20
|
"$default": {
|
|
24
21
|
"$source": "argv",
|
|
25
22
|
"index": 1
|
|
@@ -79,6 +76,15 @@
|
|
|
79
76
|
"index": 7
|
|
80
77
|
},
|
|
81
78
|
"x-prompt": "What is the author name?"
|
|
79
|
+
},
|
|
80
|
+
"workspaceVersion": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Vnodes workspace version",
|
|
83
|
+
"$default": {
|
|
84
|
+
"$source": "argv",
|
|
85
|
+
"index": 8
|
|
86
|
+
},
|
|
87
|
+
"x-prompt": "What is the current version of vnodes packages?"
|
|
82
88
|
}
|
|
83
89
|
},
|
|
84
90
|
"required": [
|
|
@@ -89,6 +95,7 @@
|
|
|
89
95
|
"homePageUrl",
|
|
90
96
|
"email",
|
|
91
97
|
"fundingUrl",
|
|
92
|
-
"authorName"
|
|
98
|
+
"authorName",
|
|
99
|
+
"workspaceVersion"
|
|
93
100
|
]
|
|
94
|
-
}
|
|
101
|
+
}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
// @index(['./generators/**/*.ts','./cli/*/**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)
|
|
2
2
|
export * from './cli/hello/hello.js';
|
|
3
|
+
export * from './cli/rm/rm.js';
|
|
4
|
+
export * from './cli/suffix/suffix.js';
|
|
3
5
|
export * from './cli/wd/wd.js';
|
|
4
6
|
export * from './generators/project/project.js';
|
|
5
7
|
export * from './generators/project/schema.d.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./generators/**/*.ts','./cli/*/**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)\nexport * from './cli/hello/hello.js';\nexport * from './cli/wd/wd.js';\nexport * from './generators/project/project.js';\nexport * from './generators/project/schema.d.js';\n"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,kCAAkC;AAChD,cAAc,mCAAmC"}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./generators/**/*.ts','./cli/*/**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)\nexport * from './cli/hello/hello.js';\nexport * from './cli/rm/rm.js';\nexport * from './cli/suffix/suffix.js';\nexport * from './cli/wd/wd.js';\nexport * from './generators/project/project.js';\nexport * from './generators/project/schema.d.js';\n"],"names":[],"mappings":"AAAA,6GAA6G;AAC7G,cAAc,uBAAuB;AACrC,cAAc,iBAAiB;AAC/B,cAAc,yBAAyB;AACvC,cAAc,iBAAiB;AAC/B,cAAc,kCAAkC;AAChD,cAAc,mCAAmC"}
|
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.7",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "robert.brightline+vnodes-prisma@gmail.com",
|
|
7
7
|
"name": "Robert Brightline",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@nx/devkit": "22.7.5",
|
|
90
90
|
"@swc/helpers": "~0.5.18",
|
|
91
|
+
"@vnodes/fs": "workspace:*",
|
|
91
92
|
"commander": "^15.0.0"
|
|
92
93
|
},
|
|
93
94
|
"generators": "./generators.json"
|
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.7",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "robert.brightline+vnodes-prisma@gmail.com",
|
|
7
7
|
"name": "Robert Brightline",
|
|
@@ -88,7 +88,8 @@
|
|
|
88
88
|
"dependencies": {
|
|
89
89
|
"@nx/devkit": "22.7.5",
|
|
90
90
|
"@swc/helpers": "~0.5.18",
|
|
91
|
-
"commander": "^15.0.0"
|
|
91
|
+
"commander": "^15.0.0",
|
|
92
|
+
"@vnodes/fs": "0.1.7"
|
|
92
93
|
},
|
|
93
94
|
"generators": "./generators.json"
|
|
94
95
|
}
|
|
File without changes
|