@vercel/cli-config 0.2.3 → 0.2.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.
@@ -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, getCachePath, getConfigFilePath, getDataPath, getGlobalPathConfig } from './paths';
4
+ export { getAuthConfigFilePath, getCachePath, getConfigFilePath, getDataPath, getGlobalPathConfig, };
5
5
  type WriteConfigFileOptions = {
6
6
  indent?: number | string;
7
7
  mode?: number;
@@ -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.getCachePath = exports.getAuthConfigFilePath = void 0;
7
7
  exports.getDefaultAuthConfig = getDefaultAuthConfig;
8
8
  exports.parseGlobalConfig = parseGlobalConfig;
9
9
  exports.parseAuthConfig = parseAuthConfig;
@@ -26,7 +26,9 @@ const zod_1 = require("zod");
26
26
  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
+ Object.defineProperty(exports, "getCachePath", { enumerable: true, get: function () { return paths_1.getCachePath; } });
29
30
  Object.defineProperty(exports, "getConfigFilePath", { enumerable: true, get: function () { return paths_1.getConfigFilePath; } });
31
+ Object.defineProperty(exports, "getDataPath", { enumerable: true, get: function () { return paths_1.getDataPath; } });
30
32
  Object.defineProperty(exports, "getGlobalPathConfig", { enumerable: true, get: function () { return paths_1.getGlobalPathConfig; } });
31
33
  const DOCS_URL = 'https://vercel.com/docs/projects/project-configuration/global-configuration';
32
34
  exports.defaultGlobalConfig = {
package/dist/paths.d.ts CHANGED
@@ -1,3 +1,7 @@
1
+ /** Canonical platform application-data directory for the Vercel CLI. */
2
+ export declare function getDataPath(): string;
3
+ /** Canonical platform cache directory for the Vercel CLI. */
4
+ export declare function getCachePath(): string;
1
5
  export declare function getGlobalPathConfig(): string;
2
6
  export declare function getConfigFilePath(configDir: string): string;
3
7
  export declare function getAuthConfigFilePath(configDir: string): string;
package/dist/paths.js CHANGED
@@ -3,6 +3,8 @@ 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;
7
+ exports.getCachePath = getCachePath;
6
8
  exports.getGlobalPathConfig = getGlobalPathConfig;
7
9
  exports.getConfigFilePath = getConfigFilePath;
8
10
  exports.getAuthConfigFilePath = getAuthConfigFilePath;
@@ -20,15 +22,29 @@ function isReadableDirectory(targetPath) {
20
22
  return false;
21
23
  }
22
24
  }
23
- function getGlobalPathConfig() {
25
+ function getAppPaths(appName) {
24
26
  // xdg-app-paths infers a default app name when loaded, which requires a
25
27
  // process entrypoint that is not present in every server runtime.
26
28
  const XDGAppPaths = require('xdg-app-paths');
27
- const vercelDirectories = XDGAppPaths('com.vercel.cli').dataDirs();
29
+ return XDGAppPaths(appName);
30
+ }
31
+ function getDataDirectories(appName) {
32
+ return getAppPaths(appName).dataDirs();
33
+ }
34
+ /** Canonical platform application-data directory for the Vercel CLI. */
35
+ function getDataPath() {
36
+ return getDataDirectories('com.vercel.cli')[0];
37
+ }
38
+ /** Canonical platform cache directory for the Vercel CLI. */
39
+ function getCachePath() {
40
+ return getAppPaths('com.vercel.cli').cache();
41
+ }
42
+ function getGlobalPathConfig() {
43
+ const vercelDirectories = getDataDirectories('com.vercel.cli');
28
44
  const possibleConfigPaths = [
29
45
  ...vercelDirectories, // latest vercel directory
30
46
  node_path_1.default.join((0, node_os_1.homedir)(), '.now'), // legacy config in user's home directory
31
- ...XDGAppPaths('now').dataDirs(), // legacy XDG directory
47
+ ...getDataDirectories('now'), // legacy XDG directory
32
48
  ];
33
49
  return (possibleConfigPaths.find(configPath => isReadableDirectory(configPath)) ||
34
50
  vercelDirectories[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/cli-config",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
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",