@netlify/build 35.8.9 → 35.10.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/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { buildSite } from './core/main.js';
|
|
2
2
|
export { NetlifyPluginConstants } from './core/constants.js';
|
|
3
|
+
export { getVersion } from './utils/json.js';
|
|
3
4
|
export type { LogOutput as Logs } from './log/logger.js';
|
|
4
5
|
export type { GeneratedFunction } from './steps/return_values.js';
|
|
5
6
|
export type { NetlifyPlugin } from './types/netlify_plugin.js';
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const MIGRATION_DIR_PATTERN = /^\d
|
|
1
|
+
export const MIGRATION_DIR_PATTERN = /^\d+_[a-z0-9-]+$/;
|
|
2
2
|
export const validateMigrationDirs = (dirNames, existingSqlFiles) => {
|
|
3
3
|
const errors = [];
|
|
4
4
|
for (const dirName of dirNames) {
|
|
@@ -19,7 +19,7 @@ export const validateMigrationDirs = (dirNames, existingSqlFiles) => {
|
|
|
19
19
|
export const formatValidationErrors = (errors) => {
|
|
20
20
|
const lines = errors.map((error) => {
|
|
21
21
|
if (error.type === 'invalid_dir_name') {
|
|
22
|
-
return ` - "${error.dirName}" does not match the required pattern "<
|
|
22
|
+
return ` - "${error.dirName}" does not match the required pattern "<number>_<slug>" (e.g. "1700000000_create-users" or "001_create-users"). Slugs must be lowercase alphanumeric with hyphens.`;
|
|
23
23
|
}
|
|
24
24
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
25
25
|
if (error.type === 'missing_sql_file') {
|
|
@@ -8,19 +8,21 @@ describe('MIGRATION_DIR_PATTERN', () => {
|
|
|
8
8
|
'9999999999_z',
|
|
9
9
|
'1700000000_a',
|
|
10
10
|
'1700000000_abc-def-123',
|
|
11
|
+
'001_create-users',
|
|
12
|
+
'1_init',
|
|
13
|
+
'0001_add-posts',
|
|
14
|
+
'42_z',
|
|
11
15
|
];
|
|
12
16
|
test.each(validNames)('matches valid name: %s', (name) => {
|
|
13
17
|
expect(MIGRATION_DIR_PATTERN.test(name)).toBe(true);
|
|
14
18
|
});
|
|
15
19
|
const invalidNames = [
|
|
16
|
-
{ name: '170000000_short-ts', reason: '9-digit timestamp' },
|
|
17
|
-
{ name: '17000000000_long-ts', reason: '11-digit timestamp' },
|
|
18
20
|
{ name: '1700000000_CAPS', reason: 'uppercase letters' },
|
|
19
21
|
{ name: '1700000000_under_score', reason: 'underscores in slug' },
|
|
20
|
-
{ name: 'no-timestamp', reason: 'no
|
|
22
|
+
{ name: 'no-timestamp', reason: 'no numeric prefix' },
|
|
21
23
|
{ name: '1700000000_', reason: 'empty slug' },
|
|
22
24
|
{ name: '1700000000', reason: 'missing underscore and slug' },
|
|
23
|
-
{ name: '_create-users', reason: 'missing
|
|
25
|
+
{ name: '_create-users', reason: 'missing number prefix' },
|
|
24
26
|
{ name: '1700000000_hello world', reason: 'spaces in slug' },
|
|
25
27
|
{ name: '1700000000_special!char', reason: 'special characters in slug' },
|
|
26
28
|
];
|
|
@@ -80,7 +82,7 @@ describe('formatValidationErrors', () => {
|
|
|
80
82
|
const message = formatValidationErrors([{ type: 'invalid_dir_name', dirName: 'bad-name' }]);
|
|
81
83
|
expect(message).toContain('Database migration validation failed');
|
|
82
84
|
expect(message).toContain('"bad-name"');
|
|
83
|
-
expect(message).toContain('<
|
|
85
|
+
expect(message).toContain('<number>_<slug>');
|
|
84
86
|
});
|
|
85
87
|
test('formats missing_sql_file errors', () => {
|
|
86
88
|
const message = formatValidationErrors([{ type: 'missing_sql_file', dirName: '1700000000_create-users' }]);
|
package/lib/utils/json.d.ts
CHANGED
package/lib/utils/json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.10.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@netlify/blobs": "^10.4.4",
|
|
71
71
|
"@netlify/cache-utils": "^6.0.5",
|
|
72
72
|
"@netlify/config": "^24.4.3",
|
|
73
|
-
"@netlify/edge-bundler": "14.9.
|
|
73
|
+
"@netlify/edge-bundler": "14.9.17",
|
|
74
74
|
"@netlify/functions-utils": "^6.2.26",
|
|
75
75
|
"@netlify/git-utils": "^6.0.4",
|
|
76
76
|
"@netlify/opentelemetry-utils": "^2.0.2",
|
|
@@ -152,5 +152,5 @@
|
|
|
152
152
|
"engines": {
|
|
153
153
|
"node": ">=18.14.0"
|
|
154
154
|
},
|
|
155
|
-
"gitHead": "
|
|
155
|
+
"gitHead": "4c1f6b11490fca02a044a8f0e3bed51ef6b7c85a"
|
|
156
156
|
}
|