@friggframework/devtools 2.0.0--canary.705.9cfd819.0 → 2.0.0--canary.704.6a606c3.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.
Files changed (56) hide show
  1. package/README.md +14 -0
  2. package/frigg-cli/README.md +83 -30
  3. package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +18 -0
  4. package/frigg-cli/__tests__/unit/commands/init.test.js +688 -0
  5. package/frigg-cli/__tests__/unit/commands/install.test.js +594 -341
  6. package/frigg-cli/__tests__/unit/dependencies.test.js +3 -5
  7. package/frigg-cli/__tests__/unit/utils/node-version.test.js +66 -0
  8. package/frigg-cli/generate-command/index.js +1 -0
  9. package/frigg-cli/generate-iam-command.js +1 -0
  10. package/frigg-cli/index.js +12 -4
  11. package/frigg-cli/init-command/backend-first-handler.js +397 -554
  12. package/frigg-cli/init-command/deployment-modes.js +7 -0
  13. package/frigg-cli/init-command/index.js +82 -35
  14. package/frigg-cli/init-command/safe-path.js +58 -0
  15. package/frigg-cli/init-command/scaffold-dependencies.js +202 -0
  16. package/frigg-cli/install-command/app-definition.js +174 -0
  17. package/frigg-cli/install-command/commit-changes.js +40 -8
  18. package/frigg-cli/install-command/environment-variables.js +15 -0
  19. package/frigg-cli/install-command/index.js +96 -21
  20. package/frigg-cli/install-command/install-package.js +77 -4
  21. package/frigg-cli/install-command/integration-file.js +20 -11
  22. package/frigg-cli/install-command/resolve-module.js +69 -0
  23. package/frigg-cli/install-command/template.js +102 -75
  24. package/frigg-cli/install-command/validate-package.js +36 -4
  25. package/frigg-cli/package.json +3 -3
  26. package/frigg-cli/templates/backend/README.md +267 -0
  27. package/frigg-cli/templates/backend/env.example +20 -0
  28. package/frigg-cli/templates/backend/gitignore +10 -0
  29. package/frigg-cli/templates/backend/index.js +114 -0
  30. package/frigg-cli/templates/backend/infrastructure.js +20 -0
  31. package/frigg-cli/test/init-command.test.js +9 -2
  32. package/frigg-cli/utils/node-version.js +51 -0
  33. package/infrastructure/README.md +20 -0
  34. package/infrastructure/__tests__/package-patterns-composition.test.js +153 -0
  35. package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +148 -0
  36. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +21 -1
  37. package/infrastructure/domains/admin-scripts/admin-script-builder.js +50 -46
  38. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +46 -7
  39. package/infrastructure/domains/database/aurora-builder.js +13 -2
  40. package/infrastructure/domains/database/aurora-builder.test.js +22 -0
  41. package/infrastructure/domains/database/migration-builder.js +182 -175
  42. package/infrastructure/domains/database/migration-builder.test.js +36 -5
  43. package/infrastructure/domains/integration/integration-builder.js +65 -61
  44. package/infrastructure/domains/integration/integration-builder.test.js +73 -8
  45. package/infrastructure/domains/security/iam-generator.js +112 -5
  46. package/infrastructure/domains/security/iam-generator.test.js +94 -0
  47. package/infrastructure/domains/shared/utilities/base-definition-factory.js +83 -124
  48. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +116 -26
  49. package/infrastructure/domains/shared/utilities/framework-version.js +14 -0
  50. package/infrastructure/domains/shared/utilities/framework-version.test.js +27 -0
  51. package/infrastructure/domains/shared/utilities/logging-config.js +3 -4
  52. package/infrastructure/domains/shared/utilities/logging-config.test.js +1 -2
  53. package/infrastructure/domains/shared/utilities/package-patterns.js +35 -0
  54. package/infrastructure/domains/shared/utilities/package-patterns.test.js +112 -0
  55. package/infrastructure/infrastructure-composer.test.js +3 -3
  56. package/package.json +13 -8
@@ -24,17 +24,15 @@ describe('frigg-cli dependencies', () => {
24
24
  expect(oslsVersion).toMatch(/^[\^~]?\d+\.\d+\.\d+/);
25
25
  });
26
26
 
27
- it('should use osls version 3.40.1 or higher', () => {
27
+ it('should use osls 4.4.0 or higher within major 4 (ADR-050)', () => {
28
28
  const oslsVersion = packageJson.dependencies.osls;
29
29
 
30
30
  // Extract version number (remove ^ or ~ prefix)
31
31
  const versionNumber = oslsVersion.replace(/^[\^~]/, '');
32
32
  const [major, minor] = versionNumber.split('.').map(Number);
33
33
 
34
- expect(major).toBeGreaterThanOrEqual(3);
35
- if (major === 3) {
36
- expect(minor).toBeGreaterThanOrEqual(40);
37
- }
34
+ expect(major).toBe(4);
35
+ expect(minor).toBeGreaterThanOrEqual(4);
38
36
  });
39
37
  });
40
38
 
@@ -0,0 +1,66 @@
1
+ const {
2
+ SUPPORTED_NODE_RANGE,
3
+ checkNodeVersion,
4
+ enforceNodeVersion,
5
+ } = require('../../../utils/node-version');
6
+
7
+ describe('Node.js host version check (ADR-050)', () => {
8
+ it('uses the engines.node range from package.json', () => {
9
+ expect(SUPPORTED_NODE_RANGE).toBe(require('../../../package.json').engines.node);
10
+ expect(SUPPORTED_NODE_RANGE).toBe('^22.13.0 || >=24');
11
+ });
12
+
13
+ it.each([
14
+ ['22.13.0', true],
15
+ ['v22.20.1', true],
16
+ ['24.0.0', true],
17
+ ['v24.10.0', true],
18
+ ['25.1.0', true],
19
+ ['22.12.0', false],
20
+ ['v22.11.0', false],
21
+ ['23.5.0', false],
22
+ ['v23.11.1', false],
23
+ ['20.19.0', false],
24
+ ['18.20.0', false],
25
+ ])('Node %s supported: %s', (version, supported) => {
26
+ expect(checkNodeVersion(version).supported).toBe(supported);
27
+ });
28
+
29
+ it('explains the supported range and the fix when unsupported', () => {
30
+ const { message } = checkNodeVersion('v23.5.0');
31
+ expect(message).toContain('Node.js v23.5.0');
32
+ expect(message).toContain('^22.13.0 || >=24');
33
+ expect(message).toContain('Node 23');
34
+ expect(message).toContain('FRIGG_SKIP_NODE_VERSION_CHECK');
35
+ });
36
+
37
+ it('prints the message and exits 1 on an unsupported host', () => {
38
+ const log = jest.fn();
39
+ const exit = jest.fn();
40
+ const ok = enforceNodeVersion({ version: '23.5.0', env: {}, log, exit });
41
+ expect(ok).toBe(false);
42
+ expect(log).toHaveBeenCalledWith(expect.stringContaining('does not support Node.js'));
43
+ expect(exit).toHaveBeenCalledWith(1);
44
+ });
45
+
46
+ it('continues silently on a supported host', () => {
47
+ const log = jest.fn();
48
+ const exit = jest.fn();
49
+ expect(enforceNodeVersion({ version: '24.10.0', env: {}, log, exit })).toBe(true);
50
+ expect(log).not.toHaveBeenCalled();
51
+ expect(exit).not.toHaveBeenCalled();
52
+ });
53
+
54
+ it('can be bypassed with FRIGG_SKIP_NODE_VERSION_CHECK=true', () => {
55
+ const exit = jest.fn();
56
+ expect(
57
+ enforceNodeVersion({
58
+ version: '23.5.0',
59
+ env: { FRIGG_SKIP_NODE_VERSION_CHECK: 'true' },
60
+ log: jest.fn(),
61
+ exit,
62
+ })
63
+ ).toBe(true);
64
+ expect(exit).not.toHaveBeenCalled();
65
+ });
66
+ });
@@ -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,
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // osls 4 needs Node ^22.13.0 || >=24 (ADR-050): fail early with a clear message.
4
+ require('./utils/node-version').enforceNodeVersion();
5
+
3
6
  // Version Detection Wrapper
4
7
  // This code runs when frigg-cli is installed globally
5
8
  // It checks for a local installation and prefers it if newer
@@ -91,11 +94,16 @@ const { ssmPushCommand } = require('./ssm-command');
91
94
  const program = new Command();
92
95
 
93
96
  program
94
- .command('init [templateName]')
97
+ .command('init [projectName]')
95
98
  .description('Initialize a new Frigg application')
96
- .option('-t, --template <template>', 'template to use', 'backend-only')
97
- .option('-n, --name <name>', 'project name')
98
- .option('-d, --directory <directory>', 'target directory')
99
+ .option('-n, --name <name>', 'project name (alternative to the positional argument)')
100
+ .option('-m, --mode <mode>', 'deployment mode: standalone or embedded')
101
+ .option('-y, --yes', 'accept the default for every prompt (implied when stdin is not a TTY)')
102
+ .option('--no-install', 'skip installing dependencies')
103
+ .option('--no-git', 'skip initializing a git repository')
104
+ .option('-f, --force', 'scaffold into a non-empty directory and overwrite README.md')
105
+ .option('-v, --verbose', 'enable verbose output')
106
+ .option('-t, --template <template>', 'legacy template (no longer supported)')
99
107
  .action(initCommand);
100
108
 
101
109
  program