@friggframework/devtools 2.0.0--canary.689.e2b05a4.0 → 2.0.0--canary.704.79d9a63.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/README.md +14 -0
- package/frigg-cli/README.md +6 -0
- package/frigg-cli/__tests__/unit/dependencies.test.js +3 -5
- package/frigg-cli/__tests__/unit/utils/node-version.test.js +66 -0
- package/frigg-cli/index.js +3 -0
- package/frigg-cli/package.json +3 -3
- package/frigg-cli/utils/node-version.js +51 -0
- package/infrastructure/README.md +20 -0
- package/infrastructure/__tests__/package-patterns-composition.test.js +153 -0
- package/infrastructure/domains/admin-scripts/admin-script-builder.js +50 -46
- package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +46 -7
- package/infrastructure/domains/database/migration-builder.js +182 -175
- package/infrastructure/domains/database/migration-builder.test.js +36 -5
- package/infrastructure/domains/integration/integration-builder.js +65 -61
- package/infrastructure/domains/integration/integration-builder.test.js +73 -8
- package/infrastructure/domains/shared/utilities/base-definition-factory.js +76 -122
- package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +95 -26
- package/infrastructure/domains/shared/utilities/framework-version.js +14 -0
- package/infrastructure/domains/shared/utilities/framework-version.test.js +27 -0
- package/infrastructure/domains/shared/utilities/logging-config.js +3 -4
- package/infrastructure/domains/shared/utilities/logging-config.test.js +1 -2
- package/infrastructure/domains/shared/utilities/package-patterns.js +35 -0
- package/infrastructure/domains/shared/utilities/package-patterns.test.js +112 -0
- package/infrastructure/infrastructure-composer.test.js +3 -3
- package/package.json +11 -8
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the function package patterns helper (ADR-050)
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const { toPackagePatterns } = require('./package-patterns');
|
|
6
|
+
const { nestedNodeModulesExcludes } = require('./nested-node-modules');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The ordered list osls 3 built in resolveFilePathsFromPatterns for a function
|
|
10
|
+
* that set `package.include` / `package.exclude` (no service-level patterns,
|
|
11
|
+
* which Frigg never emits, and before the dev-dependency patterns that both
|
|
12
|
+
* versions append identically).
|
|
13
|
+
*/
|
|
14
|
+
function osls3FunctionOrder({ include = [], exclude = [] }) {
|
|
15
|
+
const patterns = [];
|
|
16
|
+
exclude.forEach((p) => patterns.push(p.charAt(0) !== '!' ? `!${p}` : p.substring(1)));
|
|
17
|
+
include.forEach((p) => patterns.push(p));
|
|
18
|
+
return patterns;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The ordered list osls 3 and osls 4 build for a function that sets
|
|
23
|
+
* `package.patterns`: the patterns go in include position, unchanged.
|
|
24
|
+
*/
|
|
25
|
+
function patternsFunctionOrder(patterns) {
|
|
26
|
+
return [...patterns];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('toPackagePatterns', () => {
|
|
30
|
+
const cases = [
|
|
31
|
+
{
|
|
32
|
+
name: 'excludes first (negated), then includes',
|
|
33
|
+
lists: {
|
|
34
|
+
include: ['ca.pem'],
|
|
35
|
+
exclude: ['node_modules/aws-sdk/**', '.env'],
|
|
36
|
+
},
|
|
37
|
+
expected: ['!node_modules/aws-sdk/**', '!.env', 'ca.pem'],
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'an exclude that already starts with ! becomes an include in exclude position',
|
|
41
|
+
lists: {
|
|
42
|
+
include: [],
|
|
43
|
+
exclude: ['node_modules/**', '!node_modules/keep/**'],
|
|
44
|
+
},
|
|
45
|
+
expected: ['!node_modules/**', 'node_modules/keep/**'],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'an include re-adds a path that an exclude removed',
|
|
49
|
+
lists: {
|
|
50
|
+
include: ['config/ca.pem'],
|
|
51
|
+
exclude: ['config/**'],
|
|
52
|
+
},
|
|
53
|
+
expected: ['!config/**', 'config/ca.pem'],
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'empty lists',
|
|
57
|
+
lists: { include: [], exclude: [] },
|
|
58
|
+
expected: [],
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'only excludes',
|
|
62
|
+
lists: { exclude: ['test/**'] },
|
|
63
|
+
expected: ['!test/**'],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'only includes',
|
|
67
|
+
lists: { include: ['ca.pem'] },
|
|
68
|
+
expected: ['ca.pem'],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
|
|
72
|
+
it.each(cases)('$name', ({ lists, expected }) => {
|
|
73
|
+
const patterns = toPackagePatterns(lists);
|
|
74
|
+
expect(patterns).toEqual(expected);
|
|
75
|
+
// Same evaluation order osls 3 applied to include/exclude.
|
|
76
|
+
expect(patternsFunctionOrder(patterns)).toEqual(osls3FunctionOrder(lists));
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('returns an empty list when called with no arguments', () => {
|
|
80
|
+
expect(toPackagePatterns()).toEqual([]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it('does not mutate its inputs', () => {
|
|
84
|
+
const exclude = ['a/**'];
|
|
85
|
+
const include = ['b'];
|
|
86
|
+
toPackagePatterns({ include, exclude });
|
|
87
|
+
expect(exclude).toEqual(['a/**']);
|
|
88
|
+
expect(include).toEqual(['b']);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
describe('with nestedNodeModulesExcludes output', () => {
|
|
92
|
+
it('negates the single catch-all glob by default', () => {
|
|
93
|
+
const exclude = nestedNodeModulesExcludes({}, true);
|
|
94
|
+
expect(toPackagePatterns({ exclude })).toEqual([
|
|
95
|
+
'!node_modules/**/node_modules/**',
|
|
96
|
+
]);
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('negates every scoped glob when keepNestedNodeModules is set', () => {
|
|
100
|
+
const appDefinition = { lambda: { keepNestedNodeModules: true } };
|
|
101
|
+
const exclude = nestedNodeModulesExcludes(appDefinition, true);
|
|
102
|
+
const patterns = toPackagePatterns({ exclude });
|
|
103
|
+
|
|
104
|
+
expect(patterns).toEqual(exclude.map((p) => `!${p}`));
|
|
105
|
+
expect(patterns).toContain('!node_modules/**/node_modules/@friggframework/**');
|
|
106
|
+
expect(patterns).not.toContain('!node_modules/**/node_modules/**');
|
|
107
|
+
expect(patternsFunctionOrder(patterns)).toEqual(
|
|
108
|
+
osls3FunctionOrder({ exclude })
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -153,7 +153,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
153
153
|
expect(result.provider.runtime).toBe('nodejs22.x');
|
|
154
154
|
expect(result.provider.region).toBe('us-east-1');
|
|
155
155
|
expect(result.provider.stage).toBe('${opt:stage}');
|
|
156
|
-
expect(result.frameworkVersion).toBe('
|
|
156
|
+
expect(result.frameworkVersion).toBe('^4.4.0');
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
it('should use default service name when name not provided', async () => {
|
|
@@ -245,7 +245,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
245
245
|
logging: { level: 'debug', retentionInDays: 30 },
|
|
246
246
|
});
|
|
247
247
|
|
|
248
|
-
expect(result.frameworkVersion).toBe('
|
|
248
|
+
expect(result.frameworkVersion).toBe('^4.4.0');
|
|
249
249
|
expect(result.provider.logs).toBeUndefined();
|
|
250
250
|
expect(result.provider.logRetentionInDays).toBe(30);
|
|
251
251
|
expect(result.provider.environment.FRIGG_LOG_LEVEL).toBe('DEBUG');
|
|
@@ -275,7 +275,7 @@ describe('composeServerlessDefinition', () => {
|
|
|
275
275
|
it('changes nothing when logging is absent', async () => {
|
|
276
276
|
const result = await composeServerlessDefinition({ integrations: [] });
|
|
277
277
|
|
|
278
|
-
expect(result.frameworkVersion).toBe('
|
|
278
|
+
expect(result.frameworkVersion).toBe('^4.4.0');
|
|
279
279
|
expect(result.provider.logs).toBeUndefined();
|
|
280
280
|
expect(result.provider.logRetentionInDays).toBeUndefined();
|
|
281
281
|
expect(result.provider.environment).not.toHaveProperty('FRIGG_LOG_LEVEL');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/devtools",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.
|
|
4
|
+
"version": "2.0.0--canary.704.79d9a63.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"frigg": "./frigg-cli/index.js"
|
|
7
7
|
},
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@babel/eslint-parser": "^7.18.9",
|
|
27
27
|
"@babel/parser": "^7.25.3",
|
|
28
28
|
"@babel/traverse": "^7.25.3",
|
|
29
|
-
"@friggframework/core": "2.0.0--canary.
|
|
30
|
-
"@friggframework/schemas": "2.0.0--canary.
|
|
31
|
-
"@friggframework/test": "2.0.0--canary.
|
|
29
|
+
"@friggframework/core": "2.0.0--canary.704.79d9a63.0",
|
|
30
|
+
"@friggframework/schemas": "2.0.0--canary.704.79d9a63.0",
|
|
31
|
+
"@friggframework/test": "2.0.0--canary.704.79d9a63.0",
|
|
32
32
|
"@hapi/boom": "^10.0.1",
|
|
33
33
|
"@inquirer/prompts": "^5.3.8",
|
|
34
34
|
"axios": "^1.18.0",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"validate-npm-package-name": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@friggframework/eslint-config": "2.0.0--canary.
|
|
60
|
-
"@friggframework/prettier-config": "2.0.0--canary.
|
|
59
|
+
"@friggframework/eslint-config": "2.0.0--canary.704.79d9a63.0",
|
|
60
|
+
"@friggframework/prettier-config": "2.0.0--canary.704.79d9a63.0",
|
|
61
61
|
"aws-sdk-client-mock": "^4.1.0",
|
|
62
62
|
"aws-sdk-client-mock-jest": "^4.1.0",
|
|
63
63
|
"jest": "^30.1.3",
|
|
64
|
-
"osls": "^
|
|
64
|
+
"osls": "^4.4.0",
|
|
65
65
|
"prettier": "^2.7.1",
|
|
66
66
|
"serverless-dotenv-plugin": "^6.0.0",
|
|
67
67
|
"serverless-esbuild": "^1.54.3",
|
|
@@ -70,6 +70,9 @@
|
|
|
70
70
|
"serverless-offline-sqs": "^8.0.0",
|
|
71
71
|
"serverless-plugin-monorepo": "^0.11.0"
|
|
72
72
|
},
|
|
73
|
+
"engines": {
|
|
74
|
+
"node": "^22.13.0 || >=24"
|
|
75
|
+
},
|
|
73
76
|
"scripts": {
|
|
74
77
|
"lint:fix": "prettier --write --loglevel error . && eslint . --fix",
|
|
75
78
|
"test": "jest --passWithNoTests # TODO"
|
|
@@ -89,5 +92,5 @@
|
|
|
89
92
|
"publishConfig": {
|
|
90
93
|
"access": "public"
|
|
91
94
|
},
|
|
92
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "79d9a635432643710e9fb815cf16453d01f7e12c"
|
|
93
96
|
}
|