@datapos/datapos-development 0.2.29 → 0.3.2
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/index.js +11 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -10,11 +10,13 @@ const exec = util.promisify(require('child_process').exec);
|
|
|
10
10
|
async function buildConfig() {
|
|
11
11
|
const configJSON = await readJSONFile('src/config.json');
|
|
12
12
|
const packageJSON = await readJSONFile('package.json');
|
|
13
|
-
fs.writeFile('src/config.json', JSON.stringify({ ...configJSON, id: packageJSON.name, version: packageJSON.version }, undefined, 4));
|
|
13
|
+
await fs.writeFile('src/config.json', JSON.stringify({ ...configJSON, id: packageJSON.name, version: packageJSON.version }, undefined, 4));
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
// Operations - Build Public Directory Index
|
|
17
17
|
async function buildPublicDirectoryIndex(id) {
|
|
18
|
+
const index = {};
|
|
19
|
+
|
|
18
20
|
async function listDirectoryEntriesRecursively(directoryPath, names) {
|
|
19
21
|
const entries = [];
|
|
20
22
|
const localDirectoryPath = directoryPath.substring(`public/${id}`.length);
|
|
@@ -34,13 +36,16 @@ async function buildPublicDirectoryIndex(id) {
|
|
|
34
36
|
console.error(`Unable to get information for '${name}' in 'buildPublicDirectoryIndex'.`, error);
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
entries.sort((left, right) => right.typeId.localeCompare(left.typeId) || left.name.localeCompare(right.name));
|
|
39
|
+
// entries.sort((left, right) => right.typeId.localeCompare(left.typeId) || left.name.localeCompare(right.name));
|
|
40
|
+
entries.sort((left, right) => {
|
|
41
|
+
const typeComparison = left.typeId.localeCompare(right.typeId);
|
|
42
|
+
return typeComparison !== 0 ? typeComparison : left.name.localeCompare(right.name);
|
|
43
|
+
});
|
|
38
44
|
}
|
|
39
45
|
|
|
40
|
-
const index = {};
|
|
41
46
|
const toplevelNames = await fs.readdir(`public/${id}`);
|
|
42
47
|
await listDirectoryEntriesRecursively(`public/${id}`, toplevelNames);
|
|
43
|
-
fs.writeFile(`./public/${id}Index.json`, JSON.stringify(index), (error) => {
|
|
48
|
+
await fs.writeFile(`./public/${id}Index.json`, JSON.stringify(index), (error) => {
|
|
44
49
|
if (error) return console.error(error);
|
|
45
50
|
});
|
|
46
51
|
}
|
|
@@ -50,7 +55,7 @@ async function bumpVersion() {
|
|
|
50
55
|
const packageJSON = await readJSONFile('package.json');
|
|
51
56
|
const versionSegments = packageJSON.version.split('.');
|
|
52
57
|
packageJSON.version = `${versionSegments[0]}.${versionSegments[1]}.${Number(versionSegments[2]) + 1}`;
|
|
53
|
-
fs.writeFile('package.json', JSON.stringify(packageJSON, undefined, 4));
|
|
58
|
+
await fs.writeFile('package.json', JSON.stringify(packageJSON, undefined, 4));
|
|
54
59
|
console.log(`Bumped to version ${packageJSON.version}.`);
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -137,7 +142,7 @@ async function uploadModuleConfig() {
|
|
|
137
142
|
async function uploadModuleToR2(fromPath, toPath) {
|
|
138
143
|
const packageJSON = await readJSONFile('package.json');
|
|
139
144
|
const toPathWithVersion = toPath.replace(/^(.*?\.)/, `$1v${packageJSON.version}.`);
|
|
140
|
-
exec(`wrangler r2 object put ${toPathWithVersion} --file=dist/${fromPath} --content-type application/javascript --jurisdiction=eu --remote`, { stdio: 'inherit' });
|
|
145
|
+
await exec(`wrangler r2 object put ${toPathWithVersion} --file=dist/${fromPath} --content-type application/javascript --jurisdiction=eu --remote`, { stdio: 'inherit' });
|
|
141
146
|
}
|
|
142
147
|
|
|
143
148
|
// Utilities - Read JSON File
|