@hubspot/local-dev-lib 1.11.0 → 1.12.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/path.d.ts CHANGED
@@ -11,3 +11,4 @@ export declare function isAllowedExtension(filepath: string, allowList?: Array<s
11
11
  export declare function getAbsoluteFilePath(_path: string): string;
12
12
  export declare function sanitizeFileName(fileName: string): string;
13
13
  export declare function isValidPath(_path: string): boolean;
14
+ export declare function untildify(pathWithTilde: string): string;
package/lib/path.js CHANGED
@@ -3,10 +3,11 @@ 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.isValidPath = exports.sanitizeFileName = exports.getAbsoluteFilePath = exports.isAllowedExtension = exports.getAllowedExtensions = exports.getExt = exports.getCwd = exports.splitHubSpotPath = exports.splitLocalPath = exports.convertToLocalFileSystemPath = exports.convertToUnixPath = void 0;
6
+ exports.untildify = exports.isValidPath = exports.sanitizeFileName = exports.getAbsoluteFilePath = exports.isAllowedExtension = exports.getAllowedExtensions = exports.getExt = exports.getCwd = exports.splitHubSpotPath = exports.splitLocalPath = exports.convertToLocalFileSystemPath = exports.convertToUnixPath = void 0;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const unixify_1 = __importDefault(require("unixify"));
9
9
  const extensions_1 = require("../constants/extensions");
10
+ const os_1 = __importDefault(require("os"));
10
11
  function convertToUnixPath(_path) {
11
12
  return (0, unixify_1.default)(path_1.default.normalize(_path));
12
13
  }
@@ -120,3 +121,14 @@ function isValidPath(_path) {
120
121
  return true;
121
122
  }
122
123
  exports.isValidPath = isValidPath;
124
+ // Based on the untildify package: https://github.com/sindresorhus/untildify/blob/main/index.js
125
+ function untildify(pathWithTilde) {
126
+ const homeDirectory = os_1.default.homedir();
127
+ if (typeof pathWithTilde !== 'string') {
128
+ throw new TypeError(`Expected a string, got ${typeof pathWithTilde}`);
129
+ }
130
+ return homeDirectory
131
+ ? pathWithTilde.replace(/^~(?=$|\/|\\)/, homeDirectory)
132
+ : pathWithTilde;
133
+ }
134
+ exports.untildify = untildify;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/local-dev-lib",
3
- "version": "1.11.0",
3
+ "version": "1.12.0",
4
4
  "description": "Provides library functionality for HubSpot local development tooling, including the HubSpot CLI",
5
5
  "main": "lib/index.js",
6
6
  "repository": {