@hubspot/project-parsing-lib 0.8.5 → 0.8.6-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/project-parsing-lib",
3
- "version": "0.8.5",
3
+ "version": "0.8.6-beta.0",
4
4
  "description": "Parsing library for converting projects directory structures to their intermediate representation",
5
5
  "license": "Apache-2.0",
6
6
  "main": "src/index.js",
@@ -10,3 +10,4 @@ export declare function locateHsMetaFiles(projectSourceDir: string, options?: {
10
10
  silent: boolean;
11
11
  }): Promise<MetaFileLocation[]>;
12
12
  export declare function projectContainsHsMetaFiles(projectSourceDir: string): Promise<boolean>;
13
+ export declare function convertPathToPosixPath(filepath: string): string;
package/src/lib/files.js CHANGED
@@ -8,6 +8,7 @@ exports.getAllHsProfiles = getAllHsProfiles;
8
8
  exports.loadHsMetaFiles = loadHsMetaFiles;
9
9
  exports.locateHsMetaFiles = locateHsMetaFiles;
10
10
  exports.projectContainsHsMetaFiles = projectContainsHsMetaFiles;
11
+ exports.convertPathToPosixPath = convertPathToPosixPath;
11
12
  const fs_1 = __importDefault(require("fs"));
12
13
  const path_1 = __importDefault(require("path"));
13
14
  const fs_2 = require("@hubspot/local-dev-lib/fs");
@@ -112,3 +113,6 @@ async function projectContainsHsMetaFiles(projectSourceDir) {
112
113
  const hsMetaFiles = (await (0, fs_2.walk)(projectSourceDir, ['node_modules'])).filter(file => file.endsWith(constants_1.metafileExtension));
113
114
  return hsMetaFiles.length > 0;
114
115
  }
116
+ function convertPathToPosixPath(filepath) {
117
+ return filepath.replaceAll(path_1.default.win32.sep, path_1.default.posix.sep);
118
+ }
@@ -16,6 +16,7 @@ const profiles_1 = require("./profiles");
16
16
  const constants_1 = require("./constants");
17
17
  const copy_1 = require("../lang/copy");
18
18
  const utils_1 = require("./utils");
19
+ const files_1 = require("./files");
19
20
  function calculateComponentDeps(fileValidationResult, parentComponents, appObjects, appFunctionsPackageUid) {
20
21
  let dependencies = {};
21
22
  // If there are dependencies in the config file, pass them through
@@ -113,7 +114,7 @@ function transform(fileParseResults, translationContext, hsProfileContents) {
113
114
  config,
114
115
  componentType: mapToInternalType(type),
115
116
  componentDeps: dependencies,
116
- metaFilePath: currentFile.file,
117
+ metaFilePath: (0, files_1.convertPathToPosixPath)(currentFile.file),
117
118
  files: {},
118
119
  },
119
120
  fileParseResult: currentFile,
@@ -184,10 +185,11 @@ function getProfileData(hsProfileContents) {
184
185
  return { vars: { profileVariables: profileVariablesForBE } };
185
186
  }
186
187
  function generateServerlessPackageComponent(appFunctionsDirectory, translationContext, componentDeps) {
187
- const packageFile = path_1.default.join(appFunctionsDirectory, constants_1.packageJson);
188
- const packageLockFile = path_1.default.join(appFunctionsDirectory, constants_1.packageLockJson);
189
- const { projectSourceDir } = translationContext;
190
- const appFunctionsPackageFile = path_1.default.join(projectSourceDir, packageFile);
188
+ const appFunctionsPosix = (0, files_1.convertPathToPosixPath)(appFunctionsDirectory);
189
+ const packageFilePosix = path_1.default.posix.join(appFunctionsPosix, constants_1.packageJson);
190
+ const packageLockFilePosix = path_1.default.posix.join(appFunctionsPosix, constants_1.packageLockJson);
191
+ const projectSourceDirPosix = (0, files_1.convertPathToPosixPath)(translationContext.projectSourceDir);
192
+ const appFunctionsPackageFile = path_1.default.posix.join(projectSourceDirPosix, packageFilePosix);
191
193
  if (!fs_1.default.existsSync(appFunctionsPackageFile)) {
192
194
  throw new Error(copy_1.errorMessages.project.noPackageJsonForServerless(appFunctionsPackageFile));
193
195
  }
@@ -203,13 +205,15 @@ function generateServerlessPackageComponent(appFunctionsDirectory, translationCo
203
205
  uid,
204
206
  componentType: mapToInternalType(constants_1.AppFunctionsPackageKey),
205
207
  config: {
206
- packageFile,
207
- packageLockfile: fs_1.default.existsSync(path_1.default.join(projectSourceDir, packageLockFile))
208
- ? packageLockFile
208
+ packageFile: packageFilePosix,
209
+ packageLockfile: fs_1.default.existsSync(
210
+ // Don't use posix here because we are checking the file system
211
+ path_1.default.join(translationContext.projectSourceDir, path_1.default.join(appFunctionsDirectory, constants_1.packageLockJson)))
212
+ ? packageLockFilePosix
209
213
  : undefined,
210
214
  },
211
215
  componentDeps,
212
- metaFilePath: packageFile,
216
+ metaFilePath: packageFilePosix,
213
217
  files: {},
214
218
  },
215
219
  },