@swovohq/fuel 0.2.0-alpha.9 → 0.2.0
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/LICENSE +21 -0
- package/README.md +59 -13
- package/dist/bin/fuel.js +116 -28
- package/dist/bin/fuel.js.map +1 -1
- package/dist/commands/config-verify.d.ts +4 -0
- package/dist/commands/config-verify.d.ts.map +1 -0
- package/dist/commands/config-verify.js +66 -0
- package/dist/commands/config-verify.js.map +1 -0
- package/dist/commands/create-app.d.ts +6 -1
- package/dist/commands/create-app.d.ts.map +1 -1
- package/dist/commands/create-app.js +62 -44
- package/dist/commands/create-app.js.map +1 -1
- package/dist/commands/infra-deploy.d.ts +5 -0
- package/dist/commands/infra-deploy.d.ts.map +1 -1
- package/dist/commands/infra-deploy.js +56 -14
- package/dist/commands/infra-deploy.js.map +1 -1
- package/dist/commands/infra-destroy.d.ts +2 -0
- package/dist/commands/infra-destroy.d.ts.map +1 -1
- package/dist/commands/infra-destroy.js +4 -6
- package/dist/commands/infra-destroy.js.map +1 -1
- package/dist/commands/infra-init.d.ts +1 -0
- package/dist/commands/infra-init.d.ts.map +1 -1
- package/dist/commands/infra-init.js +89 -7
- package/dist/commands/infra-init.js.map +1 -1
- package/dist/commands/migrate-init.d.ts.map +1 -1
- package/dist/commands/migrate-init.js +28 -12
- package/dist/commands/migrate-init.js.map +1 -1
- package/dist/engines/template-source.d.ts.map +1 -1
- package/dist/engines/template-source.js +14 -1
- package/dist/engines/template-source.js.map +1 -1
- package/dist/infra/config-writer.d.ts +2 -7
- package/dist/infra/config-writer.d.ts.map +1 -1
- package/dist/infra/config-writer.js +5 -11
- package/dist/infra/config-writer.js.map +1 -1
- package/dist/infra/credentials.d.ts +10 -2
- package/dist/infra/credentials.d.ts.map +1 -1
- package/dist/infra/credentials.js +44 -25
- package/dist/infra/credentials.js.map +1 -1
- package/dist/infra/git-client.d.ts +1 -1
- package/dist/infra/git-client.d.ts.map +1 -1
- package/dist/infra/git-client.js +5 -2
- package/dist/infra/git-client.js.map +1 -1
- package/dist/infra/orchestrator.d.ts +4 -1
- package/dist/infra/orchestrator.d.ts.map +1 -1
- package/dist/infra/orchestrator.js +38 -29
- package/dist/infra/orchestrator.js.map +1 -1
- package/dist/infra/port-utils.d.ts +4 -0
- package/dist/infra/port-utils.d.ts.map +1 -0
- package/dist/infra/port-utils.js +77 -0
- package/dist/infra/port-utils.js.map +1 -0
- package/dist/infra/preflight.d.ts +1 -1
- package/dist/infra/preflight.d.ts.map +1 -1
- package/dist/infra/preflight.js +2 -2
- package/dist/infra/preflight.js.map +1 -1
- package/dist/infra/s3-state-bucket.d.ts +1 -1
- package/dist/infra/s3-state-bucket.d.ts.map +1 -1
- package/dist/infra/s3-state-bucket.js +21 -26
- package/dist/infra/s3-state-bucket.js.map +1 -1
- package/dist/infra/secrets-manager-client.d.ts.map +1 -1
- package/dist/infra/secrets-manager-client.js +35 -1
- package/dist/infra/secrets-manager-client.js.map +1 -1
- package/dist/infra/template-engine.d.ts.map +1 -1
- package/dist/infra/template-engine.js +11 -25
- package/dist/infra/template-engine.js.map +1 -1
- package/dist/infra/tofu-runner.d.ts +1 -2
- package/dist/infra/tofu-runner.d.ts.map +1 -1
- package/dist/infra/tofu-runner.js +5 -5
- package/dist/infra/tofu-runner.js.map +1 -1
- package/package.json +8 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Swovo HQ
|
|
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
CHANGED
|
@@ -27,7 +27,7 @@ fuel create:app my-app -m billing,documents
|
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
29
|
fuel infra:init # Step 1: generate fuel.yml + .fuel-credentials
|
|
30
|
-
fuel create:app my-app -
|
|
30
|
+
fuel create:app my-app -c fuel.yml # Step 2: scaffold + provision infrastructure
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
### Add infra to an existing project
|
|
@@ -42,6 +42,7 @@ fuel infra:deploy --config fuel.yml # Step 2: provision infrastructure
|
|
|
42
42
|
| Command | Description |
|
|
43
43
|
|---|---|
|
|
44
44
|
| `fuel list:modules` | List available modules |
|
|
45
|
+
| `fuel config:verify <path>` | Validate `fuel.yml` and run preflight checks |
|
|
45
46
|
| `fuel create:app <name>` | Scaffold a new app from the monorepo template |
|
|
46
47
|
| `fuel infra:init` | Generate `fuel.yml` and `.fuel-credentials` interactively |
|
|
47
48
|
| `fuel infra:deploy` | Run or resume infrastructure provisioning |
|
|
@@ -63,14 +64,23 @@ fuel create:app <name> [options]
|
|
|
63
64
|
| `-m, --modules <list>` | Comma-separated modules to include (e.g. `billing,documents`) |
|
|
64
65
|
| `-o, --output <path>` | Output directory (defaults to `./<name>`) |
|
|
65
66
|
| `-s, --source <path>` | Path to a local monorepo root |
|
|
66
|
-
| `-
|
|
67
|
-
| `-c, --config <path>` | Path to `fuel.yml` for ECS provisioning |
|
|
67
|
+
| `-c, --config <path>` | Path to `fuel.yml` — triggers ECS provisioning |
|
|
68
68
|
| `--dry-run` | Preview without writing files |
|
|
69
69
|
| `--skip-install` | Skip `yarn install` (also skips migrations) |
|
|
70
70
|
| `--skip-build` | Skip `yarn build` (also skips migrations) |
|
|
71
71
|
| `--skip-git` | Skip `git init` and initial commit |
|
|
72
72
|
| `--skip-migration-generation` | Skip database migration generation |
|
|
73
|
-
| `--
|
|
73
|
+
| `--keep-migrations` | Keep existing migration files from the template and skip migration generation |
|
|
74
|
+
| `--target-branch <branch>` | Only push to this branch in the target repo (CI use) |
|
|
75
|
+
| `--force-push` | Force push to the target repo (for CI-managed repos) |
|
|
76
|
+
| `--destroy-on-failure` | Destroy provisioned infrastructure if OpenTofu apply fails (default: preserve) |
|
|
77
|
+
| `--skip-branch-protection` | Skip applying branch protection rules after pushing (useful in CI when protections are already set) |
|
|
78
|
+
| `--github-token <token>` | GitHub token |
|
|
79
|
+
| `--github-username <user>` | GitHub username |
|
|
80
|
+
| `--github-organization <org>` | GitHub organization |
|
|
81
|
+
| `--aws-access-key-id <key>` | AWS access key ID |
|
|
82
|
+
| `--aws-secret-access-key <secret>` | AWS secret access key |
|
|
83
|
+
| `--aws-region <region>` | AWS region |
|
|
74
84
|
|
|
75
85
|
**What it does:**
|
|
76
86
|
|
|
@@ -79,7 +89,7 @@ fuel create:app <name> [options]
|
|
|
79
89
|
3. Starts Docker, generates and runs database migrations
|
|
80
90
|
4. Creates an initial git commit
|
|
81
91
|
|
|
82
|
-
With `--
|
|
92
|
+
With `--config fuel.yml`, it additionally:
|
|
83
93
|
|
|
84
94
|
5. Creates a GitHub repository
|
|
85
95
|
6. Provisions AWS infrastructure (ECR, OIDC, VPC, RDS, ECS)
|
|
@@ -87,6 +97,25 @@ With `--deployment ecs`, it additionally:
|
|
|
87
97
|
8. Pushes code to trigger the first deployment
|
|
88
98
|
9. Applies branch protection rules
|
|
89
99
|
|
|
100
|
+
## `config:verify`
|
|
101
|
+
|
|
102
|
+
Validates `fuel.yml` syntax/schema and optionally runs preflight checks (OpenTofu, credentials). Failures are reported as warnings — the command never exits with an error.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
fuel config:verify <path> [options]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
| Flag | Description |
|
|
109
|
+
|---|---|
|
|
110
|
+
| `--config-only` | Only validate the config file. Skip preflight checks. |
|
|
111
|
+
|
|
112
|
+
**Examples:**
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
fuel config:verify fuel.yml # Validate config + preflight checks
|
|
116
|
+
fuel config:verify fuel.yml --config-only # Validate config only
|
|
117
|
+
```
|
|
118
|
+
|
|
90
119
|
## `infra:init`
|
|
91
120
|
|
|
92
121
|
Interactively generates `fuel.yml` and `.fuel-credentials`.
|
|
@@ -111,9 +140,18 @@ fuel infra:deploy [options]
|
|
|
111
140
|
| Flag | Description |
|
|
112
141
|
|---|---|
|
|
113
142
|
| `-p, --path <path>` | Path to project root |
|
|
114
|
-
| `-c, --config <path>` | Path to `fuel.yml` (generates `fuel.
|
|
143
|
+
| `-c, --config <path>` | Path to `fuel.yml` (generates `fuel.yml`) |
|
|
115
144
|
| `--regenerate` | Regenerate the `/infra` folder from templates |
|
|
116
145
|
| `--plan-only` | Run OpenTofu plan without creating resources |
|
|
146
|
+
| `--infra-only` | Run only OpenTofu on an existing `/infra` folder (no config, no git push) |
|
|
147
|
+
| `--destroy-on-failure` | Destroy provisioned resources if OpenTofu apply fails (default: preserve) |
|
|
148
|
+
| `--skip-branch-protection` | Skip applying branch protection rules after pushing (useful in CI when protections are already set) |
|
|
149
|
+
| `--github-token <token>` | GitHub token |
|
|
150
|
+
| `--github-username <user>` | GitHub username |
|
|
151
|
+
| `--github-organization <org>` | GitHub organization |
|
|
152
|
+
| `--aws-access-key-id <key>` | AWS access key ID |
|
|
153
|
+
| `--aws-secret-access-key <secret>` | AWS secret access key |
|
|
154
|
+
| `--aws-region <region>` | AWS region |
|
|
117
155
|
|
|
118
156
|
## `infra:destroy`
|
|
119
157
|
|
|
@@ -126,6 +164,12 @@ fuel infra:destroy [options]
|
|
|
126
164
|
| Flag | Description |
|
|
127
165
|
|---|---|
|
|
128
166
|
| `-p, --path <path>` | Path to project root |
|
|
167
|
+
| `--github-token <token>` | GitHub token |
|
|
168
|
+
| `--github-username <user>` | GitHub username |
|
|
169
|
+
| `--github-organization <org>` | GitHub organization |
|
|
170
|
+
| `--aws-access-key-id <key>` | AWS access key ID |
|
|
171
|
+
| `--aws-secret-access-key <secret>` | AWS secret access key |
|
|
172
|
+
| `--aws-region <region>` | AWS region |
|
|
129
173
|
|
|
130
174
|
## `migrate:init`
|
|
131
175
|
|
|
@@ -148,17 +192,19 @@ The schema is bundled at `node_modules/@swovohq/fuel/schema/fuel.schema.json`.
|
|
|
148
192
|
|
|
149
193
|
## Credentials
|
|
150
194
|
|
|
151
|
-
Infrastructure commands require AWS and GitHub credentials
|
|
195
|
+
Infrastructure commands require AWS and GitHub credentials. Each key is resolved independently in this order (sources are merged):
|
|
196
|
+
|
|
197
|
+
1. **CLI flags** (e.g., `--github-token`) — highest priority
|
|
198
|
+
2. **`.fuel-credentials`** JSON file (project root, then CWD fallback)
|
|
199
|
+
3. **Environment variables**: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_REGION`, `GITHUB_TOKEN`, `GITHUB_USERNAME`, `GITHUB_ORGANIZATION`
|
|
152
200
|
|
|
153
|
-
|
|
154
|
-
2. **`.fuel-credentials`** file in the project root
|
|
155
|
-
3. **`.fuel-credentials`** file in the current working directory
|
|
201
|
+
Sources complement each other — e.g., AWS keys from env vars + `GITHUB_TOKEN` from `.fuel-credentials` = valid.
|
|
156
202
|
|
|
157
|
-
Run `fuel infra:init` to generate `.fuel-credentials` interactively.
|
|
203
|
+
Run `fuel infra:init --credentials-only` to generate `.fuel-credentials` interactively.
|
|
158
204
|
|
|
159
205
|
## Infrastructure Architecture
|
|
160
206
|
|
|
161
|
-
When using `--
|
|
207
|
+
When using `--config fuel.yml`, the CLI provisions:
|
|
162
208
|
|
|
163
209
|
- **ECR** - Container registry for app images
|
|
164
210
|
- **ECS** (Fargate) - Container orchestration with ALB
|
|
@@ -182,4 +228,4 @@ GitHub resources (repository, secrets, branch protections) are managed directly
|
|
|
182
228
|
|
|
183
229
|
## License
|
|
184
230
|
|
|
185
|
-
|
|
231
|
+
MIT - see [LICENSE](./LICENSE)
|
package/dist/bin/fuel.js
CHANGED
|
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
37
37
|
const commander_1 = require("commander");
|
|
38
38
|
const fs = __importStar(require("fs-extra"));
|
|
39
39
|
const path = __importStar(require("path"));
|
|
40
|
+
const config_verify_1 = require("../commands/config-verify");
|
|
40
41
|
const create_app_1 = require("../commands/create-app");
|
|
41
42
|
const infra_deploy_1 = require("../commands/infra-deploy");
|
|
42
43
|
const infra_destroy_1 = require("../commands/infra-destroy");
|
|
@@ -45,6 +46,31 @@ const list_modules_1 = require("../commands/list-modules");
|
|
|
45
46
|
const migrate_init_1 = require("../commands/migrate-init");
|
|
46
47
|
const packageJson = require(path.join(__dirname, '..', '..', 'package.json'));
|
|
47
48
|
const program = new commander_1.Command();
|
|
49
|
+
function addCredentialOptions(cmd) {
|
|
50
|
+
return cmd
|
|
51
|
+
.option('--github-token <token>', 'GitHub token. Falls back to .fuel-credentials or GITHUB_TOKEN env var.')
|
|
52
|
+
.option('--github-username <username>', 'GitHub username. Falls back to .fuel-credentials or GITHUB_USERNAME env var.')
|
|
53
|
+
.option('--github-organization <org>', 'GitHub organization. Falls back to .fuel-credentials or GITHUB_ORGANIZATION env var.')
|
|
54
|
+
.option('--aws-access-key-id <key>', 'AWS access key ID. Falls back to .fuel-credentials or AWS_ACCESS_KEY_ID env var.')
|
|
55
|
+
.option('--aws-secret-access-key <secret>', 'AWS secret access key. Falls back to .fuel-credentials or AWS_SECRET_ACCESS_KEY env var.')
|
|
56
|
+
.option('--aws-region <region>', 'AWS region. Falls back to .fuel-credentials or AWS_REGION env var.');
|
|
57
|
+
}
|
|
58
|
+
function buildOverrides(flags) {
|
|
59
|
+
const overrides = {};
|
|
60
|
+
if (flags.githubToken)
|
|
61
|
+
overrides.GITHUB_TOKEN = flags.githubToken;
|
|
62
|
+
if (flags.githubUsername)
|
|
63
|
+
overrides.GITHUB_USERNAME = flags.githubUsername;
|
|
64
|
+
if (flags.githubOrganization)
|
|
65
|
+
overrides.GITHUB_ORGANIZATION = flags.githubOrganization;
|
|
66
|
+
if (flags.awsAccessKeyId)
|
|
67
|
+
overrides.AWS_ACCESS_KEY_ID = flags.awsAccessKeyId;
|
|
68
|
+
if (flags.awsSecretAccessKey)
|
|
69
|
+
overrides.AWS_SECRET_ACCESS_KEY = flags.awsSecretAccessKey;
|
|
70
|
+
if (flags.awsRegion)
|
|
71
|
+
overrides.AWS_REGION = flags.awsRegion;
|
|
72
|
+
return Object.keys(overrides).length > 0 ? overrides : undefined;
|
|
73
|
+
}
|
|
48
74
|
program
|
|
49
75
|
.name('fuel')
|
|
50
76
|
.description('Fuel CLI – scaffold apps from the fuel monorepo and provision cloud infrastructure.')
|
|
@@ -57,11 +83,11 @@ Workflows:
|
|
|
57
83
|
|
|
58
84
|
2. Full ECS provisioning (scaffold + cloud infra):
|
|
59
85
|
fuel infra:init Step 1: generate fuel.yml + .fuel-credentials
|
|
60
|
-
fuel create:app <name> -
|
|
86
|
+
fuel create:app <name> -c fuel.yml Step 2: scaffold code and provision infrastructure
|
|
61
87
|
|
|
62
|
-
3. Add infra to an existing project (created without -
|
|
88
|
+
3. Add infra to an existing project (created without -c):
|
|
63
89
|
fuel infra:init Step 1: generate fuel.yml + .fuel-credentials
|
|
64
|
-
fuel infra:deploy --config fuel.yml Step 2: generate fuel.
|
|
90
|
+
fuel infra:deploy --config fuel.yml Step 2: generate fuel.yml + provision infrastructure
|
|
65
91
|
|
|
66
92
|
4. Resume / retry infra (after a failure in step 2 or 3):
|
|
67
93
|
fuel infra:deploy [--path <project>] Re-run infrastructure provisioning without re-scaffolding
|
|
@@ -85,7 +111,7 @@ Quick examples:
|
|
|
85
111
|
fuel create:app my-app Scaffold base app
|
|
86
112
|
fuel create:app my-app -m billing,documents Scaffold with modules
|
|
87
113
|
fuel infra:init Interactive infra config setup
|
|
88
|
-
fuel create:app my-app -
|
|
114
|
+
fuel create:app my-app -c fuel.yml Full ECS provisioning
|
|
89
115
|
fuel infra:deploy Resume failed infra provisioning
|
|
90
116
|
fuel infra:deploy --config fuel.yml Add infra to existing project
|
|
91
117
|
fuel infra:deploy --path ./my-app --regenerate Regenerate /infra and re-deploy
|
|
@@ -110,6 +136,28 @@ Examples:
|
|
|
110
136
|
process.exit(1);
|
|
111
137
|
}
|
|
112
138
|
});
|
|
139
|
+
program
|
|
140
|
+
.command('config:verify <configPath>')
|
|
141
|
+
.description('Validate a fuel.yml config file and optionally run preflight checks.\n\n' +
|
|
142
|
+
' By default, validates the config syntax/schema AND runs preflight checks\n' +
|
|
143
|
+
' (OpenTofu version, credentials). Preflight failures are reported as\n' +
|
|
144
|
+
' warnings — the command never exits with an error.\n\n' +
|
|
145
|
+
' Use --config-only to skip preflight checks and only validate the file.')
|
|
146
|
+
.option('--config-only', 'Only validate the config file syntax and schema. Skip preflight checks (OpenTofu, credentials).')
|
|
147
|
+
.addHelpText('after', `
|
|
148
|
+
Examples:
|
|
149
|
+
fuel config:verify fuel.yml Validate config + run preflight checks
|
|
150
|
+
fuel config:verify fuel.yml --config-only Validate config syntax/schema only`)
|
|
151
|
+
.action(async (configPath, opts) => {
|
|
152
|
+
try {
|
|
153
|
+
await (0, config_verify_1.configVerify)(configPath, opts);
|
|
154
|
+
process.exit(0);
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
console.error(`\n Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
});
|
|
113
161
|
program
|
|
114
162
|
.command('create:app [appName]')
|
|
115
163
|
.description('Create a new app from the fuel monorepo.\n\n' +
|
|
@@ -118,12 +166,12 @@ program
|
|
|
118
166
|
' Copies the monorepo template, removes unselected modules, installs\n' +
|
|
119
167
|
' dependencies, builds, starts Docker, generates database migrations,\n' +
|
|
120
168
|
' and creates an initial git commit.\n\n' +
|
|
121
|
-
' ECS mode (-
|
|
169
|
+
' ECS mode (-c fuel.yml):\n' +
|
|
122
170
|
' Performs all scaffolding steps above, then provisions cloud infrastructure:\n' +
|
|
123
|
-
' writes fuel.
|
|
171
|
+
' writes fuel.yml, generates /infra (OpenTofu) and .github/workflows/,\n' +
|
|
124
172
|
' creates a GitHub repo, provisions all AWS infrastructure via OpenTofu,\n' +
|
|
125
173
|
' configures GitHub Actions secrets, pushes code, and applies branch protections.\n' +
|
|
126
|
-
'
|
|
174
|
+
' Run "fuel infra:init" first to generate fuel.yml.')
|
|
127
175
|
.option('-m, --modules <list>', 'Comma-separated modules to include (e.g. billing,documents). Omit for base only.', '')
|
|
128
176
|
.option('-a, --all-modules', 'Include all available modules. Cannot be combined with -m.')
|
|
129
177
|
.option('-o, --output <path>', 'Output directory. Defaults to ./<appName> in the current directory.')
|
|
@@ -133,9 +181,18 @@ program
|
|
|
133
181
|
.option('--skip-git', 'Skip git init and the initial commit.')
|
|
134
182
|
.option('--skip-build', 'Skip yarn build. Also implicitly skips migration generation (requires build).')
|
|
135
183
|
.option('--skip-migration-generation', 'Skip database migration generation and execution. Docker will not be started.')
|
|
136
|
-
.option('-
|
|
137
|
-
.option('-c, --config <path>', 'Path to fuel.yml for ECS provisioning
|
|
138
|
-
.option('--
|
|
184
|
+
.option('--keep-migrations', 'Keep existing migration files from the template and skip migration generation. Docker will not be started.')
|
|
185
|
+
.option('-c, --config <path>', 'Path to fuel.yml for ECS provisioning. When provided, infrastructure is provisioned after scaffolding. Generate one with "fuel infra:init". Cannot be combined with --skip-install, --skip-build, or --skip-migration-generation (unless --keep-migrations is also set).')
|
|
186
|
+
.option('--target-branch <branch>', 'Only push to this branch in the target repo. Useful in CI to deploy a specific environment.')
|
|
187
|
+
.option('--force-push', 'Force push to the target repo. Use when each run scaffolds a fresh project and the target repo already has commits.')
|
|
188
|
+
.option('--destroy-on-failure', 'Destroy provisioned infrastructure if OpenTofu apply fails. Default: false (resources are preserved for re-run).')
|
|
189
|
+
.option('--skip-branch-protection', 'Skip applying branch protection rules after pushing.')
|
|
190
|
+
.option('--github-token <token>', 'GitHub token. Falls back to .fuel-credentials or GITHUB_TOKEN env var.')
|
|
191
|
+
.option('--github-username <username>', 'GitHub username. Falls back to .fuel-credentials or GITHUB_USERNAME env var.')
|
|
192
|
+
.option('--github-organization <org>', 'GitHub organization. Falls back to .fuel-credentials or GITHUB_ORGANIZATION env var.')
|
|
193
|
+
.option('--aws-access-key-id <key>', 'AWS access key ID. Falls back to .fuel-credentials or AWS_ACCESS_KEY_ID env var.')
|
|
194
|
+
.option('--aws-secret-access-key <secret>', 'AWS secret access key. Falls back to .fuel-credentials or AWS_SECRET_ACCESS_KEY env var.')
|
|
195
|
+
.option('--aws-region <region>', 'AWS region. Falls back to .fuel-credentials or AWS_REGION env var.')
|
|
139
196
|
.addHelpText('after', `
|
|
140
197
|
Scaffolding examples:
|
|
141
198
|
fuel create:app my-app Base app, no optional modules
|
|
@@ -147,7 +204,7 @@ Scaffolding examples:
|
|
|
147
204
|
|
|
148
205
|
ECS provisioning (full workflow):
|
|
149
206
|
fuel infra:init Step 1: generate fuel.yml + .fuel-credentials
|
|
150
|
-
fuel create:app my-app -
|
|
207
|
+
fuel create:app my-app -c fuel.yml Step 2: scaffold + provision cloud infrastructure
|
|
151
208
|
|
|
152
209
|
Recovery commands:
|
|
153
210
|
cd my-app && fuel infra:deploy Resume failed infra provisioning
|
|
@@ -166,7 +223,9 @@ Recovery commands:
|
|
|
166
223
|
const configPath = path.resolve(opts.config);
|
|
167
224
|
const content = await fs.readFile(configPath, 'utf-8');
|
|
168
225
|
const YAML = require('yaml');
|
|
169
|
-
const raw = configPath.endsWith('.json')
|
|
226
|
+
const raw = configPath.endsWith('.json')
|
|
227
|
+
? JSON.parse(content)
|
|
228
|
+
: YAML.parse(content);
|
|
170
229
|
if (!raw.name || typeof raw.name !== 'string') {
|
|
171
230
|
throw new Error(`Config file "${opts.config}" does not contain a valid "name" field.`);
|
|
172
231
|
}
|
|
@@ -192,10 +251,16 @@ Recovery commands:
|
|
|
192
251
|
skipGit: opts.skipGit,
|
|
193
252
|
skipBuild: opts.skipBuild,
|
|
194
253
|
skipMigrationGeneration: opts.skipMigrationGeneration,
|
|
195
|
-
|
|
254
|
+
keepMigrations: opts.keepMigrations,
|
|
255
|
+
targetBranch: opts.targetBranch,
|
|
256
|
+
forcePush: opts.forcePush,
|
|
257
|
+
destroyOnFailure: opts.destroyOnFailure,
|
|
258
|
+
skipBranchProtection: opts.skipBranchProtection,
|
|
196
259
|
config: opts.config,
|
|
197
|
-
githubToken: opts.githubToken
|
|
260
|
+
githubToken: opts.githubToken,
|
|
261
|
+
credentialOverrides: buildOverrides(opts)
|
|
198
262
|
});
|
|
263
|
+
process.exit(0);
|
|
199
264
|
}
|
|
200
265
|
catch (error) {
|
|
201
266
|
console.error(`\n Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -216,6 +281,7 @@ program
|
|
|
216
281
|
' prompt for credentials or validate anything.')
|
|
217
282
|
.option('-o, --output <path>', 'Output path for fuel.yml. Defaults to ./fuel.yml in the current directory.')
|
|
218
283
|
.option('--template', 'Write a minimal fuel.yml template without prompts or credential validation.')
|
|
284
|
+
.option('--credentials-only', 'Only generate .fuel-credentials (prompt for AWS + GitHub credentials, verify, and write). Skips fuel.yml generation.')
|
|
219
285
|
.addHelpText('after', `
|
|
220
286
|
Generated files:
|
|
221
287
|
fuel.yml Infrastructure configuration (apps, environments, domains, resources)
|
|
@@ -224,11 +290,11 @@ Generated files:
|
|
|
224
290
|
Workflows using this command:
|
|
225
291
|
New project (scaffold + infra in one step):
|
|
226
292
|
1. fuel infra:init Generate fuel.yml + .fuel-credentials
|
|
227
|
-
2. fuel create:app <name> -
|
|
293
|
+
2. fuel create:app <name> -c fuel.yml Scaffold + provision infrastructure
|
|
228
294
|
|
|
229
295
|
Existing project (add infra later):
|
|
230
296
|
1. fuel infra:init Generate fuel.yml + .fuel-credentials
|
|
231
|
-
2. fuel infra:deploy -c fuel.yml Generate fuel.
|
|
297
|
+
2. fuel infra:deploy -c fuel.yml Generate fuel.yml + provision infrastructure
|
|
232
298
|
|
|
233
299
|
Examples:
|
|
234
300
|
fuel infra:init Interactive setup
|
|
@@ -237,6 +303,7 @@ Examples:
|
|
|
237
303
|
.action(async (opts) => {
|
|
238
304
|
try {
|
|
239
305
|
await (0, infra_init_1.infraInit)(opts);
|
|
306
|
+
process.exit(0);
|
|
240
307
|
}
|
|
241
308
|
catch (error) {
|
|
242
309
|
console.error(`\n Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -246,30 +313,39 @@ Examples:
|
|
|
246
313
|
program
|
|
247
314
|
.command('infra:deploy')
|
|
248
315
|
.description('Run or resume infrastructure provisioning on an already-generated project.\n\n' +
|
|
249
|
-
' Use this command after "fuel create:app -
|
|
316
|
+
' Use this command after "fuel create:app -c fuel.yml" fails during the infrastructure\n' +
|
|
250
317
|
' phase (e.g. missing AWS credentials, network timeout, OpenTofu errors).\n' +
|
|
251
318
|
' It re-runs only the infrastructure steps without re-scaffolding the project.\n\n' +
|
|
252
319
|
' You can also use this to add infrastructure to a project that was originally\n' +
|
|
253
|
-
' created without -
|
|
320
|
+
' created without -c, by passing --config <path> to generate fuel.yml.\n\n' +
|
|
254
321
|
' Prerequisites:\n' +
|
|
255
|
-
' - The project must contain a fuel.
|
|
322
|
+
' - The project must contain a fuel.yml, or --config must be provided\n' +
|
|
256
323
|
' - Credentials must be available via env vars or .fuel-credentials file\n\n' +
|
|
257
324
|
' On failure, partial cloud resources are preserved (no rollback), so you\n' +
|
|
258
325
|
' can fix the issue and re-run this command as many times as needed.')
|
|
259
326
|
.option('-p, --path <path>', 'Path to the project root. Defaults to the current directory.')
|
|
260
|
-
.option('-c, --config <path>', 'Path to fuel.yml. Generates fuel.
|
|
327
|
+
.option('-c, --config <path>', 'Path to fuel.yml. Generates fuel.yml in the project and provisions infrastructure. Use this to add infra to a project created without -c.')
|
|
261
328
|
.option('--regenerate', 'Delete and regenerate the /infra folder from templates before deploying. Use this if you changed fuel.yml and need fresh OpenTofu files.')
|
|
262
329
|
.option('--plan-only', 'Run OpenTofu plan instead of apply. Shows what would change without creating any resources.')
|
|
330
|
+
.option('--infra-only', 'Run only OpenTofu init + apply on an existing /infra folder. Skips config validation, secret upload, GitHub repo creation, and code push. Reads all variables from default.tfvars.')
|
|
331
|
+
.option('--destroy-on-failure', 'Destroy all provisioned resources if OpenTofu apply fails. Default: false (resources are preserved for re-run).')
|
|
332
|
+
.option('--skip-branch-protection', 'Skip applying branch protection rules after pushing. Useful in CI when protections are already set.')
|
|
333
|
+
.option('--github-token <token>', 'GitHub token. Falls back to .fuel-credentials or GITHUB_TOKEN env var.')
|
|
334
|
+
.option('--github-username <username>', 'GitHub username. Falls back to .fuel-credentials or GITHUB_USERNAME env var.')
|
|
335
|
+
.option('--github-organization <org>', 'GitHub organization. Falls back to .fuel-credentials or GITHUB_ORGANIZATION env var.')
|
|
336
|
+
.option('--aws-access-key-id <key>', 'AWS access key ID. Falls back to .fuel-credentials or AWS_ACCESS_KEY_ID env var.')
|
|
337
|
+
.option('--aws-secret-access-key <secret>', 'AWS secret access key. Falls back to .fuel-credentials or AWS_SECRET_ACCESS_KEY env var.')
|
|
338
|
+
.option('--aws-region <region>', 'AWS region. Falls back to .fuel-credentials or AWS_REGION env var.')
|
|
263
339
|
.addHelpText('after', `
|
|
264
340
|
Credential resolution (in order of priority):
|
|
265
|
-
1.
|
|
266
|
-
GITHUB_TOKEN, GITHUB_USERNAME, GITHUB_ORGANIZATION)
|
|
341
|
+
1. CLI flags (--github-token, --aws-access-key-id, etc.)
|
|
267
342
|
2. .fuel-credentials file in the project root (--path)
|
|
268
343
|
3. .fuel-credentials file in the current working directory
|
|
344
|
+
4. Environment variables (AWS_ACCESS_KEY_ID, GITHUB_TOKEN, etc.)
|
|
269
345
|
|
|
270
346
|
What this command does:
|
|
271
|
-
1. If --config is provided, writes fuel.
|
|
272
|
-
2. Validates fuel.
|
|
347
|
+
1. If --config is provided, writes fuel.yml to the project root
|
|
348
|
+
2. Validates fuel.yml, OpenTofu version, and credentials
|
|
273
349
|
3. Generates the /infra folder if missing (or if --regenerate / --config is passed)
|
|
274
350
|
4. Creates the S3 state bucket if it does not exist (with a unique suffix)
|
|
275
351
|
5. Writes infrastructure secrets to AWS Secrets Manager
|
|
@@ -288,7 +364,11 @@ To tear down provisioned resources:
|
|
|
288
364
|
fuel infra:destroy Destroy all infrastructure`)
|
|
289
365
|
.action(async (opts) => {
|
|
290
366
|
try {
|
|
291
|
-
await (0, infra_deploy_1.infraDeploy)(
|
|
367
|
+
await (0, infra_deploy_1.infraDeploy)({
|
|
368
|
+
...opts,
|
|
369
|
+
credentialOverrides: buildOverrides(opts)
|
|
370
|
+
});
|
|
371
|
+
process.exit(0);
|
|
292
372
|
}
|
|
293
373
|
catch (error) {
|
|
294
374
|
console.error(`\n Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -327,6 +407,7 @@ Examples:
|
|
|
327
407
|
.action(async (opts) => {
|
|
328
408
|
try {
|
|
329
409
|
await (0, migrate_init_1.migrateInit)(opts);
|
|
410
|
+
process.exit(0);
|
|
330
411
|
}
|
|
331
412
|
catch (error) {
|
|
332
413
|
console.error(`\n Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
@@ -339,12 +420,18 @@ program
|
|
|
339
420
|
' Runs "tofu destroy" against the /infra folder, tearing down all AWS and\n' +
|
|
340
421
|
' GitHub resources managed by OpenTofu (ECR, ECS, RDS, ALB, GitHub repo, etc.).\n\n' +
|
|
341
422
|
' Prerequisites:\n' +
|
|
342
|
-
' - The project must contain fuel.
|
|
423
|
+
' - The project must contain fuel.yml and an /infra folder\n' +
|
|
343
424
|
' - Credentials must be available via env vars or .fuel-credentials file')
|
|
344
425
|
.option('-p, --path <path>', 'Path to the project root. Defaults to the current directory.')
|
|
426
|
+
.option('--github-token <token>', 'GitHub token. Falls back to .fuel-credentials or GITHUB_TOKEN env var.')
|
|
427
|
+
.option('--github-username <username>', 'GitHub username. Falls back to .fuel-credentials or GITHUB_USERNAME env var.')
|
|
428
|
+
.option('--github-organization <org>', 'GitHub organization. Falls back to .fuel-credentials or GITHUB_ORGANIZATION env var.')
|
|
429
|
+
.option('--aws-access-key-id <key>', 'AWS access key ID. Falls back to .fuel-credentials or AWS_ACCESS_KEY_ID env var.')
|
|
430
|
+
.option('--aws-secret-access-key <secret>', 'AWS secret access key. Falls back to .fuel-credentials or AWS_SECRET_ACCESS_KEY env var.')
|
|
431
|
+
.option('--aws-region <region>', 'AWS region. Falls back to .fuel-credentials or AWS_REGION env var.')
|
|
345
432
|
.addHelpText('after', `
|
|
346
433
|
What this command does:
|
|
347
|
-
1. Validates fuel.
|
|
434
|
+
1. Validates fuel.yml, OpenTofu version, and credentials
|
|
348
435
|
2. Runs "tofu init" to initialize the backend
|
|
349
436
|
3. Runs "tofu destroy -auto-approve" to tear down all resources
|
|
350
437
|
|
|
@@ -356,7 +443,8 @@ To re-provision after destroying:
|
|
|
356
443
|
fuel infra:deploy Re-create all infrastructure`)
|
|
357
444
|
.action(async (opts) => {
|
|
358
445
|
try {
|
|
359
|
-
await (0, infra_destroy_1.infraDestroy)(opts);
|
|
446
|
+
await (0, infra_destroy_1.infraDestroy)({ ...opts, credentialOverrides: buildOverrides(opts) });
|
|
447
|
+
process.exit(0);
|
|
360
448
|
}
|
|
361
449
|
catch (error) {
|
|
362
450
|
console.error(`\n Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
package/dist/bin/fuel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fuel.js","sourceRoot":"","sources":["../../src/bin/fuel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAmC;AACnC,6CAA8B;AAC9B,2CAA4B;AAC5B,uDAAkD;AAClD,2DAAsD;AACtD,6DAAwD;AACxD,uDAAkD;AAClD,2DAAsD;AACtD,2DAAsD;
|
|
1
|
+
{"version":3,"file":"fuel.js","sourceRoot":"","sources":["../../src/bin/fuel.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,yCAAmC;AACnC,6CAA8B;AAC9B,2CAA4B;AAC5B,6DAAwD;AACxD,uDAAkD;AAClD,2DAAsD;AACtD,6DAAwD;AACxD,uDAAkD;AAClD,2DAAsD;AACtD,2DAAsD;AAGtD,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC,CAAA;AAE7E,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAA;AAY7B,SAAS,oBAAoB,CAAC,GAAY;IACxC,OAAO,GAAG;SACP,MAAM,CACL,wBAAwB,EACxB,wEAAwE,CACzE;SACA,MAAM,CACL,8BAA8B,EAC9B,8EAA8E,CAC/E;SACA,MAAM,CACL,6BAA6B,EAC7B,sFAAsF,CACvF;SACA,MAAM,CACL,2BAA2B,EAC3B,kFAAkF,CACnF;SACA,MAAM,CACL,kCAAkC,EAClC,0FAA0F,CAC3F;SACA,MAAM,CACL,uBAAuB,EACvB,oEAAoE,CACrE,CAAA;AACL,CAAC;AAED,SAAS,cAAc,CACrB,KAAsB;IAEtB,MAAM,SAAS,GAA2C,EAAE,CAAA;IAC5D,IAAI,KAAK,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"config-verify.d.ts","sourceRoot":"","sources":["../../src/commands/config-verify.ts"],"names":[],"mappings":"AAaA,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAoDf"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.configVerify = configVerify;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const config_loader_1 = require("../infra/config-loader");
|
|
9
|
+
const credentials_1 = require("../infra/credentials");
|
|
10
|
+
const preflight_1 = require("../infra/preflight");
|
|
11
|
+
function pass(label) {
|
|
12
|
+
console.log(chalk_1.default.green(' ✓') + ' ' + label);
|
|
13
|
+
}
|
|
14
|
+
function warn(label, detail) {
|
|
15
|
+
console.log(chalk_1.default.yellow(' ✗') + ' ' + label + ': ' + detail);
|
|
16
|
+
}
|
|
17
|
+
async function configVerify(configPath, opts) {
|
|
18
|
+
let hasIssues = false;
|
|
19
|
+
console.log('\n Validating config...\n');
|
|
20
|
+
// Check 1: config syntax and schema
|
|
21
|
+
try {
|
|
22
|
+
const config = await (0, config_loader_1.loadInfraConfig)(configPath);
|
|
23
|
+
pass(`Config valid — ${config.apps.length} app(s) (${config.apps.map((a) => a.name).join(', ')})`);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
warn('Config', err.message);
|
|
27
|
+
hasIssues = true;
|
|
28
|
+
}
|
|
29
|
+
if (opts.configOnly) {
|
|
30
|
+
console.log('');
|
|
31
|
+
if (hasIssues) {
|
|
32
|
+
console.log(chalk_1.default.yellow(' Config has issues. Fix them and re-run.\n'));
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
console.log(chalk_1.default.green(' Config is valid.\n'));
|
|
36
|
+
}
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
// Check 2: OpenTofu
|
|
40
|
+
console.log('\n Running preflight checks...\n');
|
|
41
|
+
try {
|
|
42
|
+
const version = (0, preflight_1.checkTofuVersion)();
|
|
43
|
+
pass(`OpenTofu ${version}`);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
warn('OpenTofu', err.message);
|
|
47
|
+
hasIssues = true;
|
|
48
|
+
}
|
|
49
|
+
// Check 3: credentials
|
|
50
|
+
try {
|
|
51
|
+
await (0, credentials_1.resolveCredentials)();
|
|
52
|
+
pass('Credentials found');
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
warn('Credentials', err.message);
|
|
56
|
+
hasIssues = true;
|
|
57
|
+
}
|
|
58
|
+
console.log('');
|
|
59
|
+
if (hasIssues) {
|
|
60
|
+
console.log(chalk_1.default.yellow(' Some checks failed. Review the issues above.\n'));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
console.log(chalk_1.default.green(' All checks passed. Ready to deploy.\n'));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=config-verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-verify.js","sourceRoot":"","sources":["../../src/commands/config-verify.ts"],"names":[],"mappings":";;;;;AAaA,oCAuDC;AApED,kDAAyB;AACzB,0DAAwD;AACxD,sDAAyD;AACzD,kDAAqD;AAErD,SAAS,IAAI,CAAC,KAAa;IACzB,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,KAAK,CAAC,CAAA;AAC/C,CAAC;AAED,SAAS,IAAI,CAAC,KAAa,EAAE,MAAc;IACzC,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,KAAK,CAA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,CAAC,UAAU,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;QAC7B,SAAS,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,uBAAuB;IACvB,IAAI,CAAC;QACH,MAAM,IAAA,gCAAkB,GAAE,CAAA;QAC1B,IAAI,CAAC,mBAAmB,CAAC,CAAA;IAC3B,CAAC;IAAC,OAAO,GAAQ,EAAE,CAAC;QAClB,IAAI,CAAC,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;QAChC,SAAS,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACf,IAAI,SAAS,EAAE,CAAC;QACd,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,MAAM,CAAC,kDAAkD,CAAC,CAAC,CAAA;IAC/E,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,eAAK,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC,CAAA;IACrE,CAAC;AACH,CAAC"}
|
|
@@ -7,9 +7,14 @@ export interface CreateAppOptions {
|
|
|
7
7
|
skipGit?: boolean;
|
|
8
8
|
skipBuild?: boolean;
|
|
9
9
|
skipMigrationGeneration?: boolean;
|
|
10
|
-
|
|
10
|
+
keepMigrations?: boolean;
|
|
11
|
+
targetBranch?: string;
|
|
12
|
+
forcePush?: boolean;
|
|
13
|
+
destroyOnFailure?: boolean;
|
|
14
|
+
skipBranchProtection?: boolean;
|
|
11
15
|
config?: string;
|
|
12
16
|
githubToken?: string;
|
|
17
|
+
credentialOverrides?: Partial<Record<import('../infra/types').CredentialKey, string>>;
|
|
13
18
|
}
|
|
14
19
|
export declare const createApp: (appName: string, options: CreateAppOptions) => Promise<void>;
|
|
15
20
|
//# sourceMappingURL=create-app.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/commands/create-app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../../src/commands/create-app.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAA;IACjC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,mBAAmB,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,OAAO,gBAAgB,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC,CAAA;CACtF;AA2JD,eAAO,MAAM,SAAS,GAAU,SAAS,MAAM,EAAE,SAAS,gBAAgB,kBAkUzE,CAAA"}
|