@netlify/config 20.8.0-rc.0 → 20.8.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/base.js +1 -1
- package/lib/files.js +5 -12
- package/lib/path.js +2 -1
- package/package.json +4 -3
package/lib/base.js
CHANGED
|
@@ -3,7 +3,7 @@ import { resolvePath } from './files.js';
|
|
|
3
3
|
* Retrieve the first `base` directory used to load the first config file.
|
|
4
4
|
*/
|
|
5
5
|
export const getInitialBase = function ({ repositoryRoot,
|
|
6
|
-
// @ts-expect-error TODO: enhance later
|
|
6
|
+
// @ts-expect-error TODO: enhance the types later on, just moved the file to .ts
|
|
7
7
|
defaultConfig: { build: { base: defaultBase } = {} }, inlineConfig: { build: { base: initialBase = defaultBase } = {} }, }) {
|
|
8
8
|
return resolveBase(repositoryRoot, initialBase);
|
|
9
9
|
};
|
package/lib/files.js
CHANGED
|
@@ -27,7 +27,6 @@ export const resolveConfigPaths = function (options) {
|
|
|
27
27
|
const baseRel = options.baseRelDir ? options.buildDir : options.repositoryRoot;
|
|
28
28
|
const config = resolvePaths({
|
|
29
29
|
config: options.config,
|
|
30
|
-
packagePath: options.packagePath,
|
|
31
30
|
propNames: FILE_PATH_CONFIG_PROPS,
|
|
32
31
|
baseRel,
|
|
33
32
|
repositoryRoot: options.repositoryRoot,
|
|
@@ -39,28 +38,22 @@ export const resolveConfigPaths = function (options) {
|
|
|
39
38
|
packagePath: options.packagePath,
|
|
40
39
|
});
|
|
41
40
|
};
|
|
42
|
-
const resolvePaths = function ({ config, propNames, baseRel,
|
|
43
|
-
return propNames.reduce((configA, propName) => resolvePathProp(configA, propName, baseRel, repositoryRoot
|
|
41
|
+
const resolvePaths = function ({ config, propNames, baseRel, repositoryRoot, }) {
|
|
42
|
+
return propNames.reduce((configA, propName) => resolvePathProp(configA, propName, baseRel, repositoryRoot), config);
|
|
44
43
|
};
|
|
45
|
-
const resolvePathProp = function (config, propName, baseRel, repositoryRoot
|
|
44
|
+
const resolvePathProp = function (config, propName, baseRel, repositoryRoot) {
|
|
46
45
|
const path = getProperty(config, propName);
|
|
47
46
|
if (!isTruthy(path)) {
|
|
48
47
|
deleteProperty(config, propName);
|
|
49
48
|
return config;
|
|
50
49
|
}
|
|
51
|
-
return setProperty(config, propName, resolvePath(repositoryRoot, baseRel, path, propName
|
|
50
|
+
return setProperty(config, propName, resolvePath(repositoryRoot, baseRel, path, propName));
|
|
52
51
|
};
|
|
53
|
-
export const resolvePath = (repositoryRoot, baseRel, originalPath, propName
|
|
54
|
-
// @ts-expect-error depends on the survey outcome see comment below
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
56
|
-
packagePath) => {
|
|
52
|
+
export const resolvePath = (repositoryRoot, baseRel, originalPath, propName) => {
|
|
57
53
|
if (!isTruthy(originalPath)) {
|
|
58
54
|
return;
|
|
59
55
|
}
|
|
60
56
|
const path = originalPath.replace(LEADING_SLASH_REGEXP, '');
|
|
61
|
-
// TODO: Based on survey outcome: https://netlify.slack.com/archives/C05556LEX28/p1691423437855069
|
|
62
|
-
// If we like option B then:
|
|
63
|
-
// const pathA = resolve(baseRel, packagePath || '', path)
|
|
64
57
|
const pathA = resolve(baseRel, path);
|
|
65
58
|
validateInsideRoot(originalPath, pathA, repositoryRoot, propName);
|
|
66
59
|
return pathA;
|
package/lib/path.js
CHANGED
|
@@ -33,7 +33,8 @@ const searchBaseConfigFile = function (repoRoot, base, packagePath) {
|
|
|
33
33
|
if (base === undefined && packagePath === undefined) {
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
const cwd = join(base ? base : repoRoot, packagePath || '');
|
|
37
|
+
return searchConfigFile(cwd);
|
|
37
38
|
};
|
|
38
39
|
/**
|
|
39
40
|
* Look for several file extensions for `netlify.*`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netlify/config",
|
|
3
|
-
"version": "20.8.0
|
|
3
|
+
"version": "20.8.0",
|
|
4
4
|
"description": "Netlify config module",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": "./lib/index.js",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"map-obj": "^5.0.0",
|
|
73
73
|
"netlify": "^13.1.10",
|
|
74
74
|
"netlify-headers-parser": "^7.1.2",
|
|
75
|
+
"netlify-redirect-parser": "^14.2.0",
|
|
75
76
|
"node-fetch": "^3.3.1",
|
|
76
|
-
"netlify-redirect-parser": "^14.1.3",
|
|
77
77
|
"omit.js": "^2.0.2",
|
|
78
78
|
"p-locate": "^6.0.0",
|
|
79
79
|
"path-type": "^5.0.0",
|
|
@@ -93,5 +93,6 @@
|
|
|
93
93
|
},
|
|
94
94
|
"engines": {
|
|
95
95
|
"node": "^14.16.0 || >=16.0.0"
|
|
96
|
-
}
|
|
96
|
+
},
|
|
97
|
+
"gitHead": "0c6f5c014958f692559ea720c38415a0e63b7522"
|
|
97
98
|
}
|