@hubspot/local-dev-lib 3.17.0 → 3.18.0-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/lang/en.json +2 -1
- package/lib/crm.js +8 -0
- package/package.json +1 -1
package/lang/en.json
CHANGED
|
@@ -82,7 +82,8 @@
|
|
|
82
82
|
"importData": {
|
|
83
83
|
"errors": {
|
|
84
84
|
"fileNotFound": "The file {{ fileName }} does not exist",
|
|
85
|
-
"notJson": "You must provide a JSON file for the import data request schema."
|
|
85
|
+
"notJson": "You must provide a JSON file for the import data request schema.",
|
|
86
|
+
"noFiles": "You must provide at least one data file for the import data request schema."
|
|
86
87
|
}
|
|
87
88
|
}
|
|
88
89
|
},
|
package/lib/crm.js
CHANGED
|
@@ -12,6 +12,14 @@ function getImportDataRequest(fileName) {
|
|
|
12
12
|
validateImportRequestFile(fileName);
|
|
13
13
|
const importRequest = fs_extra_1.default.readJsonSync(path_1.default.resolve((0, path_2.getCwd)(), fileName));
|
|
14
14
|
const dataFileNames = importRequest.files.map(file => file.fileName);
|
|
15
|
+
// allow relative paths in the provided import request
|
|
16
|
+
importRequest.files = importRequest.files.map(file => ({
|
|
17
|
+
...file,
|
|
18
|
+
fileName: path_1.default.basename(file.fileName),
|
|
19
|
+
}));
|
|
20
|
+
if (dataFileNames.length === 0) {
|
|
21
|
+
throw new Error((0, lang_1.i18n)('lib.crm.importData.errors.noFiles'));
|
|
22
|
+
}
|
|
15
23
|
dataFileNames.forEach(fileName => {
|
|
16
24
|
if (!fileExists(fileName)) {
|
|
17
25
|
throw new Error((0, lang_1.i18n)('lib.crm.importData.errors.fileNotFound', { fileName }));
|
package/package.json
CHANGED