lucid-package 0.0.93 → 0.0.95
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 +2 -2
- package/src/package.js +12 -7
- package/src/shapelibrary.d.ts +1 -1
- package/src/shapelibrary.js +7 -3
- package/src/shellutil.d.ts +1 -1
- package/src/shellutil.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lucid-package",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.95",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"express": "^4.17.1",
|
|
32
32
|
"hjson": "^3.2.2",
|
|
33
33
|
"image-size": "^1.0.2",
|
|
34
|
-
"jszip": "
|
|
34
|
+
"jszip": "3.10.1",
|
|
35
35
|
"lucid-extension-sdk": "^0.0.112",
|
|
36
36
|
"password-prompt": "^1.1.2",
|
|
37
37
|
"ts-loader": "^9.2.6",
|
package/src/package.js
CHANGED
|
@@ -60,6 +60,11 @@ exports.updateAllExtensionSDK = updateAllExtensionSDK;
|
|
|
60
60
|
*/
|
|
61
61
|
async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
62
62
|
const zip = new JSZip();
|
|
63
|
+
const quietableConsoleLog = (...data) => {
|
|
64
|
+
if (!quiet) {
|
|
65
|
+
console.log(data);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
63
68
|
//Increment the patch number automatically on each build
|
|
64
69
|
await modifyManifest(async (manifest) => {
|
|
65
70
|
if (manifest['id'] !== undefined && (!(0, lucid_extension_sdk_1.isString)(manifest['id']) || !uuidRegex.test(manifest['id']))) {
|
|
@@ -82,7 +87,7 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
|
82
87
|
const parts = extension['codePath'].split(path.sep);
|
|
83
88
|
if (parts[0] === 'editorextensions') {
|
|
84
89
|
//Can't just call the method, as the WebpackCLI class does process.exit(2) :facepalm:
|
|
85
|
-
|
|
90
|
+
quietableConsoleLog((0, theme_1.success)(`Compiling editor extension ${parts[1]}`));
|
|
86
91
|
// Quotes are needed around every use of a path to deal with spaces
|
|
87
92
|
const cmd = '"' +
|
|
88
93
|
process.argv[0] +
|
|
@@ -93,8 +98,8 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
|
93
98
|
'"' +
|
|
94
99
|
parts[1] +
|
|
95
100
|
'"';
|
|
96
|
-
|
|
97
|
-
|
|
101
|
+
quietableConsoleLog(cmd);
|
|
102
|
+
quietableConsoleLog((0, shellutil_1.execSyncLoggingOutputOnError)(cmd, quiet = quiet).toString());
|
|
98
103
|
}
|
|
99
104
|
zip.file(extension['codePath'], await fs.readFile(extension['codePath']));
|
|
100
105
|
}
|
|
@@ -102,8 +107,8 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
|
102
107
|
for (const library of manifest['shapeLibraries'] || []) {
|
|
103
108
|
const parts = library['lcszPath'].split(path.sep);
|
|
104
109
|
if (parts[0] === 'shapelibraries') {
|
|
105
|
-
|
|
106
|
-
await (0, shapelibrary_1.buildShapeLibrary)(parts[1].replace('.lcsz', ''));
|
|
110
|
+
quietableConsoleLog((0, theme_1.success)(`Building shape library ${parts[1]}`));
|
|
111
|
+
await (0, shapelibrary_1.buildShapeLibrary)(parts[1].replace('.lcsz', ''), quiet);
|
|
107
112
|
}
|
|
108
113
|
zip.file(library['lcszPath'], await fs.readFile(library['lcszPath']));
|
|
109
114
|
}
|
|
@@ -121,7 +126,7 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
|
121
126
|
zipPath = zipDirectory + filePath.substring(directory.length);
|
|
122
127
|
}
|
|
123
128
|
const normalizedZipPath = (0, filesystemutil_1.getNormalizedZipPath)(zipPath);
|
|
124
|
-
|
|
129
|
+
quietableConsoleLog('Adding resource file: ' + filePath + ' -> ' + normalizedZipPath);
|
|
125
130
|
zip.file(normalizedZipPath, await fs.readFile(filePath));
|
|
126
131
|
}
|
|
127
132
|
else if (stat.isDirectory()) {
|
|
@@ -144,7 +149,7 @@ async function writePackage(quiet = false, manifestOverrideEnv) {
|
|
|
144
149
|
compression: 'DEFLATE',
|
|
145
150
|
compressionOptions: { level: 9 },
|
|
146
151
|
});
|
|
147
|
-
|
|
152
|
+
quietableConsoleLog((0, theme_1.success)('Writing file package.zip'));
|
|
148
153
|
const fileName = `package${manifestOverrideEnv ? `-${manifestOverrideEnv}` : ''}.zip`;
|
|
149
154
|
await fs.writeFile(fileName, zipBytes);
|
|
150
155
|
}, manifestOverrideEnv);
|
package/src/shapelibrary.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export interface ImageShapeConfig {
|
|
|
6
6
|
export declare function createEmptyShapeLibrary(name: string): Promise<void>;
|
|
7
7
|
export declare function createImageShapeLibrary(name: string, imagePath: string, config: ImageShapeConfig): Promise<void>;
|
|
8
8
|
export declare function getShapeListJson(name: string, packagePath: string, port?: number): Promise<string>;
|
|
9
|
-
export declare function buildShapeLibrary(name: string): Promise<void>;
|
|
9
|
+
export declare function buildShapeLibrary(name: string, quiet: boolean): Promise<void>;
|
|
10
10
|
export declare function debugShapeLibraries(packagePath?: string, pickAnyPort?: boolean): Promise<void>;
|
package/src/shapelibrary.js
CHANGED
|
@@ -232,10 +232,12 @@ async function getShapeListJson(name, packagePath, port = 9901) {
|
|
|
232
232
|
})));
|
|
233
233
|
}
|
|
234
234
|
exports.getShapeListJson = getShapeListJson;
|
|
235
|
-
async function buildShapeLibrary(name) {
|
|
235
|
+
async function buildShapeLibrary(name, quiet) {
|
|
236
236
|
const zip = new JSZip();
|
|
237
237
|
const addToZip = async (source) => {
|
|
238
|
-
|
|
238
|
+
if (!quiet) {
|
|
239
|
+
console.log(source);
|
|
240
|
+
}
|
|
239
241
|
const stat = await fs.lstat(source);
|
|
240
242
|
if (stat.isDirectory()) {
|
|
241
243
|
const dir = await fs.readdir(source);
|
|
@@ -250,7 +252,9 @@ async function buildShapeLibrary(name) {
|
|
|
250
252
|
};
|
|
251
253
|
await addToZip(`shapelibraries/${name}`);
|
|
252
254
|
const zipBytes = await zip.generateAsync({ type: 'uint8array' });
|
|
253
|
-
|
|
255
|
+
if (!quiet) {
|
|
256
|
+
console.log((0, theme_1.success)(`Writing file ${name}.lcsz`));
|
|
257
|
+
}
|
|
254
258
|
await fs.writeFile(`shapelibraries/${name}.lcsz`, zipBytes);
|
|
255
259
|
}
|
|
256
260
|
exports.buildShapeLibrary = buildShapeLibrary;
|
package/src/shellutil.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
export declare function execSyncLoggingOutputOnError(cmd: string): Buffer;
|
|
2
|
+
export declare function execSyncLoggingOutputOnError(cmd: string, quiet?: boolean): Buffer;
|
package/src/shellutil.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.execSyncLoggingOutputOnError = void 0;
|
|
4
4
|
const child_process = require("child_process");
|
|
5
5
|
const theme_1 = require("./theme");
|
|
6
|
-
function execSyncLoggingOutputOnError(cmd) {
|
|
6
|
+
function execSyncLoggingOutputOnError(cmd, quiet = false) {
|
|
7
7
|
try {
|
|
8
|
-
return child_process.execSync(cmd);
|
|
8
|
+
return child_process.execSync(cmd, quiet ? { stdio: [0, 'pipe', 'pipe'] } : {});
|
|
9
9
|
}
|
|
10
10
|
catch (e) {
|
|
11
11
|
console.log((0, theme_1.error)(String(e.stdout)));
|