lucid-package 0.0.92 → 0.0.94

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": "lucid-package",
3
- "version": "0.0.92",
3
+ "version": "0.0.94",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
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
- console.log((0, theme_1.success)(`Compiling editor extension ${parts[1]}`));
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
- console.log(cmd);
97
- console.log((0, shellutil_1.execSyncLoggingOutputOnError)(cmd).toString());
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
- console.log((0, theme_1.success)(`Building shape library ${parts[1]}`));
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
- console.log('Adding resource file: ' + filePath + ' -> ' + normalizedZipPath);
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
- console.log((0, theme_1.success)('Writing file package.zip'));
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);
@@ -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>;
@@ -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
- console.log(source);
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
- console.log((0, theme_1.success)(`Writing file ${name}.lcsz`));
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;
@@ -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)));
@@ -2,7 +2,7 @@
2
2
  "devDependencies": {
3
3
  "raw-loader": "^4.0.2",
4
4
  "ts-loader": "^9.2.6",
5
- "typescript": "^4.5.2",
5
+ "typescript": "^5.1.6",
6
6
  "webpack": "^5.64.4"
7
7
  }
8
8
  }
@@ -2,7 +2,7 @@
2
2
  "devDependencies": {
3
3
  "raw-loader": "^4.0.2",
4
4
  "ts-loader": "^9.2.6",
5
- "typescript": "^4.5.2",
5
+ "typescript": "^5.1.6",
6
6
  "webpack": "^5.64.4"
7
7
  }
8
8
  }