get-codex-lost-world 1.0.4 → 1.0.5
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/lib/ci/state.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function shouldBuild({ incomingLastModified, cachedLastModified, force }) {
|
|
3
|
+
function shouldBuild({ incomingLastModified, cachedLastModified, incomingNpmVersion, cachedNpmVersion, force }) {
|
|
4
4
|
if (force === true) {
|
|
5
5
|
return true;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
if (incomingLastModified
|
|
9
|
-
return
|
|
8
|
+
if (incomingLastModified !== cachedLastModified) {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if (incomingNpmVersion && incomingNpmVersion !== cachedNpmVersion) {
|
|
13
|
+
return true;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
|
-
return
|
|
16
|
+
return false;
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
module.exports = {
|
|
@@ -237,8 +237,16 @@ function getDefaultDeps(overrides = {}) {
|
|
|
237
237
|
if (!normalizedLocation || !normalizedName) {
|
|
238
238
|
throw new Error('downloader.download requires location and filename');
|
|
239
239
|
}
|
|
240
|
-
|
|
240
|
+
|
|
241
241
|
const outputPath = path.join(normalizedLocation, normalizedName);
|
|
242
|
+
if (fs.existsSync(outputPath)) {
|
|
243
|
+
const answer = await io.prompt(`File already exists: ${outputPath}\nOverwrite? (y/N)`, 'N');
|
|
244
|
+
if (!isAffirmative(answer)) {
|
|
245
|
+
throw new Error(`Download aborted: ${outputPath} already exists.`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
fs.mkdirSync(normalizedLocation, { recursive: true });
|
|
242
250
|
return streamDownload(url, outputPath);
|
|
243
251
|
},
|
|
244
252
|
},
|
|
@@ -279,11 +287,7 @@ function getDefaultDownloadsLocation(env) {
|
|
|
279
287
|
}
|
|
280
288
|
|
|
281
289
|
function getDefaultBuildLocation(env) {
|
|
282
|
-
|
|
283
|
-
return env.PWD.trim();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
return process.cwd();
|
|
290
|
+
return getDefaultDownloadsLocation(env);
|
|
287
291
|
}
|
|
288
292
|
|
|
289
293
|
function usage() {
|
package/package.json
CHANGED
|
@@ -45,18 +45,22 @@ function appendGithubOutput(filePath, outputs) {
|
|
|
45
45
|
function run(env = process.env) {
|
|
46
46
|
const incomingLastModified = env.LAST_MODIFIED;
|
|
47
47
|
const cachedLastModified = env.CACHED_LAST_MODIFIED;
|
|
48
|
+
const incomingNpmVersion = env.NPM_CODEX_VERSION;
|
|
49
|
+
const cachedNpmVersion = env.CACHED_NPM_CODEX_VERSION;
|
|
48
50
|
const force = parseForce(env.FORCE);
|
|
49
51
|
|
|
50
52
|
const build = shouldBuild({
|
|
51
53
|
incomingLastModified,
|
|
52
54
|
cachedLastModified,
|
|
55
|
+
incomingNpmVersion,
|
|
56
|
+
cachedNpmVersion,
|
|
53
57
|
force,
|
|
54
58
|
});
|
|
55
59
|
|
|
56
60
|
const reason = getReason({ force, build });
|
|
57
61
|
|
|
58
62
|
process.stdout.write(
|
|
59
|
-
`CI check: should_build=${build} (reason=${reason}, incoming=${incomingLastModified || ''}, cached=${cachedLastModified || ''}, force=${force})\n`
|
|
63
|
+
`CI check: should_build=${build} (reason=${reason}, incoming=${incomingLastModified || ''}, cached=${cachedLastModified || ''}, npm_incoming=${incomingNpmVersion || ''}, npm_cached=${cachedNpmVersion || ''}, force=${force})\n`
|
|
60
64
|
);
|
|
61
65
|
|
|
62
66
|
appendGithubOutput(env.GITHUB_OUTPUT, {
|