@vercel/cli-config 0.2.3 → 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.
@@ -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;
@@ -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;
@@ -20,15 +21,22 @@ function isReadableDirectory(targetPath) {
20
21
  return false;
21
22
  }
22
23
  }
23
- function getGlobalPathConfig() {
24
+ function getDataDirectories(appName) {
24
25
  // xdg-app-paths infers a default app name when loaded, which requires a
25
26
  // process entrypoint that is not present in every server runtime.
26
27
  const XDGAppPaths = require('xdg-app-paths');
27
- const vercelDirectories = XDGAppPaths('com.vercel.cli').dataDirs();
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
+ }
34
+ function getGlobalPathConfig() {
35
+ const vercelDirectories = getDataDirectories('com.vercel.cli');
28
36
  const possibleConfigPaths = [
29
37
  ...vercelDirectories, // latest vercel directory
30
38
  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
39
+ ...getDataDirectories('now'), // legacy XDG directory
32
40
  ];
33
41
  return (possibleConfigPaths.find(configPath => isReadableDirectory(configPath)) ||
34
42
  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.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",