isaacscript 1.1.74-dev.3 → 1.2.3
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/dist/package.json +5 -5
- package/dist/src/commands/copy/copy.js +13 -12
- package/dist/src/commands/copy/copy.js.map +1 -1
- package/dist/src/commands/init/checkIfProjectPathExists.js +2 -2
- package/dist/src/commands/init/checkIfProjectPathExists.js.map +1 -1
- package/dist/src/commands/init/checkModTargetDirectory.js +2 -2
- package/dist/src/commands/init/checkModTargetDirectory.js.map +1 -1
- package/dist/src/commands/init/createMod.js +55 -34
- package/dist/src/commands/init/createMod.js.map +1 -1
- package/dist/src/commands/init/init.js +10 -8
- package/dist/src/commands/init/init.js.map +1 -1
- package/dist/src/commands/init/installVSCodeExtensions.js +3 -2
- package/dist/src/commands/init/installVSCodeExtensions.js.map +1 -1
- package/dist/src/commands/init/promptVSCode.js +7 -7
- package/dist/src/commands/init/promptVSCode.js.map +1 -1
- package/dist/src/commands/monitor/copyWatcherMod.js +7 -7
- package/dist/src/commands/monitor/copyWatcherMod.js.map +1 -1
- package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +4 -4
- package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -1
- package/dist/src/commands/monitor/monitor.js +4 -3
- package/dist/src/commands/monitor/monitor.js.map +1 -1
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js +1 -1
- package/dist/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
- package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js +3 -3
- package/dist/src/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -1
- package/dist/src/commands/publish/publish.js +48 -46
- package/dist/src/commands/publish/publish.js.map +1 -1
- package/dist/src/configFile.js +4 -3
- package/dist/src/configFile.js.map +1 -1
- package/dist/src/exec.js +79 -0
- package/dist/src/exec.js.map +1 -0
- package/dist/src/file.js +35 -5
- package/dist/src/file.js.map +1 -1
- package/dist/src/main.js +1 -1
- package/dist/src/main.js.map +1 -1
- package/dist/src/monkeyPatch.js +8 -14
- package/dist/src/monkeyPatch.js.map +1 -1
- package/dist/src/parseArgs.js +20 -1
- package/dist/src/parseArgs.js.map +1 -1
- package/dist/src/util.js +22 -57
- package/dist/src/util.js.map +1 -1
- package/dist/src/validateNodeVersion.js +6 -24
- package/dist/src/validateNodeVersion.js.map +1 -1
- package/package.json +5 -5
- package/publish.sh +1 -1
- package/src/commands/copy/copy.ts +20 -12
- package/src/commands/init/checkIfProjectPathExists.ts +2 -1
- package/src/commands/init/checkModTargetDirectory.ts +2 -1
- package/src/commands/init/createMod.ts +87 -29
- package/src/commands/init/init.ts +15 -7
- package/src/commands/init/installVSCodeExtensions.ts +4 -2
- package/src/commands/init/promptVSCode.ts +12 -7
- package/src/commands/monitor/copyWatcherMod.ts +10 -7
- package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +3 -3
- package/src/commands/monitor/monitor.ts +5 -3
- package/src/commands/monitor/saveDatWriter/saveDatWriter.ts +1 -1
- package/src/commands/monitor/touchWatcherSaveDatFiles.ts +6 -3
- package/src/commands/publish/publish.ts +65 -55
- package/src/configFile.ts +9 -3
- package/src/exec.ts +102 -0
- package/src/file.ts +48 -5
- package/src/main.ts +1 -1
- package/src/monkeyPatch.ts +8 -13
- package/src/parseArgs.ts +22 -1
- package/src/util.ts +29 -79
- package/src/validateNodeVersion.ts +7 -39
package/dist/src/monkeyPatch.js
CHANGED
|
@@ -22,7 +22,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.monkeyPatchMainLua = void 0;
|
|
26
25
|
const path_1 = __importDefault(require("path"));
|
|
27
26
|
const constants_1 = require("./constants");
|
|
28
27
|
const file = __importStar(require("./file"));
|
|
@@ -43,27 +42,21 @@ see the official website: https://isaacscript.github.io/
|
|
|
43
42
|
|
|
44
43
|
`;
|
|
45
44
|
const MAIN_LUA_REPLACEMENTS = [
|
|
46
|
-
// For TSTL v1.2.X
|
|
45
|
+
// For TSTL v1.2.X-v1.3.3
|
|
46
|
+
// (fixed with GlassBrick's PR)
|
|
47
47
|
["WeakMap = __TS__Class()", "WeakMap = WeakMap or __TS__Class()"],
|
|
48
48
|
["WeakSet = __TS__Class()", "WeakSet = WeakSet or __TS__Class()"],
|
|
49
49
|
["Map = __TS__Class()", "Map = Map or __TS__Class()"],
|
|
50
50
|
["Set = __TS__Class()", "Set = Set or __TS__Class()"],
|
|
51
|
-
// For TSTL v1.1.1
|
|
52
|
-
/*
|
|
53
|
-
["WeakMap = (function", "WeakMap = WeakMap or (function"],
|
|
54
|
-
["WeakSet = (function", "WeakSet = WeakSet or (function"],
|
|
55
|
-
["Map = (function", "Map = Map or (function"],
|
|
56
|
-
["Set = (function", "Set = Set or (function"],
|
|
57
|
-
*/
|
|
58
51
|
];
|
|
59
|
-
|
|
52
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
53
|
+
function monkeyPatchMainLua(targetModDirectory, verbose) {
|
|
60
54
|
const mainLuaPath = path_1.default.join(targetModDirectory, constants_1.MAIN_LUA);
|
|
61
|
-
|
|
55
|
+
const mainLua = file.read(mainLuaPath);
|
|
62
56
|
// mainLua = patchInformationalHeader(mainLua);
|
|
63
|
-
mainLua = patchGlobalObjects(mainLua);
|
|
64
|
-
file.write(mainLuaPath, mainLua);
|
|
57
|
+
// mainLua = patchGlobalObjects(mainLua);
|
|
58
|
+
file.write(mainLuaPath, mainLua, verbose);
|
|
65
59
|
}
|
|
66
|
-
exports.monkeyPatchMainLua = monkeyPatchMainLua;
|
|
67
60
|
// Add an informational header for people who happen to be browsing the Lua output
|
|
68
61
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
62
|
function patchInformationalHeader(mainLua) {
|
|
@@ -74,6 +67,7 @@ function patchInformationalHeader(mainLua) {
|
|
|
74
67
|
// Until TSTL has an official fix, monkey patch this
|
|
75
68
|
// We also make sure of this function to compose a stock comment header for curious people looking
|
|
76
69
|
// at the transpiled Lua code
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
77
71
|
function patchGlobalObjects(originalMainLua) {
|
|
78
72
|
let mainLua = originalMainLua;
|
|
79
73
|
for (const [findString, replaceString] of MAIN_LUA_REPLACEMENTS) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monkeyPatch.js","sourceRoot":"","sources":["../../src/monkeyPatch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"monkeyPatch.js","sourceRoot":"","sources":["../../src/monkeyPatch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,2CAAuC;AACvC,6CAA+B;AAE/B,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;CAe5B,CAAC;AAEF,MAAM,qBAAqB,GAAG;IAC5B,yBAAyB;IACzB,+BAA+B;IAC/B,CAAC,yBAAyB,EAAE,oCAAoC,CAAC;IACjE,CAAC,yBAAyB,EAAE,oCAAoC,CAAC;IACjE,CAAC,qBAAqB,EAAE,4BAA4B,CAAC;IACrD,CAAC,qBAAqB,EAAE,4BAA4B,CAAC;CACtD,CAAC;AAEF,6DAA6D;AAC7D,SAAS,kBAAkB,CAAC,kBAA0B,EAAE,OAAgB;IACtE,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,oBAAQ,CAAC,CAAC;IAC5D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAEvC,+CAA+C;IAC/C,yCAAyC;IAEzC,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED,kFAAkF;AAClF,6DAA6D;AAC7D,SAAS,wBAAwB,CAAC,OAAe;IAC/C,OAAO,oBAAoB,GAAG,OAAO,CAAC;AACxC,CAAC;AAED,2EAA2E;AAC3E,mFAAmF;AACnF,oDAAoD;AACpD,kGAAkG;AAClG,6BAA6B;AAC7B,6DAA6D;AAC7D,SAAS,kBAAkB,CAAC,eAAuB;IACjD,IAAI,OAAO,GAAG,eAAe,CAAC;IAE9B,KAAK,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,IAAI,qBAAqB,EAAE;QAC/D,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;KACtD;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/src/parseArgs.js
CHANGED
|
@@ -27,6 +27,11 @@ function parseArgs() {
|
|
|
27
27
|
alias: "c",
|
|
28
28
|
type: "boolean",
|
|
29
29
|
description: "Enable crash debugging",
|
|
30
|
+
})
|
|
31
|
+
.option("verbose", {
|
|
32
|
+
alias: "v",
|
|
33
|
+
type: "boolean",
|
|
34
|
+
description: "Enable verbose output",
|
|
30
35
|
}))
|
|
31
36
|
.command("init [name]", `Initialize a new ${constants_1.PROJECT_NAME} mod.`, (builder) => builder
|
|
32
37
|
.option("use-current-dir", {
|
|
@@ -54,8 +59,17 @@ function parseArgs() {
|
|
|
54
59
|
alias: "i",
|
|
55
60
|
type: "boolean",
|
|
56
61
|
description: 'Don\'t automatically run "npm install" after initializing the project',
|
|
62
|
+
})
|
|
63
|
+
.option("verbose", {
|
|
64
|
+
alias: "v",
|
|
65
|
+
type: "boolean",
|
|
66
|
+
description: "Enable verbose output",
|
|
67
|
+
}))
|
|
68
|
+
.command("copy", "Only compile & copy the mod.", (builder) => builder.option("verbose", {
|
|
69
|
+
alias: "v",
|
|
70
|
+
type: "boolean",
|
|
71
|
+
description: "Enable verbose output",
|
|
57
72
|
}))
|
|
58
|
-
.command("copy", "Only compile & copy the mod.")
|
|
59
73
|
.command("publish", "Bump the version & automatically publish the new files using the steamcmd tool.", (builder) => builder
|
|
60
74
|
.option("skip", {
|
|
61
75
|
alias: "s",
|
|
@@ -76,6 +90,11 @@ function parseArgs() {
|
|
|
76
90
|
alias: "u",
|
|
77
91
|
type: "boolean",
|
|
78
92
|
description: "only upload the mod to the Steam Workshop (without doing anything else)",
|
|
93
|
+
})
|
|
94
|
+
.option("verbose", {
|
|
95
|
+
alias: "v",
|
|
96
|
+
type: "boolean",
|
|
97
|
+
description: "Enable verbose output",
|
|
79
98
|
}))
|
|
80
99
|
.alias("h", "help") // By default, only "--help" is enabled
|
|
81
100
|
.alias("v", "version"); // By default, only "--version" is enabled
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseArgs.js","sourceRoot":"","sources":["../../src/parseArgs.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,2CAA2C;AAE3C,SAAgB,SAAS;IACvB,MAAM,WAAW,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAC7C,MAAM,EAAE;SACR,KAAK,CAAC,wCAAwC,CAAC;SAC/C,UAAU,CAAC,aAAa,CAAC;SAEzB,OAAO,CAAC,SAAS,EAAE,0CAA0C,EAAE,CAAC,OAAO,EAAE,EAAE,CAC1E,OAAO;SACJ,MAAM,CAAC,gBAAgB,EAAE;QACxB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,oDAAoD;KAClE,CAAC;SACD,MAAM,CAAC,WAAW,EAAE;QACnB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAClB,WAAW,EAAE,oCAAoC;KAClD,CAAC;SACD,MAAM,CAAC,aAAa,EAAE;QACrB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,wBAAwB;KACtC,CAAC,CACL;SAEA,OAAO,CACN,aAAa,EACb,oBAAoB,wB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AAS;QACf,WAAW,EAAE,uBAAuB;KACrC,CAAC,CACP;SAEA,OAAO,CAAC,MAAM,EAAE,8BAA8B,EAAE,CAAC,OAAO,EAAE,EAAE,CAC3D,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE;QACxB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,uBAAuB;KACrC,CAAC,CACH;SAEA,OAAO,CACN,SAAS,EACT,iFAAiF,EACjF,CAAC,OAAO,EAAE,EAAE,CACV,OAAO;SACJ,MAAM,CAAC,MAAM,EAAE;QACd,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,sCAAsC;KACpD,CAAC;SACD,MAAM,CAAC,aAAa,EAAE;QACrB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,QAAQ;QACd,WAAW,EACT,uDAAuD;KAC1D,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,wBAAwB;KACtC,CAAC;SACD,MAAM,CAAC,aAAa,EAAE;QACrB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EACT,yEAAyE;KAC5E,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,KAAK,EAAE,GAAG;QACV,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,uBAAuB;KACrC,CAAC,CACP;SAEA,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,uCAAuC;SAC1D,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,CAAC,0CAA0C;IAEpE,OAAO,WAAW,CAAC,IAAI,CAAC;AAC1B,CAAC;AArHD,8BAqHC"}
|
package/dist/src/util.js
CHANGED
|
@@ -3,9 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
6
|
+
exports.parseSemVer = exports.parseIntSafe = exports.hasWhiteSpace = exports.getTime = exports.getModTargetDirectoryName = exports.error = exports.ensureAllCases = void 0;
|
|
9
7
|
const moment_1 = __importDefault(require("moment"));
|
|
10
8
|
const constants_1 = require("./constants");
|
|
11
9
|
const ensureAllCases = (obj) => obj;
|
|
@@ -15,60 +13,6 @@ function error(...args) {
|
|
|
15
13
|
process.exit(1);
|
|
16
14
|
}
|
|
17
15
|
exports.error = error;
|
|
18
|
-
function execExe(path, cwd = constants_1.CWD) {
|
|
19
|
-
let stdout;
|
|
20
|
-
try {
|
|
21
|
-
const buffer = (0, child_process_1.execSync)(`"${path}"`, {
|
|
22
|
-
cwd,
|
|
23
|
-
});
|
|
24
|
-
stdout = buffer.toString().trim();
|
|
25
|
-
}
|
|
26
|
-
catch (err) {
|
|
27
|
-
console.error(`Failed to run "${chalk_1.default.green(path)}":`, err);
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
return stdout;
|
|
31
|
-
}
|
|
32
|
-
exports.execExe = execExe;
|
|
33
|
-
/** Returns an array of exit status and stdout. */
|
|
34
|
-
function execShell(command, args = [], allowFailure = false, cwd = constants_1.CWD) {
|
|
35
|
-
// On Windows, "spawnSync()" will not account for spaces in arguments
|
|
36
|
-
// Thus, wrap everything in a double quote
|
|
37
|
-
// This will cause arguments that naturally have double quotes to fail
|
|
38
|
-
if (command.includes('"')) {
|
|
39
|
-
throw new Error("execShell cannot execute commands with double quotes in the command.");
|
|
40
|
-
}
|
|
41
|
-
for (let i = 0; i < args.length; i++) {
|
|
42
|
-
if (args[i].includes('"')) {
|
|
43
|
-
throw new Error("execShell cannot execute commands with double quotes in the arguments.");
|
|
44
|
-
}
|
|
45
|
-
args[i] = `"${args[i]}"`; // eslint-disable-line no-param-reassign
|
|
46
|
-
}
|
|
47
|
-
const commandDescription = `${command} ${args.join(" ")}`.trim();
|
|
48
|
-
let spawnSyncReturns;
|
|
49
|
-
try {
|
|
50
|
-
spawnSyncReturns = (0, child_process_1.spawnSync)(command, args, {
|
|
51
|
-
shell: true,
|
|
52
|
-
cwd,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
catch (err) {
|
|
56
|
-
error(`Failed to run the "${chalk_1.default.green(commandDescription)}" command:`, err);
|
|
57
|
-
}
|
|
58
|
-
const exitStatus = spawnSyncReturns.status;
|
|
59
|
-
const stdout = spawnSyncReturns.output.join("\n").trim();
|
|
60
|
-
if (exitStatus !== 0) {
|
|
61
|
-
if (allowFailure) {
|
|
62
|
-
return [exitStatus, stdout];
|
|
63
|
-
}
|
|
64
|
-
console.error(`Failed to run the "${chalk_1.default.green(commandDescription)}" command with an exit code of ${exitStatus}.`);
|
|
65
|
-
console.error("The output was as follows:");
|
|
66
|
-
console.error(stdout);
|
|
67
|
-
process.exit(1);
|
|
68
|
-
}
|
|
69
|
-
return [exitStatus, stdout];
|
|
70
|
-
}
|
|
71
|
-
exports.execShell = execShell;
|
|
72
16
|
function getModTargetDirectoryName(config) {
|
|
73
17
|
return config.customTargetModDirectoryName === undefined
|
|
74
18
|
? constants_1.CURRENT_DIRECTORY_NAME
|
|
@@ -110,4 +54,25 @@ function parseIntSafe(input) {
|
|
|
110
54
|
return parseInt(trimmedInput, 10);
|
|
111
55
|
}
|
|
112
56
|
exports.parseIntSafe = parseIntSafe;
|
|
57
|
+
function parseSemVer(versionString) {
|
|
58
|
+
const match = /^v*(\d+)\.(\d+)\.(\d+)/g.exec(versionString);
|
|
59
|
+
if (match === null) {
|
|
60
|
+
error(`Failed to parse the version string of: ${versionString}`);
|
|
61
|
+
}
|
|
62
|
+
const [, majorVersionString, minorVersionString, patchVersionString] = match;
|
|
63
|
+
const majorVersion = parseIntSafe(majorVersionString);
|
|
64
|
+
if (Number.isNaN(majorVersion)) {
|
|
65
|
+
error(`Failed to parse the major version number from: ${versionString}`);
|
|
66
|
+
}
|
|
67
|
+
const minorVersion = parseInt(minorVersionString, 10);
|
|
68
|
+
if (Number.isNaN(minorVersion)) {
|
|
69
|
+
error(`Failed to parse the minor version number from: ${versionString}`);
|
|
70
|
+
}
|
|
71
|
+
const patchVersion = parseInt(patchVersionString, 10);
|
|
72
|
+
if (Number.isNaN(patchVersion)) {
|
|
73
|
+
error(`Failed to parse the patch version number from: ${versionString}`);
|
|
74
|
+
}
|
|
75
|
+
return [majorVersion, minorVersion, patchVersion];
|
|
76
|
+
}
|
|
77
|
+
exports.parseSemVer = parseSemVer;
|
|
113
78
|
//# sourceMappingURL=util.js.map
|
package/dist/src/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAC5B,2CAAqD;AAG9C,MAAM,cAAc,GAAG,CAAC,GAAU,EAAS,EAAE,CAAC,GAAG,CAAC;AAA5C,QAAA,cAAc,kBAA8B;AAEzD,SAAgB,KAAK,CAAC,GAAG,IAAe;IACtC,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAHD,sBAGC;AAED,SAAgB,yBAAyB,CAAC,MAAc;IACtD,OAAO,MAAM,CAAC,4BAA4B,KAAK,SAAS;QACtD,CAAC,CAAC,kCAAsB;QACxB,CAAC,CAAC,MAAM,CAAC,4BAA4B,CAAC;AAC1C,CAAC;AAJD,8DAIC;AAED,SAAgB,OAAO;IACrB,OAAO,IAAA,gBAAM,GAAE,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,oBAAoB;AAC3D,CAAC;AAFD,0BAEC;AAED,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AG,QAAQ,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC9B,KAAK,CAAC,kDAAkD,aAAa,EAAE,CAAC,CAAC;KAC1E;IAED,MAAM,YAAY,GAAG,QAAQ,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IACtD,IAAI,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;QAC9B,KAAK,CAAC,kDAAkD,aAAa,EAAE,CAAC,CAAC;KAC1E;IAED,OAAO,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AA1BD,kCA0BC"}
|
|
@@ -7,36 +7,18 @@ exports.validateNodeVersion = void 0;
|
|
|
7
7
|
const chalk_1 = __importDefault(require("chalk"));
|
|
8
8
|
const constants_1 = require("./constants");
|
|
9
9
|
const util_1 = require("./util");
|
|
10
|
-
const
|
|
10
|
+
const REQUIRED_NODE_JS_MAJOR_VERSION = 16;
|
|
11
11
|
// This program requires Node to be at least v16.0.0,
|
|
12
12
|
// since that is the version that added the "fs.rmSync()" function
|
|
13
13
|
// (I tested on Node v15.0.0 and it failed)
|
|
14
14
|
function validateNodeVersion() {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
(0, util_1.error)(`Failed to parse your NodeJS version of: ${version}`);
|
|
19
|
-
}
|
|
20
|
-
const majorVersionString = match[1];
|
|
21
|
-
const majorVersion = parseInt(majorVersionString, 10);
|
|
22
|
-
if (Number.isNaN(majorVersion)) {
|
|
23
|
-
(0, util_1.error)(`Failed to parse the major version number from: ${majorVersionString}`);
|
|
24
|
-
}
|
|
25
|
-
const minorVersionString = match[2];
|
|
26
|
-
const minorVersion = parseInt(minorVersionString, 10);
|
|
27
|
-
if (Number.isNaN(minorVersion)) {
|
|
28
|
-
(0, util_1.error)(`Failed to parse the minor version number from: ${minorVersionString}`);
|
|
29
|
-
}
|
|
30
|
-
const patchVersionString = match[3];
|
|
31
|
-
const patchVersion = parseInt(patchVersionString, 10);
|
|
32
|
-
if (Number.isNaN(patchVersion)) {
|
|
33
|
-
(0, util_1.error)(`Failed to parse the patch version number from: ${patchVersionString}`);
|
|
34
|
-
}
|
|
35
|
-
if (majorVersion >= REQUIRED_MAJOR_VERSION) {
|
|
15
|
+
const nodeJSVersionString = process.version;
|
|
16
|
+
const [majorVersion] = (0, util_1.parseSemVer)(nodeJSVersionString);
|
|
17
|
+
if (majorVersion >= REQUIRED_NODE_JS_MAJOR_VERSION) {
|
|
36
18
|
return;
|
|
37
19
|
}
|
|
38
|
-
console.error(`Your Node.js version is: ${chalk_1.default.red(
|
|
39
|
-
console.error(`${constants_1.PROJECT_NAME} requires a Node.js version of ${chalk_1.default.red(
|
|
20
|
+
console.error(`Your Node.js version is: ${chalk_1.default.red(nodeJSVersionString)}`);
|
|
21
|
+
console.error(`${constants_1.PROJECT_NAME} requires a Node.js version of ${chalk_1.default.red(`${REQUIRED_NODE_JS_MAJOR_VERSION}.0.0`)} or greater.`);
|
|
40
22
|
console.error(`Please upgrade your version of Node.js before using ${constants_1.PROJECT_NAME}.`);
|
|
41
23
|
process.exit(1);
|
|
42
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateNodeVersion.js","sourceRoot":"","sources":["../../src/validateNodeVersion.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,2CAA2C;AAC3C,
|
|
1
|
+
{"version":3,"file":"validateNodeVersion.js","sourceRoot":"","sources":["../../src/validateNodeVersion.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,2CAA2C;AAC3C,iCAAqC;AAErC,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,qDAAqD;AACrD,kEAAkE;AAClE,2CAA2C;AAC3C,SAAgB,mBAAmB;IACjC,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAC5C,MAAM,CAAC,YAAY,CAAC,GAAG,IAAA,kBAAW,EAAC,mBAAmB,CAAC,CAAC;IAExD,IAAI,YAAY,IAAI,8BAA8B,EAAE;QAClD,OAAO;KACR;IAED,OAAO,CAAC,KAAK,CAAC,4BAA4B,eAAK,CAAC,GAAG,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC;IAC5E,OAAO,CAAC,KAAK,CACX,GAAG,wBAAY,kCAAkC,eAAK,CAAC,GAAG,CACxD,GAAG,8BAA8B,MAAM,CACxC,cAAc,CAChB,CAAC;IACF,OAAO,CAAC,KAAK,CACX,uDAAuD,wBAAY,GAAG,CACvE,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAlBD,kDAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "A command line tool for managing Isaac mods written in TypeScript",
|
|
5
5
|
"homepage": "https://isaacscript.github.io/",
|
|
6
6
|
"bugs": {
|
|
@@ -16,21 +16,21 @@
|
|
|
16
16
|
"isaacscript": "./dist/src/main.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@zamiell/typescript-to-lua": "^1.4.0",
|
|
19
20
|
"chalk": "4.1.2",
|
|
20
21
|
"command-exists": "^1.2.9",
|
|
21
|
-
"dotenv": "^
|
|
22
|
+
"dotenv": "^16.0.0",
|
|
22
23
|
"figlet": "^1.5.2",
|
|
23
24
|
"fs-extra": "^10.0.0",
|
|
24
25
|
"isaacscript-tsconfig": "^1.1.8",
|
|
25
26
|
"jsonc-parser": "^3.0.0",
|
|
26
27
|
"moment": "^2.29.1",
|
|
27
|
-
"npm-check-updates": "^12.
|
|
28
|
+
"npm-check-updates": "^12.3.0",
|
|
28
29
|
"prompt": "^1.2.1",
|
|
29
30
|
"source-map": "^0.7.3",
|
|
30
31
|
"source-map-support": "^0.5.21",
|
|
31
32
|
"sync-directory": "^4.0.12",
|
|
32
33
|
"typescript": "^4.5.5",
|
|
33
|
-
"@zamiell/typescript-to-lua": "1.3.3-dev.1",
|
|
34
34
|
"update-notifier": "^5.1.0",
|
|
35
35
|
"yaml": "^1.10.2",
|
|
36
36
|
"yargs": "^17.3.1"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/command-exists": "^1.2.0",
|
|
40
40
|
"@types/figlet": "^1.5.4",
|
|
41
41
|
"@types/fs-extra": "^9.0.13",
|
|
42
|
-
"@types/node": "^17.0.
|
|
42
|
+
"@types/node": "^17.0.18",
|
|
43
43
|
"@types/prompt": "^1.1.2",
|
|
44
44
|
"@types/source-map-support": "^0.5.4",
|
|
45
45
|
"@types/update-notifier": "^5.1.0",
|
package/publish.sh
CHANGED
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { MOD_SOURCE_PATH } from "../../constants";
|
|
3
|
+
import { execShell } from "../../exec";
|
|
3
4
|
import * as file from "../../file";
|
|
4
|
-
import { monkeyPatchMainLua } from "../../monkeyPatch";
|
|
5
5
|
import { Config } from "../../types/Config";
|
|
6
|
-
import {
|
|
6
|
+
import { getModTargetDirectoryName } from "../../util";
|
|
7
|
+
|
|
8
|
+
export function copy(argv: Record<string, unknown>, config: Config): void {
|
|
9
|
+
const verbose = argv.verbose === true;
|
|
7
10
|
|
|
8
|
-
export function copy(config: Config): void {
|
|
9
11
|
const modTargetDirectoryName = getModTargetDirectoryName(config);
|
|
10
12
|
const modTargetPath = path.join(config.modsDirectory, modTargetDirectoryName);
|
|
11
|
-
|
|
13
|
+
|
|
14
|
+
compileAndCopy(MOD_SOURCE_PATH, modTargetPath, verbose);
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
export function compileAndCopy(
|
|
15
18
|
modSourcePath: string,
|
|
16
19
|
modTargetPath: string,
|
|
20
|
+
verbose: boolean,
|
|
17
21
|
): void {
|
|
18
|
-
compile();
|
|
19
|
-
monkeyPatchMainLua(modSourcePath);
|
|
20
|
-
copyMod(modSourcePath, modTargetPath);
|
|
22
|
+
compile(verbose);
|
|
23
|
+
// monkeyPatchMainLua(modSourcePath);
|
|
24
|
+
copyMod(modSourcePath, modTargetPath, verbose);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
|
-
function compile() {
|
|
24
|
-
execShell("npx", ["tstl"]);
|
|
27
|
+
function compile(verbose: boolean) {
|
|
28
|
+
execShell("npx", ["tstl"], verbose);
|
|
25
29
|
console.log("Mod compiled successfully.");
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
function copyMod(
|
|
32
|
+
function copyMod(
|
|
33
|
+
modSourcePath: string,
|
|
34
|
+
modTargetPath: string,
|
|
35
|
+
verbose: boolean,
|
|
36
|
+
) {
|
|
29
37
|
if (file.exists(modTargetPath)) {
|
|
30
|
-
file.deleteFileOrDirectory(modTargetPath);
|
|
38
|
+
file.deleteFileOrDirectory(modTargetPath, verbose);
|
|
31
39
|
}
|
|
32
|
-
file.copy(modSourcePath, modTargetPath);
|
|
40
|
+
file.copy(modSourcePath, modTargetPath, verbose);
|
|
33
41
|
console.log("Mod copied successfully.");
|
|
34
42
|
}
|
|
@@ -6,6 +6,7 @@ import { error } from "../../util";
|
|
|
6
6
|
|
|
7
7
|
export async function checkIfProjectPathExists(
|
|
8
8
|
projectPath: string,
|
|
9
|
+
verbose: boolean,
|
|
9
10
|
): Promise<void> {
|
|
10
11
|
if (projectPath !== CWD && file.exists(projectPath)) {
|
|
11
12
|
const fileType = file.isDir(projectPath) ? "directory" : "file";
|
|
@@ -21,6 +22,6 @@ export async function checkIfProjectPathExists(
|
|
|
21
22
|
error("Ok then. Good-bye.");
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
file.deleteFileOrDirectory(projectPath);
|
|
25
|
+
file.deleteFileOrDirectory(projectPath, verbose);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
@@ -8,6 +8,7 @@ import { error } from "../../util";
|
|
|
8
8
|
export async function checkModTargetDirectory(
|
|
9
9
|
modsDirectory: string,
|
|
10
10
|
projectName: string,
|
|
11
|
+
verbose: boolean,
|
|
11
12
|
): Promise<void> {
|
|
12
13
|
const modTargetPath = path.join(modsDirectory, projectName);
|
|
13
14
|
if (!file.exists(modTargetPath)) {
|
|
@@ -31,5 +32,5 @@ export async function checkModTargetDirectory(
|
|
|
31
32
|
error("Ok then. You delete it yourself. Good bye.");
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
file.deleteFileOrDirectory(modTargetPath);
|
|
35
|
+
file.deleteFileOrDirectory(modTargetPath, verbose);
|
|
35
36
|
}
|