netlify-cli 17.19.3 → 17.19.5
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/dist/commands/base-command.d.ts +1 -1
- package/dist/commands/base-command.js +1 -1
- package/dist/commands/blobs/blobs.js +5 -5
- package/dist/commands/serve/serve.d.ts.map +1 -1
- package/dist/commands/serve/serve.js +7 -3
- package/dist/lib/edge-functions/proxy.d.ts.map +1 -1
- package/dist/lib/edge-functions/proxy.js +2 -1
- package/dist/lib/edge-functions/registry.d.ts.map +1 -1
- package/dist/lib/edge-functions/registry.js +17 -8
- package/dist/lib/functions/server.d.ts.map +1 -1
- package/dist/lib/functions/server.js +14 -1
- package/dist/lib/settings.d.ts +4 -11
- package/dist/lib/settings.d.ts.map +1 -1
- package/dist/lib/settings.js +4 -23
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/proxy.d.ts.map +1 -1
- package/dist/utils/proxy.js +0 -25
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
|
@@ -64,7 +64,7 @@ export default class BaseCommand extends Command {
|
|
|
64
64
|
scheme?: string;
|
|
65
65
|
}): ReturnType<typeof resolveConfig>;
|
|
66
66
|
/**
|
|
67
|
-
* get a path inside the `.netlify` project folder
|
|
67
|
+
* get a path inside the `.netlify` project folder resolving with the workspace package
|
|
68
68
|
*/
|
|
69
69
|
getPathInProject(...paths: string[]): string;
|
|
70
70
|
/**
|
|
@@ -559,7 +559,7 @@ class BaseCommand extends Command {
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
/**
|
|
562
|
-
* get a path inside the `.netlify` project folder
|
|
562
|
+
* get a path inside the `.netlify` project folder resolving with the workspace package
|
|
563
563
|
*/
|
|
564
564
|
getPathInProject(...paths) {
|
|
565
565
|
return join(this.workspacePackage || '', '.netlify', ...paths);
|
|
@@ -11,7 +11,7 @@ const blobs = (_options, command) => {
|
|
|
11
11
|
export const createBlobsCommand = (program) => {
|
|
12
12
|
program
|
|
13
13
|
.command('blobs:delete')
|
|
14
|
-
.description(`
|
|
14
|
+
.description(`Deletes an object with a given key, if it exists, from a Netlify Blobs store`)
|
|
15
15
|
.argument('<store>', 'Name of the store')
|
|
16
16
|
.argument('<key>', 'Object key')
|
|
17
17
|
.alias('blob:delete')
|
|
@@ -22,7 +22,7 @@ export const createBlobsCommand = (program) => {
|
|
|
22
22
|
});
|
|
23
23
|
program
|
|
24
24
|
.command('blobs:get')
|
|
25
|
-
.description(`
|
|
25
|
+
.description(`Reads an object with a given key from a Netlify Blobs store and, if it exists, prints the content to the terminal or saves it to a file`)
|
|
26
26
|
.argument('<store>', 'Name of the store')
|
|
27
27
|
.argument('<key>', 'Object key')
|
|
28
28
|
.option('-o, --output <path>', 'Defines the filesystem path where the blob data should be persisted')
|
|
@@ -34,7 +34,7 @@ export const createBlobsCommand = (program) => {
|
|
|
34
34
|
});
|
|
35
35
|
program
|
|
36
36
|
.command('blobs:list')
|
|
37
|
-
.description(`
|
|
37
|
+
.description(`Lists objects in a Netlify Blobs store`)
|
|
38
38
|
.argument('<store>', 'Name of the store')
|
|
39
39
|
.option('-d, --directories', `Indicates that keys with the '/' character should be treated as directories, returning a list of sub-directories at a given level rather than all the keys inside them`)
|
|
40
40
|
.option('-p, --prefix <prefix>', `A string for filtering down the entries; when specified, only the entries whose key starts with that prefix are returned`)
|
|
@@ -47,7 +47,7 @@ export const createBlobsCommand = (program) => {
|
|
|
47
47
|
});
|
|
48
48
|
program
|
|
49
49
|
.command('blobs:set')
|
|
50
|
-
.description(`
|
|
50
|
+
.description(`Writes to a Netlify Blobs store an object with the data provided in the command or the contents of a file defined by the 'input' parameter`)
|
|
51
51
|
.argument('<store>', 'Name of the store')
|
|
52
52
|
.argument('<key>', 'Object key')
|
|
53
53
|
.argument('[value...]', 'Object value')
|
|
@@ -61,7 +61,7 @@ export const createBlobsCommand = (program) => {
|
|
|
61
61
|
return program
|
|
62
62
|
.command('blobs')
|
|
63
63
|
.alias('blob')
|
|
64
|
-
.description(`
|
|
64
|
+
.description(`Manage objects in Netlify Blobs`)
|
|
65
65
|
.addExamples([
|
|
66
66
|
'netlify blobs:get my-store my-key',
|
|
67
67
|
'netlify blobs:set my-store my-key This will go in a blob',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/commands/serve/serve.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAwBxC,OAAO,WAAW,MAAM,oBAAoB,CAAA;AAG5C,eAAO,MAAM,KAAK,YAAmB,YAAY,WAAW,WAAW,uBAgJtE,CAAA"}
|
|
@@ -3,9 +3,9 @@ import { BLOBS_CONTEXT_VARIABLE, encodeBlobsContext, getBlobsContext } from '../
|
|
|
3
3
|
import { promptEditorHelper } from '../../lib/edge-functions/editor-helper.js';
|
|
4
4
|
import { startFunctionsServer } from '../../lib/functions/server.js';
|
|
5
5
|
import { printBanner } from '../../utils/banner.js';
|
|
6
|
-
import {
|
|
6
|
+
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, chalk, exit, log, normalizeConfig, } from '../../utils/command-helpers.js';
|
|
7
7
|
import detectServerSettings, { getConfigWithPlugins } from '../../utils/detect-server-settings.js';
|
|
8
|
-
import { getDotEnvVariables, getSiteInformation, injectEnvVariables
|
|
8
|
+
import { UNLINKED_SITE_MOCK_ID, getDotEnvVariables, getSiteInformation, injectEnvVariables } from '../../utils/dev.js';
|
|
9
9
|
import { getEnvelopeEnv } from '../../utils/env/index.js';
|
|
10
10
|
import { getInternalFunctionsDir } from '../../utils/functions/functions.js';
|
|
11
11
|
import { ensureNetlifyIgnore } from '../../utils/gitignore.js';
|
|
@@ -46,7 +46,11 @@ export const serve = async (options, command) => {
|
|
|
46
46
|
// Ensure the internal functions directory exists so that the functions
|
|
47
47
|
// server and registry are initialized, and any functions created by
|
|
48
48
|
// Netlify Build are loaded.
|
|
49
|
-
await getInternalFunctionsDir({
|
|
49
|
+
await getInternalFunctionsDir({
|
|
50
|
+
base: site.root,
|
|
51
|
+
ensureExists: true,
|
|
52
|
+
packagePath: command.workspacePackage,
|
|
53
|
+
});
|
|
50
54
|
let settings;
|
|
51
55
|
try {
|
|
52
56
|
settings = await detectServerSettings(devConfig, options, command);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAM3C,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/proxy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,MAAM,CAAA;AAM3C,OAAO,WAAW,MAAM,gCAAgC,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAUhD,QAAA,MAAM,aAAa,eAAmC,CAAA;AA4BtD,eAAO,MAAM,kBAAkB,mCAI9B,CAAA;AAKD,UAAU,QAAQ;IAChB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,oBAAoB,aAAc,QAAQ,YAAY,MAAM,WAKxE,CAAA;AAED,eAAO,MAAM,uBAAuB,8BAMnC,CAAA;AAED,eAAO,MAAM,eAAe;eAqBf,MAAM;kBACH,YAAY;aACjB,WAAW;YACZ,QAAQ;gBACJ,MAAM;WACX,OAAO;SACT,QAAQ;aACJ,QAAQ;gBACL,QAAQ;qBACH,QAAQ;sBACP,QAAQ;qBACT,QAAQ;cACf,QAAQ;qBACD,QAAQ;gBACb,MAAM;;cAER,QAAQ;cACR,QAAQ;WACX,QAAQ;oBAyBI,eAAe,GAAG;IAAE,eAAe,EAAE,OAAO,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,iCAkDjF,CAAA;AAGD,eAAO,MAAM,sBAAsB,uBAA4C,CAAA"}
|
|
@@ -6,6 +6,7 @@ import getAvailablePort from 'get-port';
|
|
|
6
6
|
import { NETLIFYDEVERR, chalk, error as printError } from '../../utils/command-helpers.js';
|
|
7
7
|
import { getFeatureFlagsFromSiteInfo } from '../../utils/feature-flags.js';
|
|
8
8
|
import { getGeoLocation } from '../geo-location.js';
|
|
9
|
+
import { getPathInProject } from '../settings.js';
|
|
9
10
|
import { startSpinner, stopSpinner } from '../spinner.js';
|
|
10
11
|
import { getBootstrapURL } from './bootstrap.js';
|
|
11
12
|
import { DIST_IMPORT_MAP_PATH, EDGE_FUNCTIONS_SERVE_FOLDER } from './consts.js';
|
|
@@ -118,7 +119,7 @@ export const initializeProxy = async ({ accountId, blobsContext, command, config
|
|
|
118
119
|
export const isEdgeFunctionsRequest = (req) => req[headersSymbol] !== undefined;
|
|
119
120
|
const prepareServer = async ({ command, config, configPath, debug, directory, env: configEnv, featureFlags, getUpdatedConfig, inspectSettings, port, projectDir, repositoryRoot, }) => {
|
|
120
121
|
try {
|
|
121
|
-
const distImportMapPath =
|
|
122
|
+
const distImportMapPath = getPathInProject([DIST_IMPORT_MAP_PATH]);
|
|
122
123
|
const servePath = resolve(projectDir, command.getPathInProject(EDGE_FUNCTIONS_SERVE_FOLDER));
|
|
123
124
|
await rm(servePath, { force: true, recursive: true });
|
|
124
125
|
const runIsolate = await bundler.serve({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,uBAAuB,CAAA;AAE7G,OAAO,WAAW,MAAM,gCAAgC,CAAA;AAYxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/lib/edge-functions/registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAuD,MAAM,uBAAuB,CAAA;AAE7G,OAAO,WAAW,MAAM,gCAAgC,CAAA;AAYxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAOhE,MAAM,WAAW,MAAM;IACrB,cAAc,CAAC,EAAE,WAAW,EAAE,CAAA;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACvB;AAKD,KAAK,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,cAAc,uBAAuB,EAAE,KAAK,CAAC,CAAC,CAAA;AAInF,UAAU,4BAA4B;IACpC,OAAO,EAAE,WAAW,CAAA;IACpB,OAAO,EAAE,cAAc,uBAAuB,CAAC,CAAA;IAC/C,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,OAAO,CAAA;IACd,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACzD,YAAY,EAAE,YAAY,CAAA;IAC1B,gBAAgB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IACvC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;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AC,QAAQ;IA2ChB;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;IAuC5C;;;OAGG;IACH,OAAO,CAAC,YAAY;IA4CpB;;;OAGG;YACW,QAAQ;IAqBtB,OAAO,KAAK,iBAAiB,GAE5B;YAEa,gBAAgB;YAShB,mBAAmB;YAgBnB,gBAAgB;YA+BhB,aAAa;YAwBb,wBAAwB;CAWvC"}
|
|
@@ -3,12 +3,19 @@ import { join } from 'path';
|
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
import { NETLIFYDEVERR, NETLIFYDEVLOG, NETLIFYDEVWARN, nonNullable, chalk, log, warn, watchDebounced, isNodeError, } from '../../utils/command-helpers.js';
|
|
5
5
|
import { MultiMap } from '../../utils/multimap.js';
|
|
6
|
+
import { getPathInProject } from '../settings.js';
|
|
6
7
|
import { INTERNAL_EDGE_FUNCTIONS_FOLDER } from './consts.js';
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
* and returns an array of all of
|
|
9
|
+
* Given an Edge Bundler module graph and an index of modules by path,
|
|
10
|
+
* traverses its dependency tree and returns an array of all of its
|
|
11
|
+
* local dependencies.
|
|
10
12
|
*/
|
|
11
|
-
function traverseLocalDependencies({ dependencies = [] }, modulesByPath) {
|
|
13
|
+
function traverseLocalDependencies({ dependencies = [], specifier }, modulesByPath, cache) {
|
|
14
|
+
// If we've already traversed this specifier, return the cached list of
|
|
15
|
+
// dependencies.
|
|
16
|
+
if (cache[specifier] !== undefined) {
|
|
17
|
+
return cache[specifier];
|
|
18
|
+
}
|
|
12
19
|
return dependencies.flatMap((dependency) => {
|
|
13
20
|
// We're interested in tracking local dependencies, so we only look at
|
|
14
21
|
// specifiers with the `file:` protocol.
|
|
@@ -20,12 +27,13 @@ function traverseLocalDependencies({ dependencies = [] }, modulesByPath) {
|
|
|
20
27
|
const { specifier: dependencyURL } = dependency.code;
|
|
21
28
|
const dependencyPath = fileURLToPath(dependencyURL);
|
|
22
29
|
const dependencyModule = modulesByPath.get(dependencyPath);
|
|
23
|
-
// No module indexed for this dependency
|
|
30
|
+
// No module indexed for this dependency.
|
|
24
31
|
if (dependencyModule === undefined) {
|
|
25
32
|
return [dependencyPath];
|
|
26
33
|
}
|
|
27
|
-
// Keep traversing the child dependencies and return the current dependency path
|
|
28
|
-
|
|
34
|
+
// Keep traversing the child dependencies and return the current dependency path.
|
|
35
|
+
cache[specifier] = [...traverseLocalDependencies(dependencyModule, modulesByPath, cache), dependencyPath];
|
|
36
|
+
return cache[specifier];
|
|
29
37
|
});
|
|
30
38
|
}
|
|
31
39
|
export class EdgeFunctionsRegistry {
|
|
@@ -305,9 +313,10 @@ export class EdgeFunctionsRegistry {
|
|
|
305
313
|
functionModules.add({ functionName, module });
|
|
306
314
|
}
|
|
307
315
|
});
|
|
316
|
+
const dependencyCache = {};
|
|
308
317
|
// We start from our functions and we traverse through their dependency tree
|
|
309
318
|
functionModules.forEach(({ functionName, module }) => {
|
|
310
|
-
const traversedPaths = traverseLocalDependencies(module, modulesByPath);
|
|
319
|
+
const traversedPaths = traverseLocalDependencies(module, modulesByPath, dependencyCache);
|
|
311
320
|
traversedPaths.forEach((dependencyPath) => {
|
|
312
321
|
this.dependencyPaths.add(dependencyPath, functionName);
|
|
313
322
|
});
|
|
@@ -332,7 +341,7 @@ export class EdgeFunctionsRegistry {
|
|
|
332
341
|
return { functionsConfig, graph, npmSpecifiersWithExtraneousFiles, success };
|
|
333
342
|
}
|
|
334
343
|
get internalDirectory() {
|
|
335
|
-
return join(this.projectDir,
|
|
344
|
+
return join(this.projectDir, getPathInProject([INTERNAL_EDGE_FUNCTIONS_FOLDER]));
|
|
336
345
|
}
|
|
337
346
|
async readDeployConfig() {
|
|
338
347
|
const manifestPath = join(this.internalDirectory, 'manifest.json');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/lib/functions/server.ts"],"names":[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;IACtB,KAAK,EAAE,OAAO,CAAA;IACd,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,QAAQ,EAAE,QAAQ,CAAA;IAClB,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACnB,GAAG,KAAK,yBAAyB,EAAE,mBAAmB,CAAC,KACvD,QAAQ,iBAAiB,GAAG,SAAS,CAiFvC,CAAA"}
|
|
@@ -159,6 +159,11 @@ export const createHandler = function (options) {
|
|
|
159
159
|
handleBackgroundFunctionResult(functionName, error);
|
|
160
160
|
}
|
|
161
161
|
else if (await func.isScheduled()) {
|
|
162
|
+
// In production, scheduled functions always receive POST requests, so we
|
|
163
|
+
// have to emulate that here, even if a user has triggered a GET request
|
|
164
|
+
// as part of their tests. If we don't do this, we'll hit problems when
|
|
165
|
+
// we send the invocation body in a request that can't have a body.
|
|
166
|
+
event.httpMethod = 'POST';
|
|
162
167
|
const { error, result } = await func.invoke({
|
|
163
168
|
...event,
|
|
164
169
|
body: JSON.stringify({
|
|
@@ -173,9 +178,17 @@ export const createHandler = function (options) {
|
|
|
173
178
|
}, clientContext);
|
|
174
179
|
handleScheduledFunction({
|
|
175
180
|
error,
|
|
176
|
-
result,
|
|
177
181
|
request,
|
|
178
182
|
response,
|
|
183
|
+
// When we handle the result of invoking a scheduled function, we'll warn
|
|
184
|
+
// people in case their function returned a body or headers, since those
|
|
185
|
+
// will have no practical effect in production. However, in v2 functions
|
|
186
|
+
// we don't currently have a good way of asserting whether the body we're
|
|
187
|
+
// seeing has been actually produced by user code or by the bootstrap, so
|
|
188
|
+
// we risk printing that warn unnecessarily, which causes more harm than
|
|
189
|
+
// good. Until we find a way of making this detection better, ignore the
|
|
190
|
+
// invocation result entirely for v2 functions.
|
|
191
|
+
result: func.runtimeAPIVersion === 1 ? result : {},
|
|
179
192
|
});
|
|
180
193
|
}
|
|
181
194
|
else {
|
package/dist/lib/settings.d.ts
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Deprecated method to get netlify's home config - ~/.netlify/...
|
|
3
3
|
* @deprecated
|
|
4
|
-
* @param {string[]} paths
|
|
5
|
-
* @returns {string}
|
|
6
4
|
*/
|
|
7
|
-
export declare const getLegacyPathInHome: (paths:
|
|
5
|
+
export declare const getLegacyPathInHome: (paths: string[]) => string;
|
|
8
6
|
/**
|
|
9
7
|
* get a global path on the os base path
|
|
10
|
-
* @param {string[]} paths
|
|
11
|
-
* @returns {string}
|
|
12
8
|
*/
|
|
13
|
-
export declare const getPathInHome: (paths:
|
|
9
|
+
export declare const getPathInHome: (paths: string[]) => string;
|
|
14
10
|
/**
|
|
15
|
-
* get a path inside the project folder
|
|
16
|
-
* @param {string[]} paths
|
|
17
|
-
* @deprecated This does not work in monorepos use Basecommand.getPathInProject instead
|
|
18
|
-
* @returns {string}
|
|
11
|
+
* get a path inside the project folder "NOT WORKSPACE AWARE"
|
|
19
12
|
*/
|
|
20
|
-
export declare const getPathInProject: (paths:
|
|
13
|
+
export declare const getPathInProject: (paths: string[]) => string;
|
|
21
14
|
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/lib/settings.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,UAAW,MAAM,EAAE,WAAoD,CAAA;AAEvG;;GAEG;AACH,eAAO,MAAM,aAAa,UAAW,MAAM,EAAE,WAA6C,CAAA;AAE1F;;GAEG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,EAAE,WAAsC,CAAA"}
|
package/dist/lib/settings.js
CHANGED
|
@@ -6,32 +6,13 @@ const NETLIFY_HOME = '.netlify';
|
|
|
6
6
|
/**
|
|
7
7
|
* Deprecated method to get netlify's home config - ~/.netlify/...
|
|
8
8
|
* @deprecated
|
|
9
|
-
* @param {string[]} paths
|
|
10
|
-
* @returns {string}
|
|
11
9
|
*/
|
|
12
|
-
|
|
13
|
-
export const getLegacyPathInHome = (paths) => {
|
|
14
|
-
const pathInHome = path.join(os.homedir(), NETLIFY_HOME, ...paths);
|
|
15
|
-
return pathInHome;
|
|
16
|
-
};
|
|
10
|
+
export const getLegacyPathInHome = (paths) => path.join(os.homedir(), NETLIFY_HOME, ...paths);
|
|
17
11
|
/**
|
|
18
12
|
* get a global path on the os base path
|
|
19
|
-
* @param {string[]} paths
|
|
20
|
-
* @returns {string}
|
|
21
13
|
*/
|
|
22
|
-
|
|
23
|
-
export const getPathInHome = (paths) => {
|
|
24
|
-
const pathInHome = path.join(OSBasedPaths.config, ...paths);
|
|
25
|
-
return pathInHome;
|
|
26
|
-
};
|
|
14
|
+
export const getPathInHome = (paths) => path.join(OSBasedPaths.config, ...paths);
|
|
27
15
|
/**
|
|
28
|
-
* get a path inside the project folder
|
|
29
|
-
* @param {string[]} paths
|
|
30
|
-
* @deprecated This does not work in monorepos use Basecommand.getPathInProject instead
|
|
31
|
-
* @returns {string}
|
|
16
|
+
* get a path inside the project folder "NOT WORKSPACE AWARE"
|
|
32
17
|
*/
|
|
33
|
-
|
|
34
|
-
export const getPathInProject = (paths) => {
|
|
35
|
-
const pathInProject = path.join(NETLIFY_HOME, ...paths);
|
|
36
|
-
return pathInProject;
|
|
37
|
-
};
|
|
18
|
+
export const getPathInProject = (paths) => path.join(NETLIFY_HOME, ...paths);
|