lucid-package 0.0.49 → 0.0.50
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 +1 -1
- package/src/package.js +5 -0
- package/src/packagemanifest.js +0 -4
- package/src/shapelibrary.js +6 -1
package/package.json
CHANGED
package/src/package.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.writePackage = exports.updateAllExtensionSDK = exports.modifyManifest =
|
|
|
4
4
|
const fsOld = require("fs");
|
|
5
5
|
const fs = require("fs/promises");
|
|
6
6
|
const JSZip = require("jszip");
|
|
7
|
+
const lucid_extension_sdk_1 = require("lucid-extension-sdk");
|
|
7
8
|
const editorextension_1 = require("./editorextension");
|
|
8
9
|
const filesystemutil_1 = require("./filesystemutil");
|
|
9
10
|
const packagemanifest_1 = require("./packagemanifest");
|
|
@@ -19,6 +20,7 @@ function currentlyInPackage() {
|
|
|
19
20
|
}
|
|
20
21
|
exports.currentlyInPackage = currentlyInPackage;
|
|
21
22
|
const allScopes = new Set(['DOWNLOAD', 'NETWORK', 'READ', 'SHOW_MODAL', 'CUSTOM_UI', 'WRITE']);
|
|
23
|
+
const uuidRegex = /^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i;
|
|
22
24
|
async function modifyManifest(callback, manifestOverrideEnv) {
|
|
23
25
|
const manifest = await (0, packagemanifest_1.readManifest)(manifestOverrideEnv);
|
|
24
26
|
await callback(manifest);
|
|
@@ -43,6 +45,9 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
|
43
45
|
const zip = new JSZip();
|
|
44
46
|
//Increment the patch number automatically on each build
|
|
45
47
|
await modifyManifest(async (manifest) => {
|
|
48
|
+
if (manifest['id'] !== undefined && (!(0, lucid_extension_sdk_1.isString)(manifest['id']) || !uuidRegex.test(manifest['id']))) {
|
|
49
|
+
throw new Error('manifest.json: If "id" is specified, must be a UUID matching the package ID from the Lucid developer portal');
|
|
50
|
+
}
|
|
46
51
|
const parts = manifest['version'].split('.');
|
|
47
52
|
parts[parts.length - 1] = String(parseInt(parts[parts.length - 1], 10) + 1);
|
|
48
53
|
manifest['version'] = parts.join('.');
|
package/src/packagemanifest.js
CHANGED
|
@@ -10,14 +10,10 @@ var SettingType;
|
|
|
10
10
|
SettingType["STRING"] = "string";
|
|
11
11
|
})(SettingType = exports.SettingType || (exports.SettingType = {}));
|
|
12
12
|
const versionRegex = /^\d+\.\d+\.\d+$/;
|
|
13
|
-
const uuidRegex = /^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i;
|
|
14
13
|
function validateManifestOrThrow(manifest) {
|
|
15
14
|
if (!(0, lucid_extension_sdk_1.isObject)(manifest)) {
|
|
16
15
|
throw new Error('manifest.json must be a valid JSON object');
|
|
17
16
|
}
|
|
18
|
-
if (manifest['id'] !== undefined && (!(0, lucid_extension_sdk_1.isString)(manifest['id']) || !uuidRegex.test(manifest['id']))) {
|
|
19
|
-
throw new Error('manifest.json: If "id" is specified, must be a UUID matching the package ID from the Lucid developer portal');
|
|
20
|
-
}
|
|
21
17
|
if (!(0, lucid_extension_sdk_1.isString)(manifest['version']) || !versionRegex.test(manifest['version'])) {
|
|
22
18
|
throw new Error('manifest.json: "version" must be a string in the format <major>.<minor>.<patch>');
|
|
23
19
|
}
|
package/src/shapelibrary.js
CHANGED
|
@@ -138,7 +138,12 @@ async function buildShapeLibrary(name) {
|
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
else {
|
|
141
|
-
|
|
141
|
+
/**
|
|
142
|
+
* On Windows machines '\' is used as the file separator. To ensure that we correctly zip files on Windows
|
|
143
|
+
* machines we replace '\' with '/'.
|
|
144
|
+
*/
|
|
145
|
+
const normalizedSource = path.sep === '\\' ? source.replace(/\\/g, '/') : source;
|
|
146
|
+
zip.file(normalizedSource.replace(`shapelibraries/${name}/`, ''), await fs.readFile(source));
|
|
142
147
|
}
|
|
143
148
|
};
|
|
144
149
|
await addToZip(`shapelibraries/${name}`);
|