@gadmin2n/cli 0.0.73

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 (182) hide show
  1. package/.circleci/config.yml +62 -0
  2. package/.claude/settings.local.json +7 -0
  3. package/.github/ISSUE_TEMPLATE/Bug_report.yml +106 -0
  4. package/.github/ISSUE_TEMPLATE/Feature_request.yml +52 -0
  5. package/.github/ISSUE_TEMPLATE/Regression.yml +78 -0
  6. package/.github/ISSUE_TEMPLATE/config.yml +7 -0
  7. package/.github/PULL_REQUEST_TEMPLATE.md +41 -0
  8. package/LICENSE +24 -0
  9. package/README.md +56 -0
  10. package/actions/abstract.action.d.ts +4 -0
  11. package/actions/abstract.action.js +6 -0
  12. package/actions/add.action.d.ts +12 -0
  13. package/actions/add.action.js +129 -0
  14. package/actions/build.action.d.ts +27 -0
  15. package/actions/build.action.js +108 -0
  16. package/actions/generate.action.d.ts +5 -0
  17. package/actions/generate.action.js +95 -0
  18. package/actions/index.d.ts +8 -0
  19. package/actions/index.js +24 -0
  20. package/actions/info.action.d.ts +28 -0
  21. package/actions/info.action.js +129 -0
  22. package/actions/new.action.d.ts +7 -0
  23. package/actions/new.action.js +294 -0
  24. package/actions/prisma.action.d.ts +5 -0
  25. package/actions/prisma.action.js +153 -0
  26. package/actions/start.action.d.ts +9 -0
  27. package/actions/start.action.js +115 -0
  28. package/actions/update.action.d.ts +5 -0
  29. package/actions/update.action.js +26 -0
  30. package/bin/gadmin.d.ts +2 -0
  31. package/bin/gadmin.js +25 -0
  32. package/commands/abstract.command.d.ts +7 -0
  33. package/commands/abstract.command.js +9 -0
  34. package/commands/add.command.d.ts +5 -0
  35. package/commands/add.command.js +43 -0
  36. package/commands/build.command.d.ts +5 -0
  37. package/commands/build.command.js +50 -0
  38. package/commands/command.input.d.ts +25 -0
  39. package/commands/command.input.js +28 -0
  40. package/commands/command.loader.d.ts +5 -0
  41. package/commands/command.loader.js +33 -0
  42. package/commands/generate.command.d.ts +7 -0
  43. package/commands/generate.command.js +105 -0
  44. package/commands/index.d.ts +2 -0
  45. package/commands/index.js +18 -0
  46. package/commands/info.command.d.ts +5 -0
  47. package/commands/info.command.js +25 -0
  48. package/commands/new.command.d.ts +5 -0
  49. package/commands/new.command.js +52 -0
  50. package/commands/start.command.d.ts +5 -0
  51. package/commands/start.command.js +64 -0
  52. package/commands/update.command.d.ts +5 -0
  53. package/commands/update.command.js +30 -0
  54. package/lib/compiler/assets-manager.d.ts +15 -0
  55. package/lib/compiler/assets-manager.js +103 -0
  56. package/lib/compiler/compiler.d.ts +12 -0
  57. package/lib/compiler/compiler.js +60 -0
  58. package/lib/compiler/defaults/webpack-defaults.d.ts +3 -0
  59. package/lib/compiler/defaults/webpack-defaults.js +95 -0
  60. package/lib/compiler/helpers/append-extension.d.ts +1 -0
  61. package/lib/compiler/helpers/append-extension.js +8 -0
  62. package/lib/compiler/helpers/copy-path-resolve.d.ts +7 -0
  63. package/lib/compiler/helpers/copy-path-resolve.js +26 -0
  64. package/lib/compiler/helpers/get-value-or-default.d.ts +4 -0
  65. package/lib/compiler/helpers/get-value-or-default.js +67 -0
  66. package/lib/compiler/helpers/tsconfig-provider.d.ts +11 -0
  67. package/lib/compiler/helpers/tsconfig-provider.js +22 -0
  68. package/lib/compiler/hooks/tsconfig-paths.hook.d.ts +2 -0
  69. package/lib/compiler/hooks/tsconfig-paths.hook.js +70 -0
  70. package/lib/compiler/plugins-loader.d.ts +21 -0
  71. package/lib/compiler/plugins-loader.js +54 -0
  72. package/lib/compiler/typescript-loader.d.ts +6 -0
  73. package/lib/compiler/typescript-loader.js +31 -0
  74. package/lib/compiler/watch-compiler.d.ts +14 -0
  75. package/lib/compiler/watch-compiler.js +70 -0
  76. package/lib/compiler/webpack-compiler.d.ts +9 -0
  77. package/lib/compiler/webpack-compiler.js +74 -0
  78. package/lib/compiler/workspace-utils.d.ts +4 -0
  79. package/lib/compiler/workspace-utils.js +26 -0
  80. package/lib/configuration/configuration.d.ts +52 -0
  81. package/lib/configuration/configuration.js +2 -0
  82. package/lib/configuration/configuration.loader.d.ts +4 -0
  83. package/lib/configuration/configuration.loader.js +2 -0
  84. package/lib/configuration/defaults.d.ts +4 -0
  85. package/lib/configuration/defaults.js +56 -0
  86. package/lib/configuration/gadmin-configuration.loader.d.ts +8 -0
  87. package/lib/configuration/gadmin-configuration.loader.js +39 -0
  88. package/lib/configuration/index.d.ts +3 -0
  89. package/lib/configuration/index.js +19 -0
  90. package/lib/dependency-managers/index.d.ts +1 -0
  91. package/lib/dependency-managers/index.js +17 -0
  92. package/lib/dependency-managers/nest.dependency-manager.d.ts +7 -0
  93. package/lib/dependency-managers/nest.dependency-manager.js +48 -0
  94. package/lib/package-managers/abstract.package-manager.d.ts +25 -0
  95. package/lib/package-managers/abstract.package-manager.js +185 -0
  96. package/lib/package-managers/index.d.ts +8 -0
  97. package/lib/package-managers/index.js +24 -0
  98. package/lib/package-managers/npm.package-manager.d.ts +7 -0
  99. package/lib/package-managers/npm.package-manager.js +26 -0
  100. package/lib/package-managers/package-manager-commands.d.ts +9 -0
  101. package/lib/package-managers/package-manager-commands.js +2 -0
  102. package/lib/package-managers/package-manager.d.ts +5 -0
  103. package/lib/package-managers/package-manager.factory.d.ts +6 -0
  104. package/lib/package-managers/package-manager.factory.js +54 -0
  105. package/lib/package-managers/package-manager.js +9 -0
  106. package/lib/package-managers/pnpm.package-manager.d.ts +7 -0
  107. package/lib/package-managers/pnpm.package-manager.js +27 -0
  108. package/lib/package-managers/project.dependency.d.ts +4 -0
  109. package/lib/package-managers/project.dependency.js +2 -0
  110. package/lib/package-managers/yarn.package-manager.d.ts +7 -0
  111. package/lib/package-managers/yarn.package-manager.js +26 -0
  112. package/lib/questions/questions.d.ts +2 -0
  113. package/lib/questions/questions.js +23 -0
  114. package/lib/readers/file-system.reader.d.ts +8 -0
  115. package/lib/readers/file-system.reader.js +61 -0
  116. package/lib/readers/index.d.ts +2 -0
  117. package/lib/readers/index.js +18 -0
  118. package/lib/readers/reader.d.ts +5 -0
  119. package/lib/readers/reader.js +2 -0
  120. package/lib/runners/abstract.runner.d.ts +11 -0
  121. package/lib/runners/abstract.runner.js +55 -0
  122. package/lib/runners/git.runner.d.ts +4 -0
  123. package/lib/runners/git.runner.js +10 -0
  124. package/lib/runners/index.d.ts +3 -0
  125. package/lib/runners/index.js +19 -0
  126. package/lib/runners/npm.runner.d.ts +4 -0
  127. package/lib/runners/npm.runner.js +10 -0
  128. package/lib/runners/pnpm.runner.d.ts +4 -0
  129. package/lib/runners/pnpm.runner.js +10 -0
  130. package/lib/runners/runner.d.ts +6 -0
  131. package/lib/runners/runner.factory.d.ts +8 -0
  132. package/lib/runners/runner.factory.js +26 -0
  133. package/lib/runners/runner.js +10 -0
  134. package/lib/runners/schematic.runner.d.ts +6 -0
  135. package/lib/runners/schematic.runner.js +21 -0
  136. package/lib/runners/yarn.runner.d.ts +4 -0
  137. package/lib/runners/yarn.runner.js +10 -0
  138. package/lib/schematics/abstract.collection.d.ts +10 -0
  139. package/lib/schematics/abstract.collection.js +34 -0
  140. package/lib/schematics/collection.d.ts +3 -0
  141. package/lib/schematics/collection.factory.d.ts +5 -0
  142. package/lib/schematics/collection.factory.js +18 -0
  143. package/lib/schematics/collection.js +7 -0
  144. package/lib/schematics/custom.collection.d.ts +3 -0
  145. package/lib/schematics/custom.collection.js +7 -0
  146. package/lib/schematics/gadmin.collection.d.ts +16 -0
  147. package/lib/schematics/gadmin.collection.js +142 -0
  148. package/lib/schematics/index.d.ts +4 -0
  149. package/lib/schematics/index.js +20 -0
  150. package/lib/schematics/schematic.option.d.ts +8 -0
  151. package/lib/schematics/schematic.option.js +44 -0
  152. package/lib/ui/banner.d.ts +1 -0
  153. package/lib/ui/banner.js +11 -0
  154. package/lib/ui/emojis.d.ts +19 -0
  155. package/lib/ui/emojis.js +23 -0
  156. package/lib/ui/errors.d.ts +4 -0
  157. package/lib/ui/errors.js +8 -0
  158. package/lib/ui/index.d.ts +5 -0
  159. package/lib/ui/index.js +21 -0
  160. package/lib/ui/messages.d.ts +26 -0
  161. package/lib/ui/messages.js +34 -0
  162. package/lib/ui/prefixes.d.ts +2 -0
  163. package/lib/ui/prefixes.js +6 -0
  164. package/lib/utils/formatting.d.ts +8 -0
  165. package/lib/utils/formatting.js +19 -0
  166. package/lib/utils/is-error.d.ts +1 -0
  167. package/lib/utils/is-error.js +11 -0
  168. package/lib/utils/load-configuration.d.ts +2 -0
  169. package/lib/utils/load-configuration.js +21 -0
  170. package/lib/utils/local-binaries.d.ts +3 -0
  171. package/lib/utils/local-binaries.js +16 -0
  172. package/lib/utils/project-utils.d.ts +8 -0
  173. package/lib/utils/project-utils.js +69 -0
  174. package/lib/utils/remaining-flags.d.ts +2 -0
  175. package/lib/utils/remaining-flags.js +37 -0
  176. package/lib/utils/tree-kill.d.ts +1 -0
  177. package/lib/utils/tree-kill.js +66 -0
  178. package/package.json +105 -0
  179. package/test/lib/compiler/hooks/__snapshots__/tsconfig-paths.hook.spec.ts.snap +68 -0
  180. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/bar.tsx +1 -0
  181. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/baz.js +1 -0
  182. package/test/lib/compiler/hooks/fixtures/aliased-imports/src/qux.jsx +1 -0
@@ -0,0 +1,62 @@
1
+ version: 2
2
+
3
+ aliases:
4
+ - &restore-cache
5
+ restore_cache:
6
+ key: dependency-cache-{{ checksum "package.json" }}
7
+ - &install-deps
8
+ run:
9
+ name: Install dependencies
10
+ command: npm ci
11
+ - &build-packages
12
+ run:
13
+ name: Build
14
+ command: npm run build
15
+ - &run-unit-tests
16
+ run:
17
+ name: Test
18
+ command: npm run test
19
+
20
+ jobs:
21
+ build:
22
+ working_directory: ~/nest
23
+ docker:
24
+ - image: circleci/node:17
25
+ steps:
26
+ - checkout
27
+ - run:
28
+ name: Update NPM version
29
+ command: 'sudo npm install -g npm@latest'
30
+ - restore_cache:
31
+ key: dependency-cache-{{ checksum "package.json" }}
32
+ - run:
33
+ name: Install dependencies
34
+ command: npm ci
35
+ - save_cache:
36
+ key: dependency-cache-{{ checksum "package.json" }}
37
+ paths:
38
+ - ./node_modules
39
+ - run:
40
+ name: Build
41
+ command: npm run build
42
+
43
+ unit_tests:
44
+ working_directory: ~/nest
45
+ docker:
46
+ - image: circleci/node:17
47
+ steps:
48
+ - checkout
49
+ - *restore-cache
50
+ - *install-deps
51
+ - *build-packages
52
+ - *run-unit-tests
53
+
54
+ workflows:
55
+ version: 2
56
+ build-and-test:
57
+ jobs:
58
+ - build
59
+ - unit_tests:
60
+ requires:
61
+ - build
62
+
@@ -0,0 +1,7 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(npx ts-node:*)"
5
+ ]
6
+ }
7
+ }
@@ -0,0 +1,106 @@
1
+ name: "\U0001F41B Bug Report"
2
+ description: "If something isn't working as expected \U0001F914"
3
+ labels: ["needs triage", "bug"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ ## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
9
+
10
+ If you are not sure that your issue is a bug, you could:
11
+
12
+ - use our [Discord community](https://discord.gg/NestJS)
13
+ - use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
14
+ - If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
15
+
16
+ **NOTE:** You don't need to answer questions that you know that aren't relevant.
17
+
18
+ ---
19
+
20
+ - type: checkboxes
21
+ attributes:
22
+ label: "Is there an existing issue for this?"
23
+ description: "Please search [here](./?q=is%3Aissue) to see if an issue already exists for the bug you encountered"
24
+ options:
25
+ - label: "I have searched the existing issues"
26
+ required: true
27
+
28
+ - type: textarea
29
+ validations:
30
+ required: true
31
+ attributes:
32
+ label: "Current behavior"
33
+ description: "How the issue manifests?"
34
+
35
+ - type: input
36
+ validations:
37
+ required: true
38
+ attributes:
39
+ label: "Minimum reproduction code"
40
+ description: "An URL to some git repository or gist that reproduces this issue. [Wtf is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)"
41
+ placeholder: "https://github.com/..."
42
+
43
+ - type: textarea
44
+ attributes:
45
+ label: "Steps to reproduce"
46
+ description: |
47
+ How the issue manifests?
48
+ You could leave this blank if you alread write this in your reproduction code/repo
49
+ placeholder: |
50
+ 1. `npm i`
51
+ 2. `npm start:dev`
52
+ 3. See error...
53
+
54
+ - type: textarea
55
+ validations:
56
+ required: true
57
+ attributes:
58
+ label: "Expected behavior"
59
+ description: "A clear and concise description of what you expected to happend (or code)"
60
+
61
+ - type: markdown
62
+ attributes:
63
+ value: |
64
+ ---
65
+
66
+ - type: input
67
+ validations:
68
+ required: true
69
+ attributes:
70
+ label: "Package version"
71
+ description: |
72
+ Which version of `@nestjs/cli` are you using?
73
+ **Tip**: Make sure that all of yours `@nestjs/*` dependencies are in sync!
74
+ placeholder: "8.1.3"
75
+
76
+ - type: input
77
+ attributes:
78
+ label: "NestJS version"
79
+ description: "Which version of `@nestjs/core` are you using?"
80
+ placeholder: "8.1.3"
81
+
82
+ - type: input
83
+ attributes:
84
+ label: "Node.js version"
85
+ description: "Which version of Node.js are you using?"
86
+ placeholder: "14.17.6"
87
+
88
+ - type: checkboxes
89
+ attributes:
90
+ label: "In which operating systems have you tested?"
91
+ options:
92
+ - label: macOS
93
+ - label: Windows
94
+ - label: Linux
95
+
96
+ - type: markdown
97
+ attributes:
98
+ value: |
99
+ ---
100
+
101
+ - type: textarea
102
+ attributes:
103
+ label: "Other"
104
+ description: |
105
+ Anything else relevant? eg: Logs, OS version, IDE, package manager, etc.
106
+ **Tip:** You can attach images, recordings or log files by clicking this area to highlight it and then dragging files in
@@ -0,0 +1,52 @@
1
+ name: "\U0001F680 Feature Request"
2
+ description: "I have a suggestion \U0001F63B!"
3
+ labels: ["feature"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ ## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
9
+
10
+ If you are not sure that your issue is a bug, you could:
11
+
12
+ - use our [Discord community](https://discord.gg/NestJS)
13
+ - use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
14
+ - If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
15
+
16
+ ---
17
+
18
+ - type: checkboxes
19
+ attributes:
20
+ label: "Is there an existing issue that is already proposing this?"
21
+ description: "Please search [here](./?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
22
+ options:
23
+ - label: "I have searched the existing issues"
24
+ required: true
25
+
26
+ - type: textarea
27
+ validations:
28
+ required: true
29
+ attributes:
30
+ label: "Is your feature request related to a problem? Please describe it"
31
+ description: "A clear and concise description of what the problem is"
32
+ placeholder: |
33
+ I have an issue when ...
34
+
35
+ - type: textarea
36
+ validations:
37
+ required: true
38
+ attributes:
39
+ label: "Describe the solution you'd like"
40
+ description: "A clear and concise description of what you want to happen. Add any considered drawbacks"
41
+
42
+ - type: textarea
43
+ attributes:
44
+ label: "Teachability, documentation, adoption, migration strategy"
45
+ description: "If you can, explain how users will be able to use this and possibly write out a version the docs. Maybe a screenshot or design?"
46
+
47
+ - type: textarea
48
+ validations:
49
+ required: true
50
+ attributes:
51
+ label: "What is the motivation / use case for changing the behavior?"
52
+ description: "Describe the motivation or the concrete use case"
@@ -0,0 +1,78 @@
1
+ name: "\U0001F4A5 Regression"
2
+ description: "Report an unexpected behavior while upgrading your Nest application!"
3
+ labels: ["needs triage"]
4
+ body:
5
+ - type: markdown
6
+ attributes:
7
+ value: |
8
+ ## :warning: We use GitHub Issues to track bug reports, feature requests and regressions
9
+
10
+ If you are not sure that your issue is a bug, you could:
11
+
12
+ - use our [Discord community](https://discord.gg/NestJS)
13
+ - use [StackOverflow using the tag `nestjs`](https://stackoverflow.com/questions/tagged/nestjs)
14
+ - If it's just a quick question you can ping [our Twitter](https://twitter.com/nestframework)
15
+
16
+ **NOTE:** You don't need to answer questions that you know that aren't relevant.
17
+
18
+ ---
19
+
20
+ - type: checkboxes
21
+ attributes:
22
+ label: "Did you read the migration guide?"
23
+ description: "Check out the [migration guide here](https://docs.nestjs.com/migration-guide)!"
24
+ options:
25
+ - label: "I have read the whole migration guide"
26
+ required: false
27
+
28
+ - type: checkboxes
29
+ attributes:
30
+ label: "Is there an existing issue that is already proposing this?"
31
+ description: "Please search [here](./?q=is%3Aissue) to see if an issue already exists for the feature you are requesting"
32
+ options:
33
+ - label: "I have searched the existing issues"
34
+ required: true
35
+
36
+ - type: input
37
+ attributes:
38
+ label: "Potential Commit/PR that introduced the regression"
39
+ description: "If you have time to investigate, what PR/date/version introduced this issue"
40
+ placeholder: "PR #123 or commit 5b3c4a4"
41
+
42
+ - type: input
43
+ attributes:
44
+ label: "Versions"
45
+ description: "From which version of `@nestjs/cli` to which version you are upgrading"
46
+ placeholder: "8.1.0 -> 8.1.3"
47
+
48
+ - type: textarea
49
+ validations:
50
+ required: true
51
+ attributes:
52
+ label: "Describe the regression"
53
+ description: "A clear and concise description of what the regression is"
54
+
55
+ - type: textarea
56
+ attributes:
57
+ label: "Minimum reproduction code"
58
+ description: |
59
+ Please share a git repo, a gist, or step-by-step instructions. [Wtf is a minimum reproduction?](https://jmcdo29.github.io/wtf-is-a-minimum-reproduction)
60
+ **Tip:** If you leave a minimum repository, we will understand your issue faster!
61
+ value: |
62
+ ```ts
63
+
64
+ ```
65
+
66
+ - type: textarea
67
+ validations:
68
+ required: true
69
+ attributes:
70
+ label: "Expected behavior"
71
+ description: "A clear and concise description of what you expected to happend (or code)"
72
+
73
+ - type: textarea
74
+ attributes:
75
+ label: "Other"
76
+ description: |
77
+ Anything else relevant? eg: Logs, OS version, IDE, package manager, etc.
78
+ **Tip:** You can attach images, recordings or log files by clicking this area to highlight it and then dragging files in
@@ -0,0 +1,7 @@
1
+ ## To encourage contributors to use issue templates, we don't allow blank issues
2
+ blank_issues_enabled: false
3
+
4
+ contact_links:
5
+ - name: "\u2753 Discord Community of NestJS"
6
+ url: "https://discord.gg/NestJS"
7
+ about: "Please ask support questions or discuss suggestions/enhancements here."
@@ -0,0 +1,41 @@
1
+ ## PR Checklist
2
+ Please check if your PR fulfills the following requirements:
3
+
4
+ - [ ] The commit message follows our guidelines: https://github.com/nestjs/nest/blob/master/CONTRIBUTING.md
5
+ - [ ] Tests for the changes have been added (for bug fixes / features)
6
+ - [ ] Docs have been added / updated (for bug fixes / features)
7
+
8
+
9
+ ## PR Type
10
+ What kind of change does this PR introduce?
11
+
12
+ <!-- Please check the one that applies to this PR using "x". -->
13
+ ```
14
+ [ ] Bugfix
15
+ [ ] Feature
16
+ [ ] Code style update (formatting, local variables)
17
+ [ ] Refactoring (no functional changes, no api changes)
18
+ [ ] Build related changes
19
+ [ ] CI related changes
20
+ [ ] Other... Please describe:
21
+ ```
22
+
23
+ ## What is the current behavior?
24
+ <!-- Please describe the current behavior that you are modifying, or link to a relevant issue. -->
25
+
26
+ Issue Number: N/A
27
+
28
+
29
+ ## What is the new behavior?
30
+
31
+
32
+ ## Does this PR introduce a breaking change?
33
+ ```
34
+ [ ] Yes
35
+ [ ] No
36
+ ```
37
+
38
+ <!-- If this PR contains a breaking change, please describe the impact and migration path for existing applications below. -->
39
+
40
+
41
+ ## Other information
package/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2022
4
+ Kamil Mysliwiec <https://kamilmysliwiec.com>
5
+ Thomas Ricart <thomasr2309@gmail.com>
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining
8
+ a copy of this software and associated documentation files (the
9
+ 'Software'), to deal in the Software without restriction, including
10
+ without limitation the rights to use, copy, modify, merge, publish,
11
+ distribute, sublicense, and/or sell copies of the Software, and to
12
+ permit persons to whom the Software is furnished to do so, subject to
13
+ the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # Description
2
+
3
+ The gadmin2 CLI is a command-line interface tool that helps you to initialize, develop, and maintain your gadmin applications. It assists in multiple ways, including scaffolding the project, serving it in development mode, and building and bundling the application for production distribution. It embodies best-practice architectural patterns to encourage well-structured apps.
4
+
5
+ The CLI works with [schematics](https://github.com/angular/angular-cli/tree/master/packages/angular_devkit/schematics), and provides built in support from the schematics collection at [@gadmin2n/schematics](https://www.npmjs.com/package/@gadmin2n/schematics).
6
+
7
+
8
+ ## Installation
9
+ ```
10
+ $ yarn global add @gadmin2n/cli@latest
11
+ ```
12
+ Check CLI version
13
+ ```
14
+ $ gadmin2 -v
15
+ ```
16
+
17
+ ## Usage
18
+ ### CLI cmd list
19
+ ```
20
+ $ gadmin2 --help
21
+ ```
22
+
23
+ ### Create a Gadmin project
24
+ ```
25
+ $ gadmin2 n [app-name]
26
+ ```
27
+
28
+ ### Define data model
29
+ ```
30
+ $ cd app-name
31
+ $ vi config/schema.prisma
32
+ ```
33
+
34
+ ### Generate code after edit config/schema.prisma
35
+ ```
36
+ $ gadmin2 g primsa
37
+ ```
38
+
39
+ ### Start web DevServer
40
+ ```
41
+ $ cd web
42
+ $ yarn dev
43
+ ```
44
+
45
+ ### Start server(nestjs) DevServer
46
+ ```
47
+ $ cd server
48
+ $ yarn start:dev
49
+ ```
50
+ About nestjs server [read more](https://ptc.coding.intlgame.com/p/gadmin2/d/schematics/git/tree/master/src/lib/application/files/server/nest/README.md)
51
+
52
+ If using Golang server,[read more](https://ptc.coding.intlgame.com/p/gadmin2/d/schematics/git/tree/master/src/lib/application/files/server/go/README.md)
53
+
54
+
55
+ ## License
56
+ Gadmin is [MIT licensed](LICENSE).
@@ -0,0 +1,4 @@
1
+ import { Input } from '../commands';
2
+ export declare abstract class AbstractAction {
3
+ abstract handle(inputs?: Input[], options?: Input[], extraFlags?: string[]): Promise<void>;
4
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AbstractAction = void 0;
4
+ class AbstractAction {
5
+ }
6
+ exports.AbstractAction = AbstractAction;
@@ -0,0 +1,12 @@
1
+ import { Input } from '../commands';
2
+ import { AbstractAction } from './abstract.action';
3
+ export declare class AddAction extends AbstractAction {
4
+ handle(inputs: Input[], options: Input[], extraFlags: string[]): Promise<void>;
5
+ private getSourceRoot;
6
+ private installPackage;
7
+ private addLibrary;
8
+ private getLibraryName;
9
+ private getPackageName;
10
+ private getCollectionName;
11
+ private getTagName;
12
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.AddAction = void 0;
13
+ const chalk = require("chalk");
14
+ const get_value_or_default_1 = require("../lib/compiler/helpers/get-value-or-default");
15
+ const package_managers_1 = require("../lib/package-managers");
16
+ const schematics_1 = require("../lib/schematics");
17
+ const ui_1 = require("../lib/ui");
18
+ const load_configuration_1 = require("../lib/utils/load-configuration");
19
+ const project_utils_1 = require("../lib/utils/project-utils");
20
+ const abstract_action_1 = require("./abstract.action");
21
+ const schematicName = 'nest-add';
22
+ class AddAction extends abstract_action_1.AbstractAction {
23
+ handle(inputs, options, extraFlags) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const libraryName = this.getLibraryName(inputs);
26
+ const packageName = this.getPackageName(libraryName);
27
+ const collectionName = this.getCollectionName(libraryName, packageName);
28
+ const tagName = this.getTagName(packageName);
29
+ const packageInstallSuccess = yield this.installPackage(collectionName, tagName);
30
+ if (packageInstallSuccess) {
31
+ const sourceRootOption = yield this.getSourceRoot(inputs.concat(options));
32
+ options.push(sourceRootOption);
33
+ yield this.addLibrary(collectionName, options, extraFlags);
34
+ }
35
+ else {
36
+ console.error(chalk.red(ui_1.MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName)));
37
+ throw new Error(ui_1.MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName));
38
+ }
39
+ });
40
+ }
41
+ getSourceRoot(inputs) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const configuration = yield (0, load_configuration_1.loadConfiguration)();
44
+ const configurationProjects = configuration.projects;
45
+ const appName = inputs.find((option) => option.name === 'project')
46
+ .value;
47
+ let sourceRoot = appName
48
+ ? (0, get_value_or_default_1.getValueOrDefault)(configuration, 'sourceRoot', appName)
49
+ : configuration.sourceRoot;
50
+ const shouldAsk = (0, project_utils_1.shouldAskForProject)(schematicName, configurationProjects, appName);
51
+ if (shouldAsk) {
52
+ const defaultLabel = ' [ Default ]';
53
+ let defaultProjectName = configuration.sourceRoot + defaultLabel;
54
+ for (const property in configurationProjects) {
55
+ if (configurationProjects[property].sourceRoot ===
56
+ configuration.sourceRoot) {
57
+ defaultProjectName = property + defaultLabel;
58
+ break;
59
+ }
60
+ }
61
+ const projects = (0, project_utils_1.moveDefaultProjectToStart)(configuration, defaultProjectName, defaultLabel);
62
+ const answers = yield (0, project_utils_1.askForProjectName)(ui_1.MESSAGES.LIBRARY_PROJECT_SELECTION_QUESTION, projects);
63
+ const project = answers.appName.replace(defaultLabel, '');
64
+ if (project !== configuration.sourceRoot) {
65
+ sourceRoot = configurationProjects[project].sourceRoot;
66
+ }
67
+ }
68
+ return { name: 'sourceRoot', value: sourceRoot };
69
+ });
70
+ }
71
+ installPackage(collectionName, tagName) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ const manager = yield package_managers_1.PackageManagerFactory.find();
74
+ tagName = tagName || 'latest';
75
+ let installResult = false;
76
+ try {
77
+ installResult = yield manager.addProduction([collectionName], tagName);
78
+ }
79
+ catch (error) {
80
+ if (error && error.message) {
81
+ console.error(chalk.red(error.message));
82
+ }
83
+ }
84
+ return installResult;
85
+ });
86
+ }
87
+ addLibrary(collectionName, options, extraFlags) {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ console.info(ui_1.MESSAGES.LIBRARY_INSTALLATION_STARTS);
90
+ const schematicOptions = [];
91
+ schematicOptions.push(new schematics_1.SchematicOption('sourceRoot', options.find((option) => option.name === 'sourceRoot').value));
92
+ const extraFlagsString = extraFlags ? extraFlags.join(' ') : undefined;
93
+ try {
94
+ const collection = schematics_1.CollectionFactory.create(collectionName);
95
+ yield collection.execute(schematicName, schematicOptions, extraFlagsString);
96
+ }
97
+ catch (error) {
98
+ if (error && error.message) {
99
+ console.error(chalk.red(error.message));
100
+ return Promise.reject();
101
+ }
102
+ }
103
+ });
104
+ }
105
+ getLibraryName(inputs) {
106
+ const libraryInput = inputs.find((input) => input.name === 'library');
107
+ if (!libraryInput) {
108
+ throw new Error('No library found in command input');
109
+ }
110
+ return libraryInput.value;
111
+ }
112
+ getPackageName(library) {
113
+ return library.startsWith('@')
114
+ ? library.split('/', 2).join('/')
115
+ : library.split('/', 1)[0];
116
+ }
117
+ getCollectionName(library, packageName) {
118
+ return ((packageName.startsWith('@')
119
+ ? packageName.split('@', 2).join('@')
120
+ : packageName.split('@', 1).join('@')) +
121
+ library.slice(packageName.length));
122
+ }
123
+ getTagName(packageName) {
124
+ return packageName.startsWith('@')
125
+ ? packageName.split('@', 3)[2]
126
+ : packageName.split('@', 2)[1];
127
+ }
128
+ }
129
+ exports.AddAction = AddAction;
@@ -0,0 +1,27 @@
1
+ import { Input } from '../commands';
2
+ import { AssetsManager } from '../lib/compiler/assets-manager';
3
+ import { Compiler } from '../lib/compiler/compiler';
4
+ import { TsConfigProvider } from '../lib/compiler/helpers/tsconfig-provider';
5
+ import { PluginsLoader } from '../lib/compiler/plugins-loader';
6
+ import { TypeScriptBinaryLoader } from '../lib/compiler/typescript-loader';
7
+ import { WatchCompiler } from '../lib/compiler/watch-compiler';
8
+ import { WebpackCompiler } from '../lib/compiler/webpack-compiler';
9
+ import { WorkspaceUtils } from '../lib/compiler/workspace-utils';
10
+ import { ConfigurationLoader } from '../lib/configuration';
11
+ import { FileSystemReader } from '../lib/readers';
12
+ import { AbstractAction } from './abstract.action';
13
+ export declare class BuildAction extends AbstractAction {
14
+ protected readonly pluginsLoader: PluginsLoader;
15
+ protected readonly tsLoader: TypeScriptBinaryLoader;
16
+ protected readonly tsConfigProvider: TsConfigProvider;
17
+ protected readonly compiler: Compiler;
18
+ protected readonly webpackCompiler: WebpackCompiler;
19
+ protected readonly watchCompiler: WatchCompiler;
20
+ protected readonly fileSystemReader: FileSystemReader;
21
+ protected readonly loader: ConfigurationLoader;
22
+ protected readonly assetsManager: AssetsManager;
23
+ protected readonly workspaceUtils: WorkspaceUtils;
24
+ handle(inputs: Input[], options: Input[]): Promise<void>;
25
+ runBuild(inputs: Input[], options: Input[], watchMode: boolean, watchAssetsMode: boolean, isDebugEnabled?: boolean, onSuccess?: () => void): Promise<void>;
26
+ private getWebpackConfigFactoryByPath;
27
+ }