@friggframework/devtools 2.0.0-next.120 → 2.0.0-next.122
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/frigg-cli/README.md +77 -30
- package/frigg-cli/__tests__/unit/commands/deploy.test.js +30 -24
- package/frigg-cli/__tests__/unit/commands/doctor.test.js +10 -6
- package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +18 -0
- package/frigg-cli/__tests__/unit/commands/init.test.js +688 -0
- package/frigg-cli/__tests__/unit/commands/install.test.js +601 -341
- package/frigg-cli/__tests__/unit/commands/ui.test.js +31 -30
- package/frigg-cli/__tests__/unit/dependencies.test.js +6 -2
- package/frigg-cli/generate-command/index.js +1 -0
- package/frigg-cli/generate-iam-command.js +1 -0
- package/frigg-cli/index.js +9 -4
- package/frigg-cli/init-command/backend-first-handler.js +397 -554
- package/frigg-cli/init-command/deployment-modes.js +7 -0
- package/frigg-cli/init-command/index.js +82 -35
- package/frigg-cli/init-command/safe-path.js +58 -0
- package/frigg-cli/init-command/scaffold-dependencies.js +202 -0
- package/frigg-cli/install-command/app-definition.js +174 -0
- package/frigg-cli/install-command/commit-changes.js +40 -8
- package/frigg-cli/install-command/environment-variables.js +15 -0
- package/frigg-cli/install-command/index.js +96 -21
- package/frigg-cli/install-command/install-package.js +77 -4
- package/frigg-cli/install-command/integration-file.js +20 -11
- package/frigg-cli/install-command/resolve-module.js +69 -0
- package/frigg-cli/install-command/template.js +102 -75
- package/frigg-cli/install-command/validate-package.js +36 -4
- package/frigg-cli/package.json +1 -1
- package/frigg-cli/templates/backend/README.md +267 -0
- package/frigg-cli/templates/backend/env.example +20 -0
- package/frigg-cli/templates/backend/gitignore +10 -0
- package/frigg-cli/templates/backend/index.js +114 -0
- package/frigg-cli/templates/backend/infrastructure.js +20 -0
- package/frigg-cli/test/init-command.test.js +9 -2
- package/infrastructure/__tests__/postgres-config.test.js +241 -835
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +148 -0
- package/infrastructure/__tests__/template-generation.test.js +36 -8
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +21 -1
- package/infrastructure/domains/database/aurora-builder.js +13 -2
- package/infrastructure/domains/database/aurora-builder.test.js +22 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +12 -8
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +19 -7
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +12 -8
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +17 -18
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +12 -2
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +8 -1
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +4 -2
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +10 -0
- package/infrastructure/domains/networking/vpc-builder.js +18 -8
- package/infrastructure/domains/networking/vpc-builder.test.js +26 -12
- package/infrastructure/domains/security/iam-generator.js +112 -5
- package/infrastructure/domains/security/iam-generator.test.js +94 -0
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +36 -6
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +7 -2
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +21 -0
- package/infrastructure/infrastructure-composer.test.js +268 -794
- package/infrastructure/scripts/build-prisma-layer.test.js +28 -7
- package/infrastructure/scripts/build-time-discovery.test.js +18 -3
- package/package.json +10 -8
- package/frigg-cli/index.test.js +0 -158
- package/infrastructure/integration.test.js +0 -381
|
@@ -33,6 +33,17 @@ const {
|
|
|
33
33
|
} = require('../../../utils/repo-detection');
|
|
34
34
|
const { uiCommand } = require('../../../ui-command');
|
|
35
35
|
|
|
36
|
+
// uiCommand waits 2 s for the dev servers and opens the browser 1 s later.
|
|
37
|
+
// Drive those timers with fake time instead of sleeping for real (the real
|
|
38
|
+
// waits made this suite take ~40 s and tripped the 5 s default timeout).
|
|
39
|
+
const STARTUP_AND_BROWSER_DELAY_MS = 3100;
|
|
40
|
+
|
|
41
|
+
async function runUi(options) {
|
|
42
|
+
const done = uiCommand(options);
|
|
43
|
+
await jest.advanceTimersByTimeAsync(STARTUP_AND_BROWSER_DELAY_MS);
|
|
44
|
+
return done;
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
describe('CLI Command: ui', () => {
|
|
37
48
|
let consoleLogSpy;
|
|
38
49
|
let consoleErrorSpy;
|
|
@@ -43,6 +54,7 @@ describe('CLI Command: ui', () => {
|
|
|
43
54
|
|
|
44
55
|
beforeEach(() => {
|
|
45
56
|
jest.clearAllMocks();
|
|
57
|
+
jest.useFakeTimers();
|
|
46
58
|
|
|
47
59
|
// Mock console methods
|
|
48
60
|
consoleLogSpy = jest.spyOn(console, 'log').mockImplementation();
|
|
@@ -75,6 +87,7 @@ describe('CLI Command: ui', () => {
|
|
|
75
87
|
});
|
|
76
88
|
|
|
77
89
|
afterEach(() => {
|
|
90
|
+
jest.useRealTimers();
|
|
78
91
|
consoleLogSpy.mockRestore();
|
|
79
92
|
consoleErrorSpy.mockRestore();
|
|
80
93
|
processExitSpy.mockRestore();
|
|
@@ -84,7 +97,7 @@ describe('CLI Command: ui', () => {
|
|
|
84
97
|
|
|
85
98
|
describe('Repository Detection', () => {
|
|
86
99
|
it('should use specified repo path when provided', async () => {
|
|
87
|
-
await
|
|
100
|
+
await runUi({ repo: '/custom/repo', port: 3001, open: false });
|
|
88
101
|
|
|
89
102
|
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
90
103
|
expect.stringContaining('Using specified repository')
|
|
@@ -92,7 +105,7 @@ describe('CLI Command: ui', () => {
|
|
|
92
105
|
});
|
|
93
106
|
|
|
94
107
|
it('should detect current Frigg repository', async () => {
|
|
95
|
-
await
|
|
108
|
+
await runUi({ port: 3001, open: false });
|
|
96
109
|
|
|
97
110
|
expect(getCurrentRepositoryInfo).toHaveBeenCalled();
|
|
98
111
|
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
@@ -107,7 +120,7 @@ describe('CLI Command: ui', () => {
|
|
|
107
120
|
currentSubPath: 'packages/backend'
|
|
108
121
|
});
|
|
109
122
|
|
|
110
|
-
await
|
|
123
|
+
await runUi({ port: 3001, open: false });
|
|
111
124
|
|
|
112
125
|
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
113
126
|
expect.stringContaining('Currently in subdirectory: packages/backend')
|
|
@@ -121,7 +134,7 @@ describe('CLI Command: ui', () => {
|
|
|
121
134
|
{ path: '/repos/frigg-2', name: 'frigg-2' }
|
|
122
135
|
]);
|
|
123
136
|
|
|
124
|
-
await
|
|
137
|
+
await runUi({ port: 3001, open: false });
|
|
125
138
|
|
|
126
139
|
expect(discoverFriggRepositories).toHaveBeenCalled();
|
|
127
140
|
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
@@ -133,7 +146,7 @@ describe('CLI Command: ui', () => {
|
|
|
133
146
|
getCurrentRepositoryInfo.mockResolvedValue(null);
|
|
134
147
|
discoverFriggRepositories.mockResolvedValue([]);
|
|
135
148
|
|
|
136
|
-
await
|
|
149
|
+
await runUi({ port: 3001, open: false });
|
|
137
150
|
|
|
138
151
|
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
139
152
|
expect.stringContaining('No Frigg repositories found')
|
|
@@ -144,7 +157,7 @@ describe('CLI Command: ui', () => {
|
|
|
144
157
|
|
|
145
158
|
describe('Development Mode', () => {
|
|
146
159
|
it('should spawn backend and frontend in dev mode', async () => {
|
|
147
|
-
await
|
|
160
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
148
161
|
|
|
149
162
|
expect(mockProcessManager.spawnProcess).toHaveBeenCalledTimes(2);
|
|
150
163
|
expect(mockProcessManager.spawnProcess).toHaveBeenCalledWith(
|
|
@@ -168,7 +181,7 @@ describe('CLI Command: ui', () => {
|
|
|
168
181
|
});
|
|
169
182
|
|
|
170
183
|
it('should use default port 3001', async () => {
|
|
171
|
-
await
|
|
184
|
+
await runUi({ open: false, dev: true });
|
|
172
185
|
|
|
173
186
|
expect(mockProcessManager.spawnProcess).toHaveBeenCalledWith(
|
|
174
187
|
expect.any(String),
|
|
@@ -181,7 +194,7 @@ describe('CLI Command: ui', () => {
|
|
|
181
194
|
});
|
|
182
195
|
|
|
183
196
|
it('should use custom port when specified', async () => {
|
|
184
|
-
await
|
|
197
|
+
await runUi({ port: 4000, open: false, dev: true });
|
|
185
198
|
|
|
186
199
|
expect(mockProcessManager.spawnProcess).toHaveBeenCalledWith(
|
|
187
200
|
expect.any(String),
|
|
@@ -197,10 +210,7 @@ describe('CLI Command: ui', () => {
|
|
|
197
210
|
});
|
|
198
211
|
|
|
199
212
|
it('should print status with correct URLs', async () => {
|
|
200
|
-
await
|
|
201
|
-
|
|
202
|
-
// Wait for startup delay (testing async behavior, not mocks)
|
|
203
|
-
await new Promise(resolve => setTimeout(resolve, 2100));
|
|
213
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
204
214
|
|
|
205
215
|
// Verify printStatus called with exact URLs
|
|
206
216
|
expect(mockProcessManager.printStatus).toHaveBeenCalledWith(
|
|
@@ -211,20 +221,14 @@ describe('CLI Command: ui', () => {
|
|
|
211
221
|
});
|
|
212
222
|
|
|
213
223
|
it('should open browser when open=true', async () => {
|
|
214
|
-
await
|
|
215
|
-
|
|
216
|
-
// Wait for startup + browser delay (testing async behavior, not mocks)
|
|
217
|
-
await new Promise(resolve => setTimeout(resolve, 3100));
|
|
224
|
+
await runUi({ port: 3001, open: true, dev: true });
|
|
218
225
|
|
|
219
226
|
// Verify browser opened with correct URL
|
|
220
227
|
expect(open).toHaveBeenCalledWith('http://localhost:5173');
|
|
221
228
|
});
|
|
222
229
|
|
|
223
230
|
it('should NOT open browser when open=false', async () => {
|
|
224
|
-
await
|
|
225
|
-
|
|
226
|
-
// Wait for startup delay (testing async behavior, not mocks)
|
|
227
|
-
await new Promise(resolve => setTimeout(resolve, 3100));
|
|
231
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
228
232
|
|
|
229
233
|
// Verify browser was not opened
|
|
230
234
|
expect(open).not.toHaveBeenCalled();
|
|
@@ -237,7 +241,7 @@ describe('CLI Command: ui', () => {
|
|
|
237
241
|
currentSubPath: null
|
|
238
242
|
});
|
|
239
243
|
|
|
240
|
-
await
|
|
244
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
241
245
|
|
|
242
246
|
expect(mockProcessManager.spawnProcess).toHaveBeenCalledWith(
|
|
243
247
|
expect.any(String),
|
|
@@ -252,7 +256,7 @@ describe('CLI Command: ui', () => {
|
|
|
252
256
|
});
|
|
253
257
|
|
|
254
258
|
it('should set REPOSITORY_INFO as JSON string with correct structure', async () => {
|
|
255
|
-
await
|
|
259
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
256
260
|
|
|
257
261
|
const call = mockProcessManager.spawnProcess.mock.calls[0];
|
|
258
262
|
const env = call[3].env;
|
|
@@ -275,7 +279,7 @@ describe('CLI Command: ui', () => {
|
|
|
275
279
|
{ path: '/repos/frigg-1', name: 'frigg-1' }
|
|
276
280
|
]);
|
|
277
281
|
|
|
278
|
-
await
|
|
282
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
279
283
|
|
|
280
284
|
const call = mockProcessManager.spawnProcess.mock.calls[0];
|
|
281
285
|
const env = call[3].env;
|
|
@@ -299,7 +303,7 @@ describe('CLI Command: ui', () => {
|
|
|
299
303
|
throw error;
|
|
300
304
|
});
|
|
301
305
|
|
|
302
|
-
await
|
|
306
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
303
307
|
|
|
304
308
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
305
309
|
expect.stringContaining('Failed to start Management UI'),
|
|
@@ -316,7 +320,7 @@ describe('CLI Command: ui', () => {
|
|
|
316
320
|
throw new Error('Generic startup error');
|
|
317
321
|
});
|
|
318
322
|
|
|
319
|
-
await
|
|
323
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
320
324
|
|
|
321
325
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
322
326
|
expect.stringContaining('Failed to start Management UI'),
|
|
@@ -328,16 +332,13 @@ describe('CLI Command: ui', () => {
|
|
|
328
332
|
|
|
329
333
|
describe('Process Management', () => {
|
|
330
334
|
it('should create ProcessManager instance', async () => {
|
|
331
|
-
await
|
|
335
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
332
336
|
|
|
333
337
|
expect(ProcessManager).toHaveBeenCalled();
|
|
334
338
|
});
|
|
335
339
|
|
|
336
340
|
it('should keep process running with stdin.resume', async () => {
|
|
337
|
-
await
|
|
338
|
-
|
|
339
|
-
// Wait for startup delay (testing async behavior, not mocks)
|
|
340
|
-
await new Promise(resolve => setTimeout(resolve, 2100));
|
|
341
|
+
await runUi({ port: 3001, open: false, dev: true });
|
|
341
342
|
|
|
342
343
|
// Verify stdin.resume called to keep process alive
|
|
343
344
|
expect(stdinResumeSpy).toHaveBeenCalled();
|
|
@@ -51,8 +51,12 @@ describe('frigg-cli dependencies', () => {
|
|
|
51
51
|
expect(packageJson.dependencies.commander).toBeDefined();
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
// frigg-cli ships inside @friggframework/devtools (14236100), so
|
|
55
|
+
// devtools is a peer, not a runtime dependency — a hard dependency
|
|
56
|
+
// would make the package depend on itself.
|
|
57
|
+
it('should declare @friggframework/devtools as a peer dependency for infrastructure', () => {
|
|
58
|
+
expect(packageJson.peerDependencies['@friggframework/devtools']).toBeDefined();
|
|
59
|
+
expect(packageJson.dependencies['@friggframework/devtools']).toBeUndefined();
|
|
56
60
|
});
|
|
57
61
|
});
|
|
58
62
|
|
|
@@ -118,6 +118,7 @@ async function generateCommand(options = {}) {
|
|
|
118
118
|
if (options.format === 'cloudformation') {
|
|
119
119
|
template = await generateCloudFormationTemplate({
|
|
120
120
|
appName,
|
|
121
|
+
serviceName: appDefinition.name || 'create-frigg-app',
|
|
121
122
|
features,
|
|
122
123
|
userPrefix: options.user || 'frigg-deployment-user',
|
|
123
124
|
stackName: options.stackName || 'frigg-deployment-iam',
|
|
@@ -62,6 +62,7 @@ async function generateIamCommand(options = {}) {
|
|
|
62
62
|
// Use the summary already extracted above (line 44)
|
|
63
63
|
const cloudFormationYaml = generateIAMCloudFormation({
|
|
64
64
|
appName: summary.appName,
|
|
65
|
+
serviceName: summary.serviceName,
|
|
65
66
|
features: summary.features,
|
|
66
67
|
userPrefix: deploymentUserName,
|
|
67
68
|
stackName,
|
package/frigg-cli/index.js
CHANGED
|
@@ -91,11 +91,16 @@ const { ssmPushCommand } = require('./ssm-command');
|
|
|
91
91
|
const program = new Command();
|
|
92
92
|
|
|
93
93
|
program
|
|
94
|
-
.command('init [
|
|
94
|
+
.command('init [projectName]')
|
|
95
95
|
.description('Initialize a new Frigg application')
|
|
96
|
-
.option('-
|
|
97
|
-
.option('-
|
|
98
|
-
.option('-
|
|
96
|
+
.option('-n, --name <name>', 'project name (alternative to the positional argument)')
|
|
97
|
+
.option('-m, --mode <mode>', 'deployment mode: standalone or embedded')
|
|
98
|
+
.option('-y, --yes', 'accept the default for every prompt (implied when stdin is not a TTY)')
|
|
99
|
+
.option('--no-install', 'skip installing dependencies')
|
|
100
|
+
.option('--no-git', 'skip initializing a git repository')
|
|
101
|
+
.option('-f, --force', 'scaffold into a non-empty directory and overwrite README.md')
|
|
102
|
+
.option('-v, --verbose', 'enable verbose output')
|
|
103
|
+
.option('-t, --template <template>', 'legacy template (no longer supported)')
|
|
99
104
|
.action(initCommand);
|
|
100
105
|
|
|
101
106
|
program
|