@netlify/build 29.29.3 → 29.30.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.
|
@@ -44,7 +44,7 @@ export declare const bundleFunctions: {
|
|
|
44
44
|
}) => Promise<boolean>;
|
|
45
45
|
};
|
|
46
46
|
export declare const zipItAndShipIt: {
|
|
47
|
-
zipFunctions(
|
|
47
|
+
zipFunctions(relativeSrcFolders: string | string[], destFolder: string, args_2?: import("@netlify/zip-it-and-ship-it").ZipFunctionsOptions | undefined): Promise<(Omit<import("@netlify/zip-it-and-ship-it/dist/function.js").FunctionArchive, "runtime"> & {
|
|
48
48
|
routes?: import("@netlify/zip-it-and-ship-it/dist/utils/routes.js").Route[] | undefined;
|
|
49
49
|
runtime: import("@netlify/zip-it-and-ship-it").RuntimeName;
|
|
50
50
|
schedule?: string | undefined;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NetlifyPluginOptions } from '../../index.js';
|
|
2
|
+
type Input = NetlifyPluginOptions & {
|
|
3
|
+
buildDir: string;
|
|
4
|
+
logs: any;
|
|
5
|
+
};
|
|
6
|
+
export declare const preDevCleanup: {
|
|
7
|
+
event: string;
|
|
8
|
+
coreStep: (input: Input) => Promise<{}>;
|
|
9
|
+
coreStepId: string;
|
|
10
|
+
coreStepName: string;
|
|
11
|
+
coreStepDescription: () => string;
|
|
12
|
+
condition: (input: Input) => Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { rm, stat } from 'node:fs/promises';
|
|
2
|
+
import { resolve } from 'node:path';
|
|
3
|
+
import { log } from '../../log/logger.js';
|
|
4
|
+
const dirExists = async function (path) {
|
|
5
|
+
try {
|
|
6
|
+
await stat(path);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const getDirtyDirs = async function ({ buildDir, constants: { INTERNAL_EDGE_FUNCTIONS_SRC, INTERNAL_FUNCTIONS_SRC }, }) {
|
|
14
|
+
const dirs = [];
|
|
15
|
+
if (INTERNAL_FUNCTIONS_SRC && (await dirExists(resolve(buildDir, INTERNAL_FUNCTIONS_SRC)))) {
|
|
16
|
+
dirs.push(INTERNAL_FUNCTIONS_SRC);
|
|
17
|
+
}
|
|
18
|
+
if (INTERNAL_EDGE_FUNCTIONS_SRC && (await dirExists(resolve(buildDir, INTERNAL_EDGE_FUNCTIONS_SRC)))) {
|
|
19
|
+
dirs.push(INTERNAL_EDGE_FUNCTIONS_SRC);
|
|
20
|
+
}
|
|
21
|
+
return dirs;
|
|
22
|
+
};
|
|
23
|
+
const condition = async (input) => {
|
|
24
|
+
const dirs = await getDirtyDirs(input);
|
|
25
|
+
return dirs.length > 0;
|
|
26
|
+
};
|
|
27
|
+
const coreStep = async (input) => {
|
|
28
|
+
const dirs = await getDirtyDirs(input);
|
|
29
|
+
for (const dir of dirs) {
|
|
30
|
+
await rm(resolve(input.buildDir, dir), { recursive: true, force: true });
|
|
31
|
+
}
|
|
32
|
+
log(input.logs, `Cleaned up ${dirs.join(', ')}.`);
|
|
33
|
+
return {};
|
|
34
|
+
};
|
|
35
|
+
export const preDevCleanup = {
|
|
36
|
+
event: 'onPreDev',
|
|
37
|
+
coreStep,
|
|
38
|
+
coreStepId: 'pre_dev_cleanup',
|
|
39
|
+
coreStepName: 'Pre Dev cleanup',
|
|
40
|
+
coreStepDescription: () => 'Cleaning up leftover files from previous builds',
|
|
41
|
+
condition,
|
|
42
|
+
};
|
package/lib/steps/get.js
CHANGED
|
@@ -6,6 +6,7 @@ import { deploySite } from '../plugins_core/deploy/index.js';
|
|
|
6
6
|
import { bundleEdgeFunctions } from '../plugins_core/edge_functions/index.js';
|
|
7
7
|
import { bundleFunctions } from '../plugins_core/functions/index.js';
|
|
8
8
|
import { preCleanup } from '../plugins_core/pre_cleanup/index.js';
|
|
9
|
+
import { preDevCleanup } from '../plugins_core/pre_dev_cleanup/index.js';
|
|
9
10
|
import { saveArtifacts } from '../plugins_core/save_artifacts/index.js';
|
|
10
11
|
import { scanForSecrets } from '../plugins_core/secrets_scanning/index.js';
|
|
11
12
|
// Get all build steps
|
|
@@ -30,7 +31,7 @@ export const getDevSteps = function (command, steps, eventHandlers) {
|
|
|
30
31
|
coreStepDescription: () => 'Run command for local development',
|
|
31
32
|
};
|
|
32
33
|
const eventSteps = getEventSteps(eventHandlers);
|
|
33
|
-
const sortedSteps = sortSteps([...steps, eventSteps, devCommandStep], DEV_EVENTS);
|
|
34
|
+
const sortedSteps = sortSteps([...steps, eventSteps, preDevCleanup, devCommandStep], DEV_EVENTS);
|
|
34
35
|
const events = getEvents(sortedSteps);
|
|
35
36
|
return { steps: sortedSteps, events };
|
|
36
37
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/build",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.30.0",
|
|
4
4
|
"description": "Netlify build module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
"@netlify/config": "^20.10.0",
|
|
72
72
|
"@netlify/edge-bundler": "10.1.3",
|
|
73
73
|
"@netlify/framework-info": "^9.8.10",
|
|
74
|
-
"@netlify/functions-utils": "^5.2.
|
|
74
|
+
"@netlify/functions-utils": "^5.2.45",
|
|
75
75
|
"@netlify/git-utils": "^5.1.1",
|
|
76
76
|
"@netlify/plugins-list": "^6.72.0",
|
|
77
77
|
"@netlify/run-utils": "^5.1.1",
|
|
78
|
-
"@netlify/zip-it-and-ship-it": "9.28.
|
|
78
|
+
"@netlify/zip-it-and-ship-it": "9.28.1",
|
|
79
79
|
"@opentelemetry/api": "^1.4.1",
|
|
80
80
|
"@opentelemetry/core": "^1.17.1",
|
|
81
81
|
"@sindresorhus/slugify": "^2.0.0",
|
|
@@ -157,5 +157,5 @@
|
|
|
157
157
|
"engines": {
|
|
158
158
|
"node": "^14.16.0 || >=16.0.0"
|
|
159
159
|
},
|
|
160
|
-
"gitHead": "
|
|
160
|
+
"gitHead": "b32d2b2d81b062d5021fa0c91d831b23353a5b1d"
|
|
161
161
|
}
|