@friggframework/devtools 2.0.0-next.45 → 2.0.0-next.46
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/infrastructure/ARCHITECTURE.md +487 -0
- package/infrastructure/HEALTH.md +468 -0
- package/infrastructure/README.md +51 -0
- package/infrastructure/__tests__/postgres-config.test.js +914 -0
- package/infrastructure/__tests__/template-generation.test.js +687 -0
- package/infrastructure/create-frigg-infrastructure.js +1 -1
- package/infrastructure/docs/POSTGRES-CONFIGURATION.md +630 -0
- package/infrastructure/{DEPLOYMENT-INSTRUCTIONS.md → docs/deployment-instructions.md} +3 -3
- package/infrastructure/{IAM-POLICY-TEMPLATES.md → docs/iam-policy-templates.md} +9 -10
- package/infrastructure/domains/database/aurora-builder.js +809 -0
- package/infrastructure/domains/database/aurora-builder.test.js +950 -0
- package/infrastructure/domains/database/aurora-discovery.js +87 -0
- package/infrastructure/domains/database/aurora-discovery.test.js +188 -0
- package/infrastructure/domains/database/aurora-resolver.js +210 -0
- package/infrastructure/domains/database/aurora-resolver.test.js +347 -0
- package/infrastructure/domains/database/migration-builder.js +633 -0
- package/infrastructure/domains/database/migration-builder.test.js +294 -0
- package/infrastructure/domains/database/migration-resolver.js +163 -0
- package/infrastructure/domains/database/migration-resolver.test.js +337 -0
- package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +164 -0
- package/infrastructure/domains/health/application/ports/IResourceDetector.js +129 -0
- package/infrastructure/domains/health/application/ports/IResourceImporter.js +142 -0
- package/infrastructure/domains/health/application/ports/IStackRepository.js +131 -0
- package/infrastructure/domains/health/application/ports/index.js +26 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +679 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +167 -0
- package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +1130 -0
- package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +221 -0
- package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +152 -0
- package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +343 -0
- package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +535 -0
- package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +376 -0
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +213 -0
- package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +441 -0
- package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +267 -0
- package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +324 -0
- package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +386 -0
- package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +1419 -0
- package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +391 -0
- package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +551 -0
- package/infrastructure/domains/health/domain/entities/issue.js +299 -0
- package/infrastructure/domains/health/domain/entities/issue.test.js +528 -0
- package/infrastructure/domains/health/domain/entities/property-mismatch.js +108 -0
- package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +275 -0
- package/infrastructure/domains/health/domain/entities/resource.js +159 -0
- package/infrastructure/domains/health/domain/entities/resource.test.js +432 -0
- package/infrastructure/domains/health/domain/entities/stack-health-report.js +306 -0
- package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +601 -0
- package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +380 -0
- package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +971 -0
- package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +1150 -0
- package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +672 -0
- package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +496 -0
- package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +419 -0
- package/infrastructure/domains/health/domain/services/health-score-calculator.js +248 -0
- package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +504 -0
- package/infrastructure/domains/health/domain/services/import-progress-monitor.js +195 -0
- package/infrastructure/domains/health/domain/services/import-template-generator.js +435 -0
- package/infrastructure/domains/health/domain/services/logical-id-mapper.js +345 -0
- package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +234 -0
- package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +431 -0
- package/infrastructure/domains/health/domain/services/property-mutability-config.js +382 -0
- package/infrastructure/domains/health/domain/services/template-parser.js +245 -0
- package/infrastructure/domains/health/domain/services/update-progress-monitor.js +192 -0
- package/infrastructure/domains/health/domain/value-objects/health-score.js +138 -0
- package/infrastructure/domains/health/domain/value-objects/health-score.test.js +267 -0
- package/infrastructure/domains/health/domain/value-objects/property-mutability.js +161 -0
- package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +198 -0
- package/infrastructure/domains/health/domain/value-objects/resource-state.js +167 -0
- package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +196 -0
- package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +192 -0
- package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +262 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +312 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +367 -0
- package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +432 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +784 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +1133 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +565 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +554 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +318 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +398 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +777 -0
- package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +580 -0
- package/infrastructure/domains/integration/integration-builder.js +397 -0
- package/infrastructure/domains/integration/integration-builder.test.js +593 -0
- package/infrastructure/domains/integration/integration-resolver.js +170 -0
- package/infrastructure/domains/integration/integration-resolver.test.js +369 -0
- package/infrastructure/domains/integration/websocket-builder.js +69 -0
- package/infrastructure/domains/integration/websocket-builder.test.js +195 -0
- package/infrastructure/domains/networking/vpc-builder.js +1829 -0
- package/infrastructure/domains/networking/vpc-builder.test.js +1262 -0
- package/infrastructure/domains/networking/vpc-discovery.js +177 -0
- package/infrastructure/domains/networking/vpc-discovery.test.js +350 -0
- package/infrastructure/domains/networking/vpc-resolver.js +324 -0
- package/infrastructure/domains/networking/vpc-resolver.test.js +501 -0
- package/infrastructure/domains/parameters/ssm-builder.js +79 -0
- package/infrastructure/domains/parameters/ssm-builder.test.js +189 -0
- package/infrastructure/domains/parameters/ssm-discovery.js +84 -0
- package/infrastructure/domains/parameters/ssm-discovery.test.js +210 -0
- package/infrastructure/{iam-generator.js → domains/security/iam-generator.js} +2 -2
- package/infrastructure/domains/security/kms-builder.js +366 -0
- package/infrastructure/domains/security/kms-builder.test.js +374 -0
- package/infrastructure/domains/security/kms-discovery.js +80 -0
- package/infrastructure/domains/security/kms-discovery.test.js +177 -0
- package/infrastructure/domains/security/kms-resolver.js +96 -0
- package/infrastructure/domains/security/kms-resolver.test.js +216 -0
- package/infrastructure/domains/shared/base-builder.js +112 -0
- package/infrastructure/domains/shared/base-resolver.js +186 -0
- package/infrastructure/domains/shared/base-resolver.test.js +305 -0
- package/infrastructure/domains/shared/builder-orchestrator.js +212 -0
- package/infrastructure/domains/shared/builder-orchestrator.test.js +213 -0
- package/infrastructure/domains/shared/cloudformation-discovery-v2.js +334 -0
- package/infrastructure/domains/shared/cloudformation-discovery.js +375 -0
- package/infrastructure/domains/shared/cloudformation-discovery.test.js +590 -0
- package/infrastructure/domains/shared/environment-builder.js +119 -0
- package/infrastructure/domains/shared/environment-builder.test.js +247 -0
- package/infrastructure/domains/shared/providers/aws-provider-adapter.js +544 -0
- package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +377 -0
- package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +93 -0
- package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +136 -0
- package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +82 -0
- package/infrastructure/domains/shared/providers/provider-factory.js +108 -0
- package/infrastructure/domains/shared/providers/provider-factory.test.js +170 -0
- package/infrastructure/domains/shared/resource-discovery.js +192 -0
- package/infrastructure/domains/shared/resource-discovery.test.js +552 -0
- package/infrastructure/domains/shared/types/app-definition.js +205 -0
- package/infrastructure/domains/shared/types/discovery-result.js +106 -0
- package/infrastructure/domains/shared/types/discovery-result.test.js +258 -0
- package/infrastructure/domains/shared/types/index.js +46 -0
- package/infrastructure/domains/shared/types/resource-ownership.js +108 -0
- package/infrastructure/domains/shared/types/resource-ownership.test.js +101 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +380 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +338 -0
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +248 -0
- package/infrastructure/domains/shared/utilities/handler-path-resolver.js +134 -0
- package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +268 -0
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +55 -0
- package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +138 -0
- package/infrastructure/{env-validator.js → domains/shared/validation/env-validator.js} +2 -1
- package/infrastructure/domains/shared/validation/env-validator.test.js +173 -0
- package/infrastructure/esbuild.config.js +53 -0
- package/infrastructure/infrastructure-composer.js +87 -0
- package/infrastructure/{serverless-template.test.js → infrastructure-composer.test.js} +115 -24
- package/infrastructure/scripts/build-prisma-layer.js +553 -0
- package/infrastructure/scripts/build-prisma-layer.test.js +102 -0
- package/infrastructure/{build-time-discovery.js → scripts/build-time-discovery.js} +80 -48
- package/infrastructure/{build-time-discovery.test.js → scripts/build-time-discovery.test.js} +5 -4
- package/layers/prisma/nodejs/package.json +8 -0
- package/management-ui/server/utils/cliIntegration.js +1 -1
- package/management-ui/server/utils/environment/awsParameterStore.js +29 -18
- package/package.json +11 -11
- package/frigg-cli/.eslintrc.js +0 -141
- package/frigg-cli/__tests__/unit/commands/build.test.js +0 -251
- package/frigg-cli/__tests__/unit/commands/db-setup.test.js +0 -548
- package/frigg-cli/__tests__/unit/commands/install.test.js +0 -400
- package/frigg-cli/__tests__/unit/commands/ui.test.js +0 -346
- package/frigg-cli/__tests__/unit/utils/database-validator.test.js +0 -366
- package/frigg-cli/__tests__/unit/utils/error-messages.test.js +0 -304
- package/frigg-cli/__tests__/unit/utils/prisma-runner.test.js +0 -486
- package/frigg-cli/__tests__/utils/mock-factory.js +0 -270
- package/frigg-cli/__tests__/utils/prisma-mock.js +0 -194
- package/frigg-cli/__tests__/utils/test-fixtures.js +0 -463
- package/frigg-cli/__tests__/utils/test-setup.js +0 -287
- package/frigg-cli/build-command/index.js +0 -65
- package/frigg-cli/db-setup-command/index.js +0 -193
- package/frigg-cli/deploy-command/index.js +0 -175
- package/frigg-cli/generate-command/__tests__/generate-command.test.js +0 -301
- package/frigg-cli/generate-command/azure-generator.js +0 -43
- package/frigg-cli/generate-command/gcp-generator.js +0 -47
- package/frigg-cli/generate-command/index.js +0 -332
- package/frigg-cli/generate-command/terraform-generator.js +0 -555
- package/frigg-cli/generate-iam-command.js +0 -118
- package/frigg-cli/index.js +0 -75
- package/frigg-cli/index.test.js +0 -158
- package/frigg-cli/init-command/backend-first-handler.js +0 -756
- package/frigg-cli/init-command/index.js +0 -93
- package/frigg-cli/init-command/template-handler.js +0 -143
- package/frigg-cli/install-command/backend-js.js +0 -33
- package/frigg-cli/install-command/commit-changes.js +0 -16
- package/frigg-cli/install-command/environment-variables.js +0 -127
- package/frigg-cli/install-command/environment-variables.test.js +0 -136
- package/frigg-cli/install-command/index.js +0 -54
- package/frigg-cli/install-command/install-package.js +0 -13
- package/frigg-cli/install-command/integration-file.js +0 -30
- package/frigg-cli/install-command/logger.js +0 -12
- package/frigg-cli/install-command/template.js +0 -90
- package/frigg-cli/install-command/validate-package.js +0 -75
- package/frigg-cli/jest.config.js +0 -124
- package/frigg-cli/package.json +0 -54
- package/frigg-cli/start-command/index.js +0 -149
- package/frigg-cli/start-command/start-command.test.js +0 -297
- package/frigg-cli/test/init-command.test.js +0 -180
- package/frigg-cli/test/npm-registry.test.js +0 -319
- package/frigg-cli/ui-command/index.js +0 -154
- package/frigg-cli/utils/app-resolver.js +0 -319
- package/frigg-cli/utils/backend-path.js +0 -25
- package/frigg-cli/utils/database-validator.js +0 -161
- package/frigg-cli/utils/error-messages.js +0 -257
- package/frigg-cli/utils/npm-registry.js +0 -167
- package/frigg-cli/utils/prisma-runner.js +0 -280
- package/frigg-cli/utils/process-manager.js +0 -199
- package/frigg-cli/utils/repo-detection.js +0 -405
- package/infrastructure/aws-discovery.js +0 -1176
- package/infrastructure/aws-discovery.test.js +0 -1220
- package/infrastructure/serverless-template.js +0 -2094
- /package/infrastructure/{WEBSOCKET-CONFIGURATION.md → docs/WEBSOCKET-CONFIGURATION.md} +0 -0
- /package/infrastructure/{GENERATE-IAM-DOCS.md → docs/generate-iam-command.md} +0 -0
- /package/infrastructure/{iam-generator.test.js → domains/security/iam-generator.test.js} +0 -0
- /package/infrastructure/{frigg-deployment-iam-stack.yaml → domains/security/templates/frigg-deployment-iam-stack.yaml} +0 -0
- /package/infrastructure/{iam-policy-basic.json → domains/security/templates/iam-policy-basic.json} +0 -0
- /package/infrastructure/{iam-policy-full.json → domains/security/templates/iam-policy-full.json} +0 -0
- /package/infrastructure/{run-discovery.js → scripts/run-discovery.js} +0 -0
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
function getIntegrationTemplate(apiModuleName, backendPath, ApiClass) {
|
|
4
|
-
// Find the sample data method
|
|
5
|
-
const apiMethods = Object.getOwnPropertyNames(ApiClass.prototype);
|
|
6
|
-
const sampleDataMethod =
|
|
7
|
-
apiMethods.find(
|
|
8
|
-
(method) =>
|
|
9
|
-
method.toLowerCase().includes('search') ||
|
|
10
|
-
method.toLowerCase().includes('list') ||
|
|
11
|
-
method.toLowerCase().includes('get')
|
|
12
|
-
) || 'searchDeals';
|
|
13
|
-
|
|
14
|
-
return `const { get, IntegrationBase, Options } = require('@friggframework/core');
|
|
15
|
-
const { Definition: ${apiModuleName}Module, Config: defaultConfig } = require('@friggframework/api-module-${apiModuleName.toLowerCase()}');
|
|
16
|
-
|
|
17
|
-
class ${apiModuleName}Integration extends IntegrationBase {
|
|
18
|
-
static Config = {
|
|
19
|
-
name: defaultConfig.name || '${apiModuleName.toLowerCase()}',
|
|
20
|
-
version: '1.0.0',
|
|
21
|
-
supportedVersions: ['1.0.0'],
|
|
22
|
-
events: ['SEARCH_DEALS'],
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
static Options =
|
|
26
|
-
new Options({
|
|
27
|
-
module: ${apiModuleName}Module,
|
|
28
|
-
integrations: [${apiModuleName}Module],
|
|
29
|
-
display: {
|
|
30
|
-
name: defaultConfig.displayName || '${apiModuleName}',
|
|
31
|
-
description: defaultConfig.description || 'Sales & CRM, Marketing',
|
|
32
|
-
category: defaultConfig.category || 'Sales & CRM, Marketing',
|
|
33
|
-
detailsUrl: defaultConfig.detailsUrl || 'https://www.${apiModuleName.toLowerCase()}.com',
|
|
34
|
-
icon: defaultConfig.icon || 'https://friggframework.org/assets/img/${apiModuleName.toLowerCase()}.jpeg',
|
|
35
|
-
},
|
|
36
|
-
hasUserConfig: true,
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
static modules = {
|
|
40
|
-
${apiModuleName.toLowerCase()}: ${apiModuleName}Module,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* HANDLE EVENTS
|
|
45
|
-
*/
|
|
46
|
-
async receiveNotification(notifier, event, object = null) {
|
|
47
|
-
if (event === 'SEARCH_DEALS') {
|
|
48
|
-
return this.target.api.searchDeals(object);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* ALL CUSTOM/OPTIONAL METHODS FOR AN INTEGRATION MANAGER
|
|
54
|
-
*/
|
|
55
|
-
async getSampleData() {
|
|
56
|
-
const res = await this.target.api.${sampleDataMethod}();
|
|
57
|
-
return { data: res };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* ALL REQUIRED METHODS FOR AN INTEGRATION MANAGER
|
|
62
|
-
*/
|
|
63
|
-
async onCreate(params) {
|
|
64
|
-
// Validate that we have all of the data we need
|
|
65
|
-
// Set integration status as makes sense. Default ENABLED
|
|
66
|
-
// TODO turn this into a validateConfig method/function
|
|
67
|
-
this.record.status = 'ENABLED';
|
|
68
|
-
await this.record.save();
|
|
69
|
-
return this.record;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async onUpdate(params) {
|
|
73
|
-
const newConfig = get(params, 'config');
|
|
74
|
-
const oldConfig = this.record.config;
|
|
75
|
-
// Just save whatever
|
|
76
|
-
this.record.markModified('config');
|
|
77
|
-
await this.record.save();
|
|
78
|
-
return this.validateConfig();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
async getConfigOptions() {
|
|
82
|
-
const options = {}
|
|
83
|
-
return options;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
module.exports = ${apiModuleName}Integration;`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
module.exports = { getIntegrationTemplate };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
const { execSync } = require('child_process');
|
|
2
|
-
const axios = require('axios');
|
|
3
|
-
const { logError } = require('./logger');
|
|
4
|
-
const { checkbox } = require('@inquirer/prompts');
|
|
5
|
-
|
|
6
|
-
async function searchPackages(apiModuleName) {
|
|
7
|
-
const searchCommand = `npm search @friggframework/api-module-${apiModuleName} --json`;
|
|
8
|
-
const result = execSync(searchCommand, { encoding: 'utf8' });
|
|
9
|
-
return JSON.parse(result);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function checkPackageExists(packageName) {
|
|
13
|
-
try {
|
|
14
|
-
const response = await axios.get(
|
|
15
|
-
`https://registry.npmjs.org/${packageName}`
|
|
16
|
-
);
|
|
17
|
-
return response.status === 200;
|
|
18
|
-
} catch (error) {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function validatePackageExists(packageName) {
|
|
24
|
-
const packageExists = await checkPackageExists(packageName);
|
|
25
|
-
if (!packageExists) {
|
|
26
|
-
throw new Error(`Package ${packageName} does not exist on npm.`);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const searchAndSelectPackage = async (apiModuleName) => {
|
|
31
|
-
const searchResults = await searchPackages(apiModuleName || '');
|
|
32
|
-
|
|
33
|
-
if (searchResults.length === 0) {
|
|
34
|
-
logError(`No packages found matching ${apiModuleName}`);
|
|
35
|
-
process.exit(1);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const filteredResults = searchResults.filter((pkg) => {
|
|
39
|
-
const version = pkg.version ? pkg.version.split('.').map(Number) : [];
|
|
40
|
-
return version[0] >= 1;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
if (filteredResults.length === 0) {
|
|
44
|
-
const earlierVersions = searchResults
|
|
45
|
-
.map((pkg) => `${pkg.name} (${pkg.version})`)
|
|
46
|
-
.join(', ');
|
|
47
|
-
logError(
|
|
48
|
-
`No packages found with version 1.0.0 or above for ${apiModuleName}. Found earlier versions: ${earlierVersions}`
|
|
49
|
-
);
|
|
50
|
-
process.exit(1);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const choices = filteredResults.map((pkg) => {
|
|
54
|
-
return {
|
|
55
|
-
name: `${pkg.name} (${pkg.version})`,
|
|
56
|
-
value: pkg.name,
|
|
57
|
-
checked: filteredResults.length === 1, // Automatically select if only one result
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const selectedPackages = await checkbox({
|
|
62
|
-
message: 'Select the packages to install:',
|
|
63
|
-
choices,
|
|
64
|
-
});
|
|
65
|
-
console.log('Selected packages:', selectedPackages);
|
|
66
|
-
|
|
67
|
-
return selectedPackages.map((choice) => choice.split(' ')[0]);
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
module.exports = {
|
|
71
|
-
validatePackageExists,
|
|
72
|
-
checkPackageExists,
|
|
73
|
-
searchPackages,
|
|
74
|
-
searchAndSelectPackage,
|
|
75
|
-
};
|
package/frigg-cli/jest.config.js
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
displayName: 'Frigg CLI Tests',
|
|
3
|
-
testMatch: [
|
|
4
|
-
'<rootDir>/__tests__/**/*.test.js',
|
|
5
|
-
'<rootDir>/__tests__/**/*.spec.js',
|
|
6
|
-
'<rootDir>/**/start-command.test.js',
|
|
7
|
-
'<rootDir>/**/__tests__/**/*.test.js'
|
|
8
|
-
],
|
|
9
|
-
// Exclude utility files and config from being treated as tests
|
|
10
|
-
testPathIgnorePatterns: [
|
|
11
|
-
'/node_modules/',
|
|
12
|
-
'/__tests__/utils/',
|
|
13
|
-
'/__tests__/jest.config.js',
|
|
14
|
-
'/test-setup.js'
|
|
15
|
-
],
|
|
16
|
-
testEnvironment: 'node',
|
|
17
|
-
collectCoverageFrom: [
|
|
18
|
-
'**/*.js',
|
|
19
|
-
'!**/*.test.js',
|
|
20
|
-
'!**/*.spec.js',
|
|
21
|
-
'!**/node_modules/**',
|
|
22
|
-
'!**/__tests__/**',
|
|
23
|
-
'!**/coverage/**'
|
|
24
|
-
],
|
|
25
|
-
coverageDirectory: 'coverage',
|
|
26
|
-
coverageReporters: [
|
|
27
|
-
'text',
|
|
28
|
-
'text-summary',
|
|
29
|
-
'html',
|
|
30
|
-
'lcov',
|
|
31
|
-
'json'
|
|
32
|
-
],
|
|
33
|
-
coverageThreshold: {
|
|
34
|
-
global: {
|
|
35
|
-
branches: 85,
|
|
36
|
-
functions: 85,
|
|
37
|
-
lines: 85,
|
|
38
|
-
statements: 85
|
|
39
|
-
},
|
|
40
|
-
'./install-command/index.js': {
|
|
41
|
-
branches: 90,
|
|
42
|
-
functions: 90,
|
|
43
|
-
lines: 90,
|
|
44
|
-
statements: 90
|
|
45
|
-
},
|
|
46
|
-
'./build-command/index.js': {
|
|
47
|
-
branches: 90,
|
|
48
|
-
functions: 90,
|
|
49
|
-
lines: 90,
|
|
50
|
-
statements: 90
|
|
51
|
-
},
|
|
52
|
-
'./deploy-command/index.js': {
|
|
53
|
-
branches: 90,
|
|
54
|
-
functions: 90,
|
|
55
|
-
lines: 90,
|
|
56
|
-
statements: 90
|
|
57
|
-
},
|
|
58
|
-
'./ui-command/index.js': {
|
|
59
|
-
branches: 90,
|
|
60
|
-
functions: 90,
|
|
61
|
-
lines: 90,
|
|
62
|
-
statements: 90
|
|
63
|
-
},
|
|
64
|
-
'./generate-command/index.js': {
|
|
65
|
-
branches: 90,
|
|
66
|
-
functions: 90,
|
|
67
|
-
lines: 90,
|
|
68
|
-
statements: 90
|
|
69
|
-
},
|
|
70
|
-
'./db-setup-command/index.js': {
|
|
71
|
-
branches: 90,
|
|
72
|
-
functions: 90,
|
|
73
|
-
lines: 90,
|
|
74
|
-
statements: 90
|
|
75
|
-
},
|
|
76
|
-
'./utils/database-validator.js': {
|
|
77
|
-
branches: 85,
|
|
78
|
-
functions: 85,
|
|
79
|
-
lines: 85,
|
|
80
|
-
statements: 85
|
|
81
|
-
},
|
|
82
|
-
'./utils/prisma-runner.js': {
|
|
83
|
-
branches: 85,
|
|
84
|
-
functions: 85,
|
|
85
|
-
lines: 85,
|
|
86
|
-
statements: 85
|
|
87
|
-
},
|
|
88
|
-
'./utils/error-messages.js': {
|
|
89
|
-
branches: 85,
|
|
90
|
-
functions: 85,
|
|
91
|
-
lines: 85,
|
|
92
|
-
statements: 85
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
setupFilesAfterEnv: [
|
|
96
|
-
'<rootDir>/__tests__/utils/test-setup.js'
|
|
97
|
-
],
|
|
98
|
-
testTimeout: 10000,
|
|
99
|
-
maxWorkers: '50%',
|
|
100
|
-
verbose: true,
|
|
101
|
-
collectCoverage: true,
|
|
102
|
-
coveragePathIgnorePatterns: [
|
|
103
|
-
'/node_modules/',
|
|
104
|
-
'/__tests__/',
|
|
105
|
-
'/coverage/',
|
|
106
|
-
'.test.js',
|
|
107
|
-
'.spec.js'
|
|
108
|
-
],
|
|
109
|
-
moduleFileExtensions: [
|
|
110
|
-
'js',
|
|
111
|
-
'json',
|
|
112
|
-
'node'
|
|
113
|
-
],
|
|
114
|
-
transform: {},
|
|
115
|
-
// testResultsProcessor: 'jest-sonar-reporter', // Optional dependency
|
|
116
|
-
reporters: [
|
|
117
|
-
'default'
|
|
118
|
-
// jest-junit reporter removed - optional dependency
|
|
119
|
-
],
|
|
120
|
-
watchman: false,
|
|
121
|
-
forceExit: true,
|
|
122
|
-
detectOpenHandles: true,
|
|
123
|
-
errorOnDeprecated: true
|
|
124
|
-
};
|
package/frigg-cli/package.json
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@friggframework/frigg-cli",
|
|
3
|
-
"version": "2.0.0-next.0",
|
|
4
|
-
"description": "Frigg Framework CLI tool",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"frigg": "./index.js"
|
|
8
|
-
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"test": "jest"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@babel/parser": "^7.25.3",
|
|
14
|
-
"@babel/traverse": "^7.25.3",
|
|
15
|
-
"@friggframework/core": "workspace:*",
|
|
16
|
-
"@friggframework/schemas": "workspace:*",
|
|
17
|
-
"@inquirer/prompts": "^5.3.8",
|
|
18
|
-
"axios": "^1.7.2",
|
|
19
|
-
"chalk": "^4.1.2",
|
|
20
|
-
"commander": "^12.1.0",
|
|
21
|
-
"cross-spawn": "^7.0.3",
|
|
22
|
-
"dotenv": "^16.4.5",
|
|
23
|
-
"fs-extra": "^11.2.0",
|
|
24
|
-
"js-yaml": "^4.1.0",
|
|
25
|
-
"lodash": "4.17.21",
|
|
26
|
-
"node-cache": "^5.1.2",
|
|
27
|
-
"open": "^8.4.2",
|
|
28
|
-
"semver": "^7.6.0",
|
|
29
|
-
"validate-npm-package-name": "^5.0.0"
|
|
30
|
-
},
|
|
31
|
-
"devDependencies": {
|
|
32
|
-
"jest": "^29.7.0",
|
|
33
|
-
"jest-mock-extended": "^3.0.5"
|
|
34
|
-
},
|
|
35
|
-
"keywords": [
|
|
36
|
-
"frigg",
|
|
37
|
-
"cli",
|
|
38
|
-
"integration",
|
|
39
|
-
"framework"
|
|
40
|
-
],
|
|
41
|
-
"author": "Frigg Framework Team",
|
|
42
|
-
"license": "MIT",
|
|
43
|
-
"repository": {
|
|
44
|
-
"type": "git",
|
|
45
|
-
"url": "git+https://github.com/friggframework/frigg.git"
|
|
46
|
-
},
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/friggframework/frigg/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/friggframework/frigg#readme",
|
|
51
|
-
"engines": {
|
|
52
|
-
"node": ">=18"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
const { spawn } = require('node:child_process');
|
|
2
|
-
const path = require('node:path');
|
|
3
|
-
const dotenv = require('dotenv');
|
|
4
|
-
const chalk = require('chalk');
|
|
5
|
-
const {
|
|
6
|
-
validateDatabaseUrl,
|
|
7
|
-
getDatabaseType,
|
|
8
|
-
checkPrismaClientGenerated
|
|
9
|
-
} = require('../utils/database-validator');
|
|
10
|
-
const {
|
|
11
|
-
getDatabaseUrlMissingError,
|
|
12
|
-
getDatabaseTypeNotConfiguredError,
|
|
13
|
-
getPrismaClientNotGeneratedError
|
|
14
|
-
} = require('../utils/error-messages');
|
|
15
|
-
|
|
16
|
-
async function startCommand(options) {
|
|
17
|
-
if (options.verbose) {
|
|
18
|
-
console.log('Verbose mode enabled');
|
|
19
|
-
console.log('Options:', options);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
console.log(chalk.blue('🚀 Starting Frigg application...\n'));
|
|
23
|
-
|
|
24
|
-
// Load environment variables from .env file
|
|
25
|
-
const envPath = path.join(process.cwd(), '.env');
|
|
26
|
-
dotenv.config({ path: envPath });
|
|
27
|
-
|
|
28
|
-
// Pre-flight database checks
|
|
29
|
-
try {
|
|
30
|
-
await performDatabaseChecks(options.verbose);
|
|
31
|
-
} catch (error) {
|
|
32
|
-
console.error(chalk.red('\n❌ Pre-flight checks failed'));
|
|
33
|
-
console.error(chalk.gray('Fix the issues above before starting the application.\n'));
|
|
34
|
-
process.exit(1);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
console.log(chalk.green('✓ Database checks passed\n'));
|
|
38
|
-
console.log('Starting backend and optional frontend...');
|
|
39
|
-
|
|
40
|
-
// Suppress AWS SDK warning message about maintenance mode
|
|
41
|
-
process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE = '1';
|
|
42
|
-
// Skip AWS discovery for local development
|
|
43
|
-
process.env.FRIGG_SKIP_AWS_DISCOVERY = 'true';
|
|
44
|
-
const backendPath = path.resolve(process.cwd());
|
|
45
|
-
console.log(`Starting backend in ${backendPath}...`);
|
|
46
|
-
const infrastructurePath = 'infrastructure.js';
|
|
47
|
-
const command = 'serverless';
|
|
48
|
-
const args = [
|
|
49
|
-
'offline',
|
|
50
|
-
'--config',
|
|
51
|
-
infrastructurePath,
|
|
52
|
-
'--stage',
|
|
53
|
-
options.stage
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
// Add verbose flag to serverless if verbose option is enabled
|
|
57
|
-
if (options.verbose) {
|
|
58
|
-
args.push('--verbose');
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (options.verbose) {
|
|
62
|
-
console.log(`Executing command: ${command} ${args.join(' ')}`);
|
|
63
|
-
console.log(`Working directory: ${backendPath}`);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
const childProcess = spawn(command, args, {
|
|
67
|
-
cwd: backendPath,
|
|
68
|
-
stdio: 'inherit',
|
|
69
|
-
env: {
|
|
70
|
-
...process.env,
|
|
71
|
-
FRIGG_SKIP_AWS_DISCOVERY: 'true',
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
childProcess.on('error', (error) => {
|
|
76
|
-
console.error(`Error executing command: ${error.message}`);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
childProcess.on('close', (code) => {
|
|
80
|
-
if (code !== 0) {
|
|
81
|
-
console.log(`Child process exited with code ${code}`);
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Performs pre-flight database validation checks
|
|
88
|
-
* @param {boolean} verbose - Enable verbose output
|
|
89
|
-
* @throws {Error} If any validation check fails
|
|
90
|
-
*/
|
|
91
|
-
async function performDatabaseChecks(verbose) {
|
|
92
|
-
// Check 1: Validate DATABASE_URL exists
|
|
93
|
-
if (verbose) {
|
|
94
|
-
console.log(chalk.gray('Checking DATABASE_URL...'));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const urlValidation = validateDatabaseUrl();
|
|
98
|
-
if (!urlValidation.valid) {
|
|
99
|
-
console.error(getDatabaseUrlMissingError());
|
|
100
|
-
throw new Error('DATABASE_URL validation failed');
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (verbose) {
|
|
104
|
-
console.log(chalk.green('✓ DATABASE_URL found'));
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Check 2: Determine database type
|
|
108
|
-
if (verbose) {
|
|
109
|
-
console.log(chalk.gray('Determining database type...'));
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const dbTypeResult = getDatabaseType();
|
|
113
|
-
if (dbTypeResult.error) {
|
|
114
|
-
console.error(chalk.red('❌ ' + dbTypeResult.error));
|
|
115
|
-
console.error(getDatabaseTypeNotConfiguredError());
|
|
116
|
-
throw new Error('Database type determination failed');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const dbType = dbTypeResult.dbType;
|
|
120
|
-
|
|
121
|
-
if (verbose) {
|
|
122
|
-
console.log(chalk.green(`✓ Database type: ${dbType}`));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Check 3: Verify Prisma client is generated (BEFORE connection test to prevent auto-generation)
|
|
126
|
-
if (verbose) {
|
|
127
|
-
console.log(chalk.gray('Checking Prisma client...'));
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const clientCheck = checkPrismaClientGenerated(dbType);
|
|
131
|
-
|
|
132
|
-
if (!clientCheck.generated) {
|
|
133
|
-
console.error(getPrismaClientNotGeneratedError(dbType));
|
|
134
|
-
console.error(chalk.yellow('\nRun this command to generate the Prisma client:'));
|
|
135
|
-
console.error(chalk.cyan(' frigg db:setup\n'));
|
|
136
|
-
throw new Error('Prisma client not generated');
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
if (verbose) {
|
|
140
|
-
console.log(chalk.green('✓ Prisma client generated'));
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Note: We skip connection testing in the start command because when using frigg:local,
|
|
144
|
-
// the CLI code runs from tmp/frigg but the client is in backend/node_modules,
|
|
145
|
-
// causing module resolution mismatches. The backend will test its own database
|
|
146
|
-
// connection when it starts.
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
module.exports = { startCommand };
|