@vnodes/cli 0.0.13 → 0.1.3

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 (33) hide show
  1. package/README.md +1 -34
  2. package/dist/generators/project/lib/.swcrc.template +27 -0
  3. package/dist/generators/project/lib/README.md.template +35 -0
  4. package/dist/generators/project/lib/eslint.config.mjs.template +3 -0
  5. package/dist/generators/project/lib/package.json.template +65 -0
  6. package/dist/generators/project/lib/src/index.ts.template +3 -0
  7. package/dist/generators/project/lib/src/lib/__fileName__.ts.template +3 -0
  8. package/dist/generators/project/lib/src/skip.spec.ts.template +5 -0
  9. package/dist/generators/project/lib/tsconfig.json.template +11 -0
  10. package/dist/generators/project/lib/tsconfig.lib.json.template +16 -0
  11. package/dist/generators/project/lib/tsconfig.spec.json.template +21 -0
  12. package/dist/generators/project/lib/vitest.config.mts.template +18 -0
  13. package/dist/generators/project/project.d.ts +8 -1
  14. package/dist/generators/project/project.d.ts.map +1 -1
  15. package/dist/generators/project/project.js +32 -25
  16. package/dist/generators/project/project.js.map +1 -0
  17. package/dist/generators/project/schema.d.js +3 -0
  18. package/dist/generators/project/schema.d.js.map +1 -0
  19. package/dist/generators/project/schema.d.ts +43 -0
  20. package/dist/generators/project/schema.json +94 -0
  21. package/dist/index.d.ts +2 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +5 -4
  24. package/dist/index.js.map +1 -0
  25. package/dist/package.json +65 -0
  26. package/generators.json +7 -17
  27. package/package.json +39 -28
  28. package/dist/generators/init/init.d.ts +0 -10
  29. package/dist/generators/init/init.d.ts.map +0 -1
  30. package/dist/generators/init/init.js +0 -30
  31. package/dist/generators/project/api-e2e/api-e2e.d.ts +0 -5
  32. package/dist/generators/project/api-e2e/api-e2e.d.ts.map +0 -1
  33. package/dist/generators/project/api-e2e/api-e2e.js +0 -18
package/README.md CHANGED
@@ -1,35 +1,2 @@
1
- ![Npm version](https://img.shields.io/npm/v/@vnodes/cli)
2
- ![Npm downloads](https://img.shields.io/npm/dm/@vnodes/cli)
3
- ![Build Status](https://img.shields.io/github/actions/workflow/status/vnodes/vnodes/ci.yml)
4
- ![Doc Status](https://img.shields.io/github/actions/workflow/status/vnodes/vnodes/doc.yml)
5
- ![Bundle size](https://img.shields.io/bundlephobia/min/@vnodes/cli)
1
+ # cli
6
2
 
7
- <p align="center">
8
- <img src="https://vnodes.github.io/vnodes/plugins/cli/assets/favicon.png" alt="Logo" width="200" height="200" style="border-radius: 100%"/>
9
- </p>
10
-
11
- ## @vnodes/cli
12
-
13
- Project and resource generators
14
-
15
- ## Installation
16
-
17
- ```bash
18
- pnpm add @vnodes/cli
19
- ```
20
-
21
- ## 💖 Support My Work
22
-
23
- If you find my open-source contributions or the **@vnodes/cli** project helpful, consider supporting my work. Your sponsorship helps me maintain these projects and explore new enterprise patterns.
24
-
25
- [![CashApp](https://img.shields.io/badge/Sponsor%20me-%23EA4AAA.svg?style=for-the-badge&logo=github-sponsors&logoColor=white)](https://cash.app/$puqlib)
26
-
27
- ---
28
-
29
- ## 🤝 Connect with Me
30
-
31
- <p align="left">
32
- <a href="mailto:robert.brightline+vnodes-cli@gmail.com">
33
- <img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white" />
34
- </a>
35
- </p>
@@ -0,0 +1,27 @@
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
+ },
13
+ "keepClassNames": true,
14
+ "externalHelpers": true,
15
+ "loose": false,
16
+ "preserveAllComments": true
17
+ },
18
+ "module": {
19
+ "type": "nodenext",
20
+ "strict": true,
21
+ "strictMode": true
22
+ },
23
+ "sourceMaps": true,
24
+ "exclude": [
25
+ ".*\\.spec\\.ts$"
26
+ ]
27
+ }
@@ -0,0 +1,35 @@
1
+ ![Npm version](https://img.shields.io/npm/v/<%- projectName %>)
2
+ ![Npm downloads](https://img.shields.io/npm/dm/<%- projectName %>)
3
+ ![Build Status](https://img.shields.io/github/actions/workflow/status/<%- orgName %>/<%- repoName %>/ci.yml)
4
+ ![Doc Status](https://img.shields.io/github/actions/workflow/status/<%- orgName %>/<%- repoName %>/doc.yml)
5
+ ![Bundle size](https://img.shields.io/bundlephobia/min/<%- projectName %>)
6
+
7
+ <p align="center">
8
+ <img srcset="./assets/favicon.png, <%- homePageUrl %>/<%- directory %>/assets/favicon.png" alt="Logo" width="200" height="200" style="border-radius: 100%"/>
9
+ </p>
10
+
11
+ ## <%- projectName %>
12
+
13
+ - [ ] Add project description for <%- projectName %>
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ pnpm add -D <%- projectName %>
19
+ ```
20
+
21
+ ## 💖 Support My Work
22
+
23
+ If you find my open-source contributions or the **<%- projectName %>** project helpful, consider supporting my work. Your sponsorship helps me maintain these projects and explore new enterprise patterns.
24
+
25
+ [![CashApp](https://img.shields.io/badge/Sponsor%20me-%23EA4AAA.svg?style=for-the-badge&logo=github-sponsors&logoColor=white)](https://cash.app/$puqlib)
26
+
27
+ ---
28
+
29
+ ## 🤝 Connect with Me
30
+
31
+ <p align="left">
32
+ <a href="mailto:<%- email %>">
33
+ <img src="https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white" />
34
+ </a>
35
+ </p>
@@ -0,0 +1,3 @@
1
+ import baseConfig from '../../eslint.config.mjs';
2
+
3
+ export default [...baseConfig];
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "<%- projectName %>",
3
+ "version": "<%- version %>",
4
+ "author": {
5
+ "email": "<%- email %>",
6
+ "name": "<%- authorName %>",
7
+ "url": "<%- homePageUrl %>"
8
+ },
9
+ "keywords": [
10
+ "library",
11
+ "types"
12
+ ],
13
+ "bugs": {
14
+ "email": "<%- email %>",
15
+ "url": "https://github.com/<%- orgName %>/<%- repoName %>/issues"
16
+ },
17
+ "homepage": "<%- homePageUrl %>/<%- directory %>",
18
+ "publishConfig": {
19
+ "access": "public",
20
+ "tag": "latest"
21
+ },
22
+ "funding": [
23
+ "<%- fundingUrl %>"
24
+ ],
25
+ "files": [
26
+ "dist",
27
+ "assets"
28
+ ],
29
+ "type": "module",
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "module": "./dist/index.js",
33
+ "exports": {
34
+ "./package.json": "./package.json",
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js",
38
+ "default": "./dist/index.js"
39
+ }
40
+ },
41
+ "nx": {
42
+ "sourceRoot": "<%- directory %>/src",
43
+ "tags": [
44
+ "lib:shared"
45
+ ],
46
+ "targets": {
47
+ "build": {
48
+ "executor": "@nx/js:swc",
49
+ "outputs": [
50
+ "{options.outputPath}"
51
+ ],
52
+ "options": {
53
+ "outputPath": "{projectRoot}/dist",
54
+ "main": "{projectRoot}/src/index.ts",
55
+ "tsConfig": "{projectRoot}/tsconfig.lib.json",
56
+ "skipTypeCheck": false,
57
+ "stripLeadingPaths": true
58
+ }
59
+ }
60
+ }
61
+ },
62
+ "dependencies": {
63
+ "@swc/helpers": "~0.5.18"
64
+ }
65
+ }
@@ -0,0 +1,3 @@
1
+ // @index(['./**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)
2
+
3
+ export * from './lib/<%- fileName %>.js';
@@ -0,0 +1,3 @@
1
+ export function <%- propertyName %>(){
2
+ return '<%- fileName %>';
3
+ }
@@ -0,0 +1,5 @@
1
+ describe('skip-test', () => {
2
+ it('should work', () => {
3
+ expect(1).toEqual(1);
4
+ });
5
+ });
@@ -0,0 +1,11 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "references": [
4
+ {
5
+ "path": "./tsconfig.lib.json"
6
+ },
7
+ {
8
+ "path": "./tsconfig.spec.json"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "tsBuildInfoFile": "../../tmp/builds/packages/types/ts-build-info.json",
5
+ "rootDir": "src",
6
+ "outDir": "dist",
7
+ "emitDeclarationOnly": true,
8
+ "forceConsistentCasingInFileNames": true
9
+ },
10
+ "include": [
11
+ "src/**/*.ts"
12
+ ],
13
+ "exclude": [
14
+ "src/**/*.spec.ts"
15
+ ]
16
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "outDir": "../../tmp/vitest/<%- directory %>",
5
+ "types": [
6
+ "vitest/globals",
7
+ "vitest/importMeta",
8
+ "vite/client",
9
+ "node",
10
+ "vitest"
11
+ ]
12
+ },
13
+ "include": [
14
+ "src/**/*.spec.ts",
15
+ ],
16
+ "references": [
17
+ {
18
+ "path": "./tsconfig.lib.json"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig(() => ({
4
+ root: __dirname,
5
+ cacheDir: '../../node_modules/.vite/<%- directory %>',
6
+ test: {
7
+ name: '<%- projectName %>',
8
+ watch: false,
9
+ globals: true,
10
+ environment: 'node',
11
+ include: ['src/**/*.spec.ts'],
12
+ reporters: ['default'],
13
+ coverage: {
14
+ reportsDirectory: './test-output/vitest/coverage',
15
+ provider: 'v8' as const,
16
+ },
17
+ },
18
+ }));
@@ -1,5 +1,12 @@
1
1
  import { type Tree } from '@nx/devkit';
2
- import type { ProjectGeneratorSchema } from './schema';
2
+ import { type ProjectGeneratorSchema } from './schema.d.js';
3
+ export type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {
4
+ projectName: string;
5
+ shortName: string;
6
+ sourceRoot: string;
7
+ targetRoot: string;
8
+ };
9
+ export declare function normalizeProjectSchema(options: ProjectGeneratorSchema): NormalizedProjectGeneratorOptions;
3
10
  export declare function projectGenerator(tree: Tree, options: ProjectGeneratorSchema): Promise<void>;
4
11
  export default projectGenerator;
5
12
  //# sourceMappingURL=project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/generators/project/project.ts"],"names":[],"mappings":"AACA,OAAO,EAAqC,KAAK,IAAI,EAAc,MAAM,YAAY,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEvD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,sBAAsB,iBA+BjF;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/generators/project/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAM5D,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;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,sBAAsB,GAC9B,iCAAiC,CAoBnC;AACD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,sBAAsB,iBA0BhC;AAED,eAAe,gBAAgB,CAAC"}
@@ -1,33 +1,40 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.projectGenerator = projectGenerator;
4
- const node_path_1 = require("node:path");
5
- const devkit_1 = require("@nx/devkit");
6
- async function projectGenerator(tree, options) {
7
- const parts = options.directory.split(/\//);
8
- const shortProjectName = parts[parts.length - 1];
9
- const projectName = `@${options.org}/${shortProjectName}`;
10
- const email = options.email.replace('@', `+${options.org}-${shortProjectName}@`);
11
- (0, devkit_1.generateFiles)(tree, (0, node_path_1.join)(__dirname, options.type), options.directory, {
12
- projectName,
13
- directory: options.directory,
14
- email,
15
- homepage: options.homepage,
16
- org: options.org,
17
- funding: options.funding,
18
- username: options.username,
19
- password: options.password,
20
- ...(0, devkit_1.names)(shortProjectName),
1
+ import { formatFiles, generateFiles, names, updateJson } from '@nx/devkit';
2
+ import { dirname, join } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ const __filename = fileURLToPath(import.meta.url);
5
+ const __dirname = dirname(__filename);
6
+ export function normalizeProjectSchema(options) {
7
+ const normalizedOptions = {
8
+ ...options
9
+ };
10
+ const shortName = options.directory.split('/').pop();
11
+ if (typeof shortName !== 'string') {
12
+ throw new Error(`Could not resolve the short name of the project form ${options.directory}`);
13
+ }
14
+ normalizedOptions.shortName = shortName;
15
+ normalizedOptions.sourceRoot = join(__dirname, options.projectType);
16
+ normalizedOptions.targetRoot = join(options.directory);
17
+ normalizedOptions.projectName = `@${options.orgName}/${shortName}`;
18
+ normalizedOptions.email = options.email.split('@').join(`+${options.orgName}-${shortName}@`);
19
+ return normalizedOptions;
20
+ }
21
+ export async function projectGenerator(tree, options) {
22
+ const normalizedOptions = normalizeProjectSchema(options);
23
+ generateFiles(tree, normalizedOptions.sourceRoot, normalizedOptions.targetRoot, {
24
+ ...normalizedOptions,
25
+ ...names(normalizedOptions.shortName)
21
26
  });
22
- (0, devkit_1.updateJson)(tree, 'tsconfig.json', (value) => {
23
- if (value.references === undefined || value.references === null) {
27
+ updateJson(tree, 'tsconfig.json', (value)=>{
28
+ if (!value.references) {
24
29
  value.references = [];
25
30
  }
26
31
  value.references.push({
27
- path: `./${options.directory}`,
32
+ path: `./${options.directory}`
28
33
  });
29
34
  return value;
30
35
  });
31
- await (0, devkit_1.formatFiles)(tree);
36
+ await formatFiles(tree);
32
37
  }
33
- exports.default = projectGenerator;
38
+ export default projectGenerator;
39
+
40
+ //# sourceMappingURL=project.js.map
@@ -0,0 +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 } from './schema.d.js';\nimport { fileURLToPath } from 'node:url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = dirname(__filename);\n\nexport type NormalizedProjectGeneratorOptions = ProjectGeneratorSchema & {\n projectName: string;\n shortName: string;\n sourceRoot: string;\n targetRoot: string;\n};\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\n normalizedOptions.email = options.email\n .split('@')\n .join(`+${options.orgName}-${shortName}@`);\n\n return normalizedOptions;\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 {\n ...normalizedOptions,\n ...names(normalizedOptions.shortName),\n },\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","__filename","url","__dirname","normalizeProjectSchema","options","normalizedOptions","shortName","directory","split","pop","Error","sourceRoot","projectType","targetRoot","projectName","orgName","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,aAAaD,cAAc,YAAYE,GAAG;AAChD,MAAMC,YAAYL,QAAQG;AAS1B,OAAO,SAASG,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,GAAGb,KAAKI,WAAWE,QAAQQ,WAAW;IAClEP,kBAAkBQ,UAAU,GAAGf,KAAKM,QAAQG,SAAS;IACrDF,kBAAkBS,WAAW,GAAG,CAAC,CAAC,EAAEV,QAAQW,OAAO,CAAC,CAAC,EAAET,WAAW;IAElED,kBAAkBW,KAAK,GAAGZ,QAAQY,KAAK,CACpCR,KAAK,CAAC,KACNV,IAAI,CAAC,CAAC,CAAC,EAAEM,QAAQW,OAAO,CAAC,CAAC,EAAET,UAAU,CAAC,CAAC;IAE3C,OAAOD;AACT;AACA,OAAO,eAAeY,iBACpBC,IAAU,EACVd,OAA+B;IAE/B,MAAMC,oBAAoBF,uBAAuBC;IAEjDV,cACEwB,MACAb,kBAAkBM,UAAU,EAC5BN,kBAAkBQ,UAAU,EAC5B;QACE,GAAGR,iBAAiB;QACpB,GAAGV,MAAMU,kBAAkBC,SAAS,CAAC;IACvC;IAGFV,WAAWsB,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,MAAM1B,YAAYyB;AACpB;AAEA,eAAeD,iBAAiB"}
@@ -0,0 +1,3 @@
1
+ export { };
2
+
3
+ //# sourceMappingURL=schema.d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/generators/project/schema.d.ts"],"sourcesContent":["export type ProjectType = 'lib' | 'api';\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"}
@@ -0,0 +1,43 @@
1
+ export type ProjectType = 'lib' | 'api';
2
+
3
+ export interface ProjectGeneratorSchema {
4
+ /**
5
+ * Project directory ex. `libs/types`
6
+ */
7
+ directory: string;
8
+
9
+ /**
10
+ * Project type such as `lib`, `api`
11
+ */
12
+ projectType: ProjectType;
13
+
14
+ /**
15
+ * Orgnaization name such as `vnodes` will be used the create the `projectName` `(@vnodes/project-name)`
16
+ */
17
+ orgName: string;
18
+
19
+ /**
20
+ * Repository name will be used the create relative links/urls for documentation
21
+ */
22
+ repoName: string;
23
+
24
+ /**
25
+ * The homepage url that serve the documentation for the project
26
+ */
27
+ homePageUrl: string;
28
+
29
+ /**
30
+ * Author's email addresss
31
+ */
32
+ email: string;
33
+
34
+ /**
35
+ * Funding url
36
+ */
37
+ fundingUrl: string;
38
+
39
+ /**
40
+ * Author's full name
41
+ */
42
+ authorName: string;
43
+ }
@@ -0,0 +1,94 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "Project",
4
+ "title": "Project generator schema",
5
+ "type": "object",
6
+ "properties": {
7
+ "directory": {
8
+ "type": "string",
9
+ "description": "Project directory",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What directory would you like to use?"
15
+ },
16
+ "projectType": {
17
+ "type": "string",
18
+ "description": "Project projectType",
19
+ "enum": [
20
+ "lib",
21
+ "api"
22
+ ],
23
+ "$default": {
24
+ "$source": "argv",
25
+ "index": 1
26
+ },
27
+ "x-prompt": "What projectType would you like to use?"
28
+ },
29
+ "orgName": {
30
+ "type": "string",
31
+ "description": "Organization name",
32
+ "$default": {
33
+ "$source": "argv",
34
+ "index": 2
35
+ },
36
+ "x-prompt": "What organization name would you like to use?"
37
+ },
38
+ "repoName": {
39
+ "type": "string",
40
+ "description": "Repository name",
41
+ "$default": {
42
+ "$source": "argv",
43
+ "index": 3
44
+ },
45
+ "x-prompt": "What repository name would you like to use?"
46
+ },
47
+ "homePageUrl": {
48
+ "type": "string",
49
+ "description": "Documentation homepage url",
50
+ "$default": {
51
+ "$source": "argv",
52
+ "index": 4
53
+ },
54
+ "x-prompt": "What is the homepage url for documentation website?"
55
+ },
56
+ "email": {
57
+ "type": "string",
58
+ "description": "Author email address",
59
+ "$default": {
60
+ "$source": "argv",
61
+ "index": 5
62
+ },
63
+ "x-prompt": "What is the auther email address url for documentation website?"
64
+ },
65
+ "fundingUrl": {
66
+ "type": "string",
67
+ "description": "Funding url",
68
+ "$default": {
69
+ "$source": "argv",
70
+ "index": 6
71
+ },
72
+ "x-prompt": "What is the funding url?"
73
+ },
74
+ "authorName": {
75
+ "type": "string",
76
+ "description": "Funding url",
77
+ "$default": {
78
+ "$source": "argv",
79
+ "index": 7
80
+ },
81
+ "x-prompt": "What is the author name?"
82
+ }
83
+ },
84
+ "required": [
85
+ "directory",
86
+ "projectType",
87
+ "orgName",
88
+ "repoName",
89
+ "homePageUrl",
90
+ "email",
91
+ "fundingUrl",
92
+ "authorName"
93
+ ]
94
+ }
package/dist/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- export declare const NO_EXPORTS = "NO_EXPORTS";
1
+ export * from './generators/project/project.js';
2
+ export * from './generators/project/schema.d.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,eAAe,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NO_EXPORTS = void 0;
4
- exports.NO_EXPORTS = 'NO_EXPORTS';
1
+ // @index(['./**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)
2
+ export * from './generators/project/project.js';
3
+ export * from './generators/project/schema.d.js';
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// @index(['./**/*.ts', '!./**/*.spec.ts'], f => `export * from '${f.path}.js'`)\nexport * from './generators/project/project.js';\nexport * from './generators/project/schema.d.js';\n"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,cAAc,kCAAkC;AAChD,cAAc,mCAAmC"}
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@vnodes/cli",
3
+ "version": "0.1.3",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "@vnodes/source": "./dist/index.ts",
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "default": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "generators.json"
20
+ ],
21
+ "nx": {
22
+ "sourceRoot": "plugins/cli/src",
23
+ "tags": [
24
+ "app:cli"
25
+ ],
26
+ "targets": {
27
+ "build": {
28
+ "executor": "@nx/js:swc",
29
+ "outputs": [
30
+ "{options.outputPath}"
31
+ ],
32
+ "options": {
33
+ "clean": false,
34
+ "outputPath": "{projectRoot}/dist",
35
+ "main": "{projectRoot}/src/index.ts",
36
+ "tsConfig": "{projectRoot}/tsconfig.lib.json",
37
+ "skipTypeCheck": false,
38
+ "stripLeadingPaths": true,
39
+ "assets": [
40
+ {
41
+ "input": "{projectRoot}/src",
42
+ "glob": "**/!(*.ts)",
43
+ "output": "."
44
+ },
45
+ {
46
+ "input": "{projectRoot}/src",
47
+ "glob": "**/*.d.ts",
48
+ "output": "."
49
+ }
50
+ ]
51
+ }
52
+ },
53
+ "lint": {
54
+ "dependsOn": [
55
+ "build"
56
+ ]
57
+ }
58
+ }
59
+ },
60
+ "dependencies": {
61
+ "@nx/devkit": "22.7.5",
62
+ "@swc/helpers": "~0.5.18"
63
+ },
64
+ "generators": "./generators.json"
65
+ }
package/generators.json CHANGED
@@ -1,19 +1,9 @@
1
1
  {
2
- "generators": {
3
- "project": {
4
- "factory": "./dist/generators/project/project",
5
- "schema": "./dist/generators/project/schema.json",
6
- "description": "project generator"
7
- },
8
- "init": {
9
- "factory": "./dist/generators/init/init",
10
- "schema": "./dist/generators/init/schema.json",
11
- "description": "init generator"
12
- },
13
- "api-e2e": {
14
- "factory": "./src/generators/project/api-e2e/api-e2e",
15
- "schema": "./src/generators/project/api-e2e/schema.json",
16
- "description": "api-e2e generator"
17
- }
2
+ "generators": {
3
+ "project": {
4
+ "factory": "./dist/generators/project/project.js",
5
+ "schema": "./dist/generators/project/schema.json",
6
+ "description": "project generator"
18
7
  }
19
- }
8
+ }
9
+ }
package/package.json CHANGED
@@ -1,32 +1,14 @@
1
1
  {
2
2
  "name": "@vnodes/cli",
3
- "version": "0.0.13",
4
- "description": "Project and resource generators",
5
- "homepage": "https://vnodes.github.io/vnodes/plugins/cli",
6
- "publishConfig": {
7
- "access": "public",
8
- "tag": "latest"
9
- },
10
- "author": {
11
- "email": "robert.brightline+vnodes-cli@gmail.com",
12
- "name": "Robert Brightline",
13
- "url": "https://vnodes.github.io/vnodes/plugins/cli"
14
- },
15
- "keywords": [],
16
- "icon": "https://vnodes.github.io/vnodes/plugins/cli/assets/favicon.png",
17
- "funding": [
18
- {
19
- "type": "cashapp",
20
- "url": "https://cash.app/$puqlib"
21
- }
22
- ],
3
+ "version": "0.1.3",
4
+ "type": "module",
23
5
  "main": "./dist/index.js",
24
6
  "module": "./dist/index.js",
25
7
  "types": "./dist/index.d.ts",
26
8
  "exports": {
27
9
  "./package.json": "./package.json",
28
10
  ".": {
29
- "@vnodes/source": "./src/index.ts",
11
+ "@vnodes/source": "./dist/index.ts",
30
12
  "types": "./dist/index.d.ts",
31
13
  "import": "./dist/index.js",
32
14
  "default": "./dist/index.js"
@@ -34,21 +16,50 @@
34
16
  },
35
17
  "files": [
36
18
  "dist",
37
- "!**/*.tsbuildinfo",
38
19
  "generators.json"
39
20
  ],
40
21
  "nx": {
41
22
  "sourceRoot": "plugins/cli/src",
23
+ "tags": [
24
+ "app:cli"
25
+ ],
42
26
  "targets": {
43
- "build": {},
44
- "lint": {},
45
- "test": {},
46
- "doc": {}
27
+ "build": {
28
+ "executor": "@nx/js:swc",
29
+ "outputs": [
30
+ "{options.outputPath}"
31
+ ],
32
+ "options": {
33
+ "clean": false,
34
+ "outputPath": "{projectRoot}/dist",
35
+ "main": "{projectRoot}/src/index.ts",
36
+ "tsConfig": "{projectRoot}/tsconfig.lib.json",
37
+ "skipTypeCheck": false,
38
+ "stripLeadingPaths": true,
39
+ "assets": [
40
+ {
41
+ "input": "{projectRoot}/src",
42
+ "glob": "**/!(*.ts)",
43
+ "output": "."
44
+ },
45
+ {
46
+ "input": "{projectRoot}/src",
47
+ "glob": "**/*.d.ts",
48
+ "output": "."
49
+ }
50
+ ]
51
+ }
52
+ },
53
+ "lint": {
54
+ "dependsOn": [
55
+ "build"
56
+ ]
57
+ }
47
58
  }
48
59
  },
49
60
  "dependencies": {
50
- "@nx/devkit": "22.4.5",
51
- "tslib": "^2.3.0"
61
+ "@nx/devkit": "22.7.5",
62
+ "@swc/helpers": "~0.5.18"
52
63
  },
53
64
  "generators": "./generators.json"
54
65
  }
@@ -1,10 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- /**
3
- * Some text goes here
4
- *
5
- * @param tree
6
- *
7
- */
8
- export declare function initGenerator(tree: Tree): Promise<void>;
9
- export default initGenerator;
10
- //# sourceMappingURL=init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/generators/init/init.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,IAAI,EAA6B,MAAM,YAAY,CAAC;AAEzF;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,IAAI,iBAkB7C;AAED,eAAe,aAAa,CAAC"}
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initGenerator = initGenerator;
4
- const tslib_1 = require("tslib");
5
- const path = tslib_1.__importStar(require("node:path"));
6
- const devkit_1 = require("@nx/devkit");
7
- /**
8
- * Some text goes here
9
- *
10
- * @param tree
11
- *
12
- */
13
- async function initGenerator(tree) {
14
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), devkit_1.workspaceRoot, {});
15
- await (0, devkit_1.updateJson)(tree, 'nx.json', (value) => {
16
- if (!value.generators) {
17
- value.generators = {};
18
- }
19
- if (!value.generators['@vnodes/cli:project'])
20
- value.generators['@vnodes/cli:project'] = {
21
- org: 'vnodes',
22
- email: 'robert.brightline@gmail.com',
23
- homepage: 'https://vnodes.github.io/vnodes',
24
- funding: 'https://cash.app/$puqlib',
25
- };
26
- return value;
27
- });
28
- await (0, devkit_1.formatFiles)(tree);
29
- }
30
- exports.default = initGenerator;
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { ApiE2eGeneratorSchema } from './schema';
3
- export declare function apiE2eGenerator(tree: Tree, options: ApiE2eGeneratorSchema): Promise<void>;
4
- export default apiE2eGenerator;
5
- //# sourceMappingURL=api-e2e.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api-e2e.d.ts","sourceRoot":"","sources":["../../../../src/generators/project/api-e2e/api-e2e.ts"],"names":[],"mappings":"AACA,OAAO,EAAuD,IAAI,EAAE,MAAM,YAAY,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,qBAAqB,iBAU/E;AAED,eAAe,eAAe,CAAC"}
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.apiE2eGenerator = apiE2eGenerator;
4
- const tslib_1 = require("tslib");
5
- const path = tslib_1.__importStar(require("node:path"));
6
- const devkit_1 = require("@nx/devkit");
7
- async function apiE2eGenerator(tree, options) {
8
- const projectRoot = `libs/${options.name}`;
9
- (0, devkit_1.addProjectConfiguration)(tree, options.name, {
10
- root: projectRoot,
11
- projectType: 'library',
12
- sourceRoot: `${projectRoot}/src`,
13
- targets: {},
14
- });
15
- (0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), projectRoot, options);
16
- await (0, devkit_1.formatFiles)(tree);
17
- }
18
- exports.default = apiE2eGenerator;