lucid-package 0.0.122 → 0.0.123

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/package.js +7 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-package",
3
- "version": "0.0.122",
3
+ "version": "0.0.123",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
package/src/package.js CHANGED
@@ -61,6 +61,8 @@ exports.updateAllExtensionSDK = updateAllExtensionSDK;
61
61
  */
62
62
  async function writePackage(quiet = false, manifestOverrideEnv, skipSdkDependency = false) {
63
63
  const zip = new JSZip();
64
+ // A fixed date for reproducible output
65
+ const reproducibleTimestamp = new Date('2000-01-01T00:00:00Z');
64
66
  const quietableConsoleLog = (...data) => {
65
67
  if (!quiet) {
66
68
  console.log(data);
@@ -103,7 +105,7 @@ async function writePackage(quiet = false, manifestOverrideEnv, skipSdkDependenc
103
105
  quietableConsoleLog(cmd);
104
106
  quietableConsoleLog((0, shellutil_1.execSyncLoggingOutputOnError)(cmd, (quiet = quiet)).toString());
105
107
  }
106
- zip.file(extension['codePath'], await fs.readFile(extension['codePath']));
108
+ zip.file(extension['codePath'], await fs.readFile(extension['codePath']), { date: reproducibleTimestamp });
107
109
  }
108
110
  //Do the same for each shape library
109
111
  for (const library of manifest['shapeLibraries'] || []) {
@@ -112,14 +114,14 @@ async function writePackage(quiet = false, manifestOverrideEnv, skipSdkDependenc
112
114
  quietableConsoleLog((0, theme_1.success)(`Building shape library ${parts[1]}`));
113
115
  await (0, shapelibrary_1.buildShapeLibrary)(parts[1].replace('.lcsz', ''), quiet);
114
116
  }
115
- zip.file(library['lcszPath'], await fs.readFile(library['lcszPath']));
117
+ zip.file(library['lcszPath'], await fs.readFile(library['lcszPath']), { date: reproducibleTimestamp });
116
118
  }
117
119
  //Add any static resources
118
120
  const checkDirForResources = async (directory, zipDirectory) => {
119
121
  if (!fsOld.existsSync(directory)) {
120
122
  return;
121
123
  }
122
- for (const fileName of await fs.readdir(directory)) {
124
+ for (const fileName of (await fs.readdir(directory)).sort()) {
123
125
  const filePath = path.join(directory, fileName);
124
126
  const stat = await fs.stat(filePath);
125
127
  if (stat.isFile()) {
@@ -129,7 +131,7 @@ async function writePackage(quiet = false, manifestOverrideEnv, skipSdkDependenc
129
131
  }
130
132
  const normalizedZipPath = (0, filesystemutil_1.getNormalizedZipPath)(zipPath);
131
133
  quietableConsoleLog('Adding resource file: ' + filePath + ' -> ' + normalizedZipPath);
132
- zip.file(normalizedZipPath, await fs.readFile(filePath));
134
+ zip.file(normalizedZipPath, await fs.readFile(filePath), { date: reproducibleTimestamp });
133
135
  }
134
136
  else if (stat.isDirectory()) {
135
137
  await checkDirForResources(filePath, zipDirectory ? path.join(zipDirectory, fileName) : undefined);
@@ -144,7 +146,7 @@ async function writePackage(quiet = false, manifestOverrideEnv, skipSdkDependenc
144
146
  }
145
147
  }
146
148
  //Add the manifest itself
147
- zip.file('manifest.json', JSON.stringify(manifest, undefined, 2));
149
+ zip.file('manifest.json', JSON.stringify(manifest, undefined, 2), { date: reproducibleTimestamp });
148
150
  //Write out the zip file
149
151
  const zipBytes = await zip.generateAsync({
150
152
  type: 'uint8array',