@fnd-platform/cli 1.0.0-alpha.1

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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +224 -0
  3. package/lib/bin/fnd.d.ts +3 -0
  4. package/lib/bin/fnd.d.ts.map +1 -0
  5. package/lib/bin/fnd.js +9 -0
  6. package/lib/bin/fnd.js.map +1 -0
  7. package/lib/commands/add.d.ts +28 -0
  8. package/lib/commands/add.d.ts.map +1 -0
  9. package/lib/commands/add.js +547 -0
  10. package/lib/commands/add.js.map +1 -0
  11. package/lib/commands/build.d.ts +62 -0
  12. package/lib/commands/build.d.ts.map +1 -0
  13. package/lib/commands/build.js +155 -0
  14. package/lib/commands/build.js.map +1 -0
  15. package/lib/commands/deploy.d.ts +67 -0
  16. package/lib/commands/deploy.d.ts.map +1 -0
  17. package/lib/commands/deploy.js +160 -0
  18. package/lib/commands/deploy.js.map +1 -0
  19. package/lib/commands/index.d.ts +6 -0
  20. package/lib/commands/index.d.ts.map +1 -0
  21. package/lib/commands/index.js +14 -0
  22. package/lib/commands/index.js.map +1 -0
  23. package/lib/commands/new.d.ts +47 -0
  24. package/lib/commands/new.d.ts.map +1 -0
  25. package/lib/commands/new.js +199 -0
  26. package/lib/commands/new.js.map +1 -0
  27. package/lib/commands/synth.d.ts +39 -0
  28. package/lib/commands/synth.d.ts.map +1 -0
  29. package/lib/commands/synth.js +72 -0
  30. package/lib/commands/synth.js.map +1 -0
  31. package/lib/index.d.ts +15 -0
  32. package/lib/index.d.ts.map +1 -0
  33. package/lib/index.js +43 -0
  34. package/lib/index.js.map +1 -0
  35. package/lib/lib/infra-generator.d.ts +24 -0
  36. package/lib/lib/infra-generator.d.ts.map +1 -0
  37. package/lib/lib/infra-generator.js +193 -0
  38. package/lib/lib/infra-generator.js.map +1 -0
  39. package/lib/lib/logger.d.ts +50 -0
  40. package/lib/lib/logger.d.ts.map +1 -0
  41. package/lib/lib/logger.js +102 -0
  42. package/lib/lib/logger.js.map +1 -0
  43. package/lib/lib/nx-stats.d.ts +69 -0
  44. package/lib/lib/nx-stats.d.ts.map +1 -0
  45. package/lib/lib/nx-stats.js +117 -0
  46. package/lib/lib/nx-stats.js.map +1 -0
  47. package/lib/lib/project.d.ts +17 -0
  48. package/lib/lib/project.d.ts.map +1 -0
  49. package/lib/lib/project.js +49 -0
  50. package/lib/lib/project.js.map +1 -0
  51. package/lib/lib/templates.d.ts +16 -0
  52. package/lib/lib/templates.d.ts.map +1 -0
  53. package/lib/lib/templates.js +42 -0
  54. package/lib/lib/templates.js.map +1 -0
  55. package/lib/lib/timer.d.ts +120 -0
  56. package/lib/lib/timer.d.ts.map +1 -0
  57. package/lib/lib/timer.js +127 -0
  58. package/lib/lib/timer.js.map +1 -0
  59. package/package.json +54 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 fnd-platform contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ # @fnd-platform/cli
2
+
3
+ Command-line interface for fnd-platform projects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ # Global installation (recommended)
9
+ pnpm add -g @fnd-platform/cli
10
+
11
+ # Or use npx
12
+ npx @fnd-platform/cli <command>
13
+ ```
14
+
15
+ ## Commands
16
+
17
+ ### `fnd new <name>`
18
+
19
+ Create a new fnd-platform monorepo project.
20
+
21
+ ```bash
22
+ fnd new my-app
23
+ ```
24
+
25
+ **Arguments:**
26
+
27
+ | Argument | Description |
28
+ | -------- | ---------------------------------------------------------------------------- |
29
+ | `name` | Project name (lowercase alphanumeric with hyphens, must start with a letter) |
30
+
31
+ **Options:**
32
+
33
+ | Option | Default | Description |
34
+ | ------------------------ | ------- | ----------------------------------------- |
35
+ | `--package-manager <pm>` | `pnpm` | Package manager to use (`pnpm` or `yarn`) |
36
+ | `--no-git` | - | Skip git repository initialization |
37
+ | `--no-install` | - | Skip dependency installation |
38
+
39
+ **Examples:**
40
+
41
+ ```bash
42
+ # Create a new project with defaults
43
+ fnd new my-saas-app
44
+
45
+ # Create without installing dependencies
46
+ fnd new my-app --no-install
47
+
48
+ # Create with yarn instead of pnpm
49
+ fnd new my-app --package-manager yarn
50
+
51
+ # Create without git initialization
52
+ fnd new my-app --no-git
53
+ ```
54
+
55
+ ### `fnd synth`
56
+
57
+ Synthesize project configuration using Projen. Run this after modifying `.projenrc.ts` to regenerate configuration files.
58
+
59
+ ```bash
60
+ fnd synth
61
+ ```
62
+
63
+ **Options:**
64
+
65
+ | Option | Description |
66
+ | --------- | --------------------------------------------------------- |
67
+ | `--watch` | Watch for changes and re-synthesize (not yet implemented) |
68
+
69
+ ### `fnd build`
70
+
71
+ Build all packages using NX.
72
+
73
+ ```bash
74
+ fnd build
75
+ ```
76
+
77
+ **Options:**
78
+
79
+ | Option | Description |
80
+ | ------------------ | ----------------------------- |
81
+ | `--skip-cache` | Skip NX cache (force rebuild) |
82
+ | `--parallel <n>` | Number of parallel tasks |
83
+ | `--package <name>` | Build specific package only |
84
+
85
+ **Examples:**
86
+
87
+ ```bash
88
+ # Build all packages
89
+ fnd build
90
+
91
+ # Build without cache
92
+ fnd build --skip-cache
93
+
94
+ # Build with limited parallelism
95
+ fnd build --parallel 2
96
+
97
+ # Build specific package
98
+ fnd build --package api
99
+ ```
100
+
101
+ ### `fnd add <type>`
102
+
103
+ Add a package to an existing project. Modifies `.projenrc.ts` with the new package configuration.
104
+
105
+ **Subcommands:**
106
+
107
+ #### `fnd add api`
108
+
109
+ Add a Lambda API package.
110
+
111
+ ```bash
112
+ fnd add api --name=api
113
+ ```
114
+
115
+ | Option | Default | Description |
116
+ | ----------------- | ----------------- | -------------------------------- |
117
+ | `--name <name>` | **required** | Package name |
118
+ | `--outdir <path>` | `packages/<name>` | Output directory |
119
+ | `--no-dynamodb` | - | Disable DynamoDB integration |
120
+ | `--no-cognito` | - | Disable Cognito auth integration |
121
+
122
+ #### `fnd add frontend`
123
+
124
+ Add a Remix frontend package (requires API package).
125
+
126
+ ```bash
127
+ fnd add frontend --name=frontend --api=api
128
+ ```
129
+
130
+ | Option | Default | Description |
131
+ | ----------------- | ----------------- | ---------------------------------- |
132
+ | `--name <name>` | **required** | Package name |
133
+ | `--api <api>` | **required** | API package name to link |
134
+ | `--outdir <path>` | `packages/<name>` | Output directory |
135
+ | `--no-auth` | - | Disable authentication integration |
136
+ | `--port <port>` | `3000` | Development server port |
137
+ | `--theme <theme>` | `zinc` | shadcn/ui theme color |
138
+
139
+ #### `fnd add cms`
140
+
141
+ Add a CMS admin package (requires API package).
142
+
143
+ ```bash
144
+ fnd add cms --name=cms --api=api
145
+ ```
146
+
147
+ | Option | Default | Description |
148
+ | ----------------------------- | ----------------- | ---------------------------------- |
149
+ | `--name <name>` | **required** | Package name |
150
+ | `--api <api>` | **required** | API package name to link |
151
+ | `--outdir <path>` | `packages/<name>` | Output directory |
152
+ | `--port <port>` | `3001` | Development server port |
153
+ | `--no-media-upload` | - | Disable media upload features |
154
+ | `--rich-text-editor <editor>` | `tiptap` | Rich text editor (tiptap\|lexical) |
155
+ | `--theme <theme>` | `zinc` | shadcn/ui theme color |
156
+
157
+ #### `fnd add component-library`
158
+
159
+ Add a component library package with Storybook.
160
+
161
+ ```bash
162
+ fnd add component-library --name=ui
163
+ ```
164
+
165
+ | Option | Default | Description |
166
+ | ----------------- | ----------------- | ------------------------- |
167
+ | `--name <name>` | **required** | Package name |
168
+ | `--outdir <path>` | `packages/<name>` | Output directory |
169
+ | `--port <port>` | `6006` | Storybook dev server port |
170
+
171
+ ## Quick Start
172
+
173
+ ```bash
174
+ # Create a new project
175
+ fnd new my-saas-app
176
+
177
+ # Navigate to project
178
+ cd my-saas-app
179
+
180
+ # Modify .projenrc.ts if needed, then regenerate
181
+ fnd synth
182
+
183
+ # Build all packages
184
+ fnd build
185
+
186
+ # Add packages to an existing project
187
+ fnd add api --name=api
188
+ fnd add frontend --name=frontend --api=api
189
+ fnd add cms --name=cms --api=api
190
+
191
+ # Deploy (coming in Phase 8)
192
+ # fnd deploy --stage=dev
193
+ ```
194
+
195
+ ## Project Name Requirements
196
+
197
+ Project names must:
198
+
199
+ - Start with a lowercase letter
200
+ - Contain only lowercase letters, numbers, and hyphens
201
+ - Match pattern: `/^[a-z][a-z0-9-]*$/`
202
+
203
+ Valid examples: `my-app`, `saas-platform`, `app123`
204
+
205
+ Invalid examples: `MyApp`, `123-app`, `my_app`
206
+
207
+ ## Requirements
208
+
209
+ - Node.js 20+
210
+ - pnpm 8+ (or yarn)
211
+ - Git (optional, for repository initialization)
212
+
213
+ ## API Reference
214
+
215
+ See the [full API documentation](../../docs/api/modules/cli_src.html) for detailed type definitions and examples.
216
+
217
+ ## Related
218
+
219
+ - [@fnd-platform/core](../core/README.md) - Core Projen project classes
220
+ - [CLI Commands Reference](../../docs/api-reference/cli-commands.md) - Detailed command documentation
221
+
222
+ ## License
223
+
224
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=fnd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fnd.d.ts","sourceRoot":"","sources":["../../src/bin/fnd.ts"],"names":[],"mappings":""}
package/lib/bin/fnd.js ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const index_js_1 = require("../index.js");
5
+ (0, index_js_1.run)().catch((error) => {
6
+ console.error('Fatal error:', error.message);
7
+ process.exit(1);
8
+ });
9
+ //# sourceMappingURL=fnd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fnd.js","sourceRoot":"","sources":["../../src/bin/fnd.ts"],"names":[],"mappings":";;;AAEA,0CAAkC;AAElC,IAAA,cAAG,GAAE,CAAC,KAAK,CAAC,CAAC,KAAY,EAAE,EAAE;IAC3B,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * Creates the `fnd add` command with subcommands.
4
+ *
5
+ * @returns Commander command instance
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { addCommand } from '@fnd-platform/cli';
10
+ *
11
+ * const program = new Command();
12
+ * program.addCommand(addCommand());
13
+ *
14
+ * // Add an API package
15
+ * program.parse(['node', 'fnd', 'add', 'api', '--name=api']);
16
+ *
17
+ * // Add a frontend package linked to the API
18
+ * program.parse(['node', 'fnd', 'add', 'frontend', '--name=web', '--api=api']);
19
+ *
20
+ * // Add a CMS package
21
+ * program.parse(['node', 'fnd', 'add', 'cms', '--name=admin', '--api=api']);
22
+ *
23
+ * // Add a component library
24
+ * program.parse(['node', 'fnd', 'add', 'component-library', '--name=ui']);
25
+ * ```
26
+ */
27
+ export declare function addCommand(): Command;
28
+ //# sourceMappingURL=add.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../../src/commands/add.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmDpC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,UAAU,IAAI,OAAO,CAwDpC"}