@vercel/cli-config 0.2.2 → 0.2.4
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/cli-config.d.ts +2 -2
- package/dist/cli-config.js +2 -1
- package/dist/paths.d.ts +2 -0
- package/dist/paths.js +13 -3
- package/package.json +6 -8
package/dist/cli-config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import type { AuthConfig, AuthFileConfig, GlobalConfig } from './types';
|
|
3
|
-
import { getAuthConfigFilePath, getConfigFilePath, getGlobalPathConfig } from './paths';
|
|
4
|
-
export { getAuthConfigFilePath, getConfigFilePath, getGlobalPathConfig };
|
|
3
|
+
import { getAuthConfigFilePath, getConfigFilePath, getDataPath, getGlobalPathConfig } from './paths';
|
|
4
|
+
export { getAuthConfigFilePath, getConfigFilePath, getDataPath, getGlobalPathConfig, };
|
|
5
5
|
type WriteConfigFileOptions = {
|
|
6
6
|
indent?: number | string;
|
|
7
7
|
mode?: number;
|
package/dist/cli-config.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defaultAuthConfig = exports.defaultGlobalConfig = exports.getGlobalPathConfig = exports.getConfigFilePath = exports.getAuthConfigFilePath = void 0;
|
|
6
|
+
exports.defaultAuthConfig = exports.defaultGlobalConfig = exports.getGlobalPathConfig = exports.getDataPath = exports.getConfigFilePath = exports.getAuthConfigFilePath = void 0;
|
|
7
7
|
exports.getDefaultAuthConfig = getDefaultAuthConfig;
|
|
8
8
|
exports.parseGlobalConfig = parseGlobalConfig;
|
|
9
9
|
exports.parseAuthConfig = parseAuthConfig;
|
|
@@ -27,6 +27,7 @@ const schema_1 = require("./schema");
|
|
|
27
27
|
const paths_1 = require("./paths");
|
|
28
28
|
Object.defineProperty(exports, "getAuthConfigFilePath", { enumerable: true, get: function () { return paths_1.getAuthConfigFilePath; } });
|
|
29
29
|
Object.defineProperty(exports, "getConfigFilePath", { enumerable: true, get: function () { return paths_1.getConfigFilePath; } });
|
|
30
|
+
Object.defineProperty(exports, "getDataPath", { enumerable: true, get: function () { return paths_1.getDataPath; } });
|
|
30
31
|
Object.defineProperty(exports, "getGlobalPathConfig", { enumerable: true, get: function () { return paths_1.getGlobalPathConfig; } });
|
|
31
32
|
const DOCS_URL = 'https://vercel.com/docs/projects/project-configuration/global-configuration';
|
|
32
33
|
exports.defaultGlobalConfig = {
|
package/dist/paths.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Canonical platform application-data directory for the Vercel CLI. */
|
|
2
|
+
export declare function getDataPath(): string;
|
|
1
3
|
export declare function getGlobalPathConfig(): string;
|
|
2
4
|
export declare function getConfigFilePath(configDir: string): string;
|
|
3
5
|
export declare function getAuthConfigFilePath(configDir: string): string;
|
package/dist/paths.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDataPath = getDataPath;
|
|
6
7
|
exports.getGlobalPathConfig = getGlobalPathConfig;
|
|
7
8
|
exports.getConfigFilePath = getConfigFilePath;
|
|
8
9
|
exports.getAuthConfigFilePath = getAuthConfigFilePath;
|
|
@@ -12,7 +13,6 @@ exports.readGlobalConfigFlag = readGlobalConfigFlag;
|
|
|
12
13
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
14
|
const node_path_1 = __importDefault(require("node:path"));
|
|
14
15
|
const node_os_1 = require("node:os");
|
|
15
|
-
const xdg_app_paths_1 = __importDefault(require("xdg-app-paths"));
|
|
16
16
|
function isReadableDirectory(targetPath) {
|
|
17
17
|
try {
|
|
18
18
|
return node_fs_1.default.lstatSync(targetPath).isDirectory();
|
|
@@ -21,12 +21,22 @@ function isReadableDirectory(targetPath) {
|
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
function getDataDirectories(appName) {
|
|
25
|
+
// xdg-app-paths infers a default app name when loaded, which requires a
|
|
26
|
+
// process entrypoint that is not present in every server runtime.
|
|
27
|
+
const XDGAppPaths = require('xdg-app-paths');
|
|
28
|
+
return XDGAppPaths(appName).dataDirs();
|
|
29
|
+
}
|
|
30
|
+
/** Canonical platform application-data directory for the Vercel CLI. */
|
|
31
|
+
function getDataPath() {
|
|
32
|
+
return getDataDirectories('com.vercel.cli')[0];
|
|
33
|
+
}
|
|
24
34
|
function getGlobalPathConfig() {
|
|
25
|
-
const vercelDirectories = (
|
|
35
|
+
const vercelDirectories = getDataDirectories('com.vercel.cli');
|
|
26
36
|
const possibleConfigPaths = [
|
|
27
37
|
...vercelDirectories, // latest vercel directory
|
|
28
38
|
node_path_1.default.join((0, node_os_1.homedir)(), '.now'), // legacy config in user's home directory
|
|
29
|
-
...(
|
|
39
|
+
...getDataDirectories('now'), // legacy XDG directory
|
|
30
40
|
];
|
|
31
41
|
return (possibleConfigPaths.find(configPath => isReadableDirectory(configPath)) ||
|
|
32
42
|
vercelDirectories[0]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/cli-config",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"description": "Shared core utilities for Vercel global configuration",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://vercel.com/docs/projects/project-configuration/global-configuration",
|
|
@@ -26,19 +26,17 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/node": "20.11.0",
|
|
28
28
|
"ts-to-zod": "^3",
|
|
29
|
-
"vite": "
|
|
30
|
-
"vitest": "
|
|
29
|
+
"vite": "6.4.3",
|
|
30
|
+
"vitest": "4.1.10"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "
|
|
36
|
+
"build": "tsc",
|
|
37
37
|
"generate:schemas": "ts-to-zod src/types.ts src/schema.zod.ts",
|
|
38
|
-
"test": "
|
|
39
|
-
"test-unit": "
|
|
40
|
-
"vitest-run": "vitest run -c ../../vitest.config.mts",
|
|
41
|
-
"vitest-unit": "glob --absolute 'test/*.test.ts'",
|
|
38
|
+
"test": "vitest run --config ../../vitest.config.mts test",
|
|
39
|
+
"test-unit": "vitest run --config ../../vitest.config.mts",
|
|
42
40
|
"type-check": "tsc --noEmit"
|
|
43
41
|
}
|
|
44
42
|
}
|