@friggframework/devtools 2.0.0--canary.686.df38e8e.0 → 2.0.0--canary.711.f8b6445.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/frigg-cli/README.md +77 -30
- 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 +594 -341
- package/frigg-cli/build-command/index.js +1 -32
- package/frigg-cli/deploy-command/index.js +2 -50
- package/frigg-cli/doctor-command/index.js +0 -7
- package/frigg-cli/generate-command/index.js +1 -0
- package/frigg-cli/generate-iam-command.js +1 -7
- 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/repair-command/index.js +0 -7
- package/frigg-cli/start-command/index.js +0 -58
- 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/README.md +2 -4
- package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +148 -0
- package/infrastructure/__tests__/template-generation.test.js +0 -7
- package/infrastructure/create-frigg-infrastructure.js +0 -14
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +21 -1
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +6 -2
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +30 -0
- package/infrastructure/domains/database/aurora-builder.js +13 -2
- package/infrastructure/domains/database/aurora-builder.test.js +22 -0
- package/infrastructure/domains/parameters/offload-utils.js +0 -1
- package/infrastructure/domains/security/iam-generator.js +112 -5
- package/infrastructure/domains/security/iam-generator.test.js +94 -0
- package/infrastructure/domains/shared/environment-builder.js +1 -12
- package/infrastructure/domains/shared/environment-builder.test.js +0 -20
- package/infrastructure/domains/shared/types/app-definition.js +1 -15
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +17 -30
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +22 -85
- package/infrastructure/infrastructure-composer.test.js +0 -7
- package/infrastructure/scripts/build-prisma-layer.js +5 -32
- package/infrastructure/scripts/build-prisma-layer.test.js +0 -35
- package/package.json +10 -8
- package/frigg-cli/__tests__/unit/commands/provider-dispatch.test.js +0 -140
- package/frigg-cli/utils/provider-helper.js +0 -80
- package/infrastructure/__tests__/create-frigg-infrastructure-provider.test.js +0 -64
- package/infrastructure/__tests__/management-api-gateway-routes.test.js +0 -335
- package/infrastructure/provider-build.js +0 -119
- package/test/npm-install-guard.js +0 -104
- package/test/npm-install-guard.test.js +0 -53
|
@@ -1,22 +1,7 @@
|
|
|
1
1
|
const { spawnSync } = require('child_process');
|
|
2
2
|
const path = require('path');
|
|
3
3
|
|
|
4
|
-
async function buildCommand(options
|
|
5
|
-
// A non-AWS provider (appDefinition.provider) builds through its plugin:
|
|
6
|
-
// platform config + function entry points, no serverless package
|
|
7
|
-
// (friggframework/frigg#545).
|
|
8
|
-
const providerResult = loadProviderIfConfigured();
|
|
9
|
-
if (providerResult) {
|
|
10
|
-
const { buildWithProvider } = require('../../infrastructure/provider-build');
|
|
11
|
-
buildWithProvider({
|
|
12
|
-
appDefinition: providerResult.appDefinition,
|
|
13
|
-
backendDir: providerResult.backendDir,
|
|
14
|
-
provider: providerResult.provider,
|
|
15
|
-
verbose: options.verbose,
|
|
16
|
-
});
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
|
|
4
|
+
async function buildCommand(options) {
|
|
20
5
|
console.log('Building the serverless application...');
|
|
21
6
|
|
|
22
7
|
// Suppress AWS SDK warning message about maintenance mode
|
|
@@ -78,20 +63,4 @@ async function buildCommand(options = {}) {
|
|
|
78
63
|
// });
|
|
79
64
|
}
|
|
80
65
|
|
|
81
|
-
/**
|
|
82
|
-
* The resolved non-AWS provider, or null for AWS / no app definition found.
|
|
83
|
-
*/
|
|
84
|
-
function loadProviderIfConfigured() {
|
|
85
|
-
const { loadProviderForCli } = require('../utils/provider-helper');
|
|
86
|
-
let result;
|
|
87
|
-
try {
|
|
88
|
-
result = loadProviderForCli();
|
|
89
|
-
} catch (error) {
|
|
90
|
-
// A non-AWS provider whose package is missing: say so, don't build for AWS.
|
|
91
|
-
console.error(error.message);
|
|
92
|
-
process.exit(1);
|
|
93
|
-
}
|
|
94
|
-
return result && result.provider ? result : null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
66
|
module.exports = { buildCommand };
|
|
@@ -310,16 +310,9 @@ async function pushOffloadedParametersOrAbort(appDefinition, options) {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
async function deployCommand(options) {
|
|
313
|
-
const appDefinition = loadAppDefinition();
|
|
314
|
-
|
|
315
|
-
// A non-AWS provider (appDefinition.provider) deploys through its plugin
|
|
316
|
-
// (friggframework/frigg#545).
|
|
317
|
-
const providerName = appDefinition?.provider;
|
|
318
|
-
if (providerName && providerName !== 'aws') {
|
|
319
|
-
return deployWithProvider(appDefinition, providerName, options);
|
|
320
|
-
}
|
|
321
|
-
|
|
322
313
|
console.log('Deploying the serverless application...');
|
|
314
|
+
|
|
315
|
+
const appDefinition = loadAppDefinition();
|
|
323
316
|
const environment = validateAndBuildEnvironment(appDefinition, options);
|
|
324
317
|
|
|
325
318
|
await pushOffloadedParametersOrAbort(appDefinition, options);
|
|
@@ -353,45 +346,4 @@ async function deployCommand(options) {
|
|
|
353
346
|
}
|
|
354
347
|
}
|
|
355
348
|
|
|
356
|
-
/**
|
|
357
|
-
* Deploy with a provider plugin: validate(), then deploy() (which runs its
|
|
358
|
-
* own preflightCheck()).
|
|
359
|
-
*/
|
|
360
|
-
async function deployWithProvider(appDefinition, providerName, options = {}) {
|
|
361
|
-
let provider;
|
|
362
|
-
try {
|
|
363
|
-
const { resolveProvider } = require('@friggframework/core/providers/resolve-provider');
|
|
364
|
-
provider = resolveProvider(appDefinition);
|
|
365
|
-
} catch (error) {
|
|
366
|
-
console.error(`Failed to load provider '${providerName}': ${error.message}`);
|
|
367
|
-
process.exit(1);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
console.log(`Deploying with ${providerName} provider...`);
|
|
371
|
-
|
|
372
|
-
if (typeof provider.validate === 'function') {
|
|
373
|
-
const validation = provider.validate(appDefinition);
|
|
374
|
-
if (validation.errors?.length > 0) {
|
|
375
|
-
console.error(`\nValidation errors for ${providerName}:`);
|
|
376
|
-
for (const error of validation.errors) console.error(` - ${error}`);
|
|
377
|
-
process.exit(1);
|
|
378
|
-
}
|
|
379
|
-
for (const warning of validation.warnings || []) console.warn(` Warning: ${warning}`);
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
try {
|
|
383
|
-
const result = await provider.deploy(appDefinition, {
|
|
384
|
-
stage: options.stage,
|
|
385
|
-
prod: options.stage === 'production' || options.stage === 'prod',
|
|
386
|
-
dryRun: options.dryRun || false,
|
|
387
|
-
});
|
|
388
|
-
console.log('\nDeployment completed successfully.');
|
|
389
|
-
if (result?.url) console.log(` URL: ${result.url}`);
|
|
390
|
-
} catch (error) {
|
|
391
|
-
console.error(`\nDeployment failed: ${error.message}`);
|
|
392
|
-
for (const item of error.missing || []) console.error(` - ${item}`);
|
|
393
|
-
process.exit(1);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
|
|
397
349
|
module.exports = { deployCommand };
|
|
@@ -246,13 +246,6 @@ async function promptForStackSelection(region) {
|
|
|
246
246
|
*/
|
|
247
247
|
async function doctorCommand(stackName, options = {}) {
|
|
248
248
|
try {
|
|
249
|
-
// AWS-only (CloudFormation); a non-AWS provider has nothing to inspect.
|
|
250
|
-
if (require('../utils/provider-helper').isNonAwsProject()) {
|
|
251
|
-
output.error('The doctor command is only available for AWS deployments.');
|
|
252
|
-
output.log('Your appDefinition uses a non-AWS provider.');
|
|
253
|
-
process.exit(1);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
249
|
// Extract options with defaults
|
|
257
250
|
const region = options.region || process.env.AWS_REGION || 'us-east-1';
|
|
258
251
|
const format = options.format || 'console';
|
|
@@ -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',
|
|
@@ -9,13 +9,6 @@ const { generateIAMCloudFormation, getFeatureSummary } = require('../infrastruct
|
|
|
9
9
|
*/
|
|
10
10
|
async function generateIamCommand(options = {}) {
|
|
11
11
|
try {
|
|
12
|
-
// AWS-only (CloudFormation); a non-AWS provider has nothing to inspect.
|
|
13
|
-
if (require('./utils/provider-helper').isNonAwsProject()) {
|
|
14
|
-
console.error('The generate-iam command is only available for AWS deployments.');
|
|
15
|
-
console.log('Your appDefinition uses a non-AWS provider.');
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
12
|
console.log('🔍 Finding Frigg application...');
|
|
20
13
|
|
|
21
14
|
// Find the backend package.json
|
|
@@ -69,6 +62,7 @@ async function generateIamCommand(options = {}) {
|
|
|
69
62
|
// Use the summary already extracted above (line 44)
|
|
70
63
|
const cloudFormationYaml = generateIAMCloudFormation({
|
|
71
64
|
appName: summary.appName,
|
|
65
|
+
serviceName: summary.serviceName,
|
|
72
66
|
features: summary.features,
|
|
73
67
|
userPrefix: deploymentUserName,
|
|
74
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
|