isaacscript 3.5.0 → 3.5.1-dev.0
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/file-templates/dynamic/.github/workflows/ci.yml +1 -3
- package/file-templates/dynamic/gitignore +2 -4
- package/file-templates/dynamic/package.json +1 -0
- package/file-templates/static/check-orphaned-words.sh +30 -1
- package/file-templates/static/lint.sh +13 -13
- package/file-templates/static/nuke.sh +1 -1
- package/package.json +3 -4
- package/src/checkForWindowsTerminalBugs.js +10 -10
- package/src/checkForWindowsTerminalBugs.js.map +1 -1
- package/src/classes/Config.js +21 -11
- package/src/classes/Config.js.map +1 -1
- package/src/commands/check/check.js +179 -0
- package/src/commands/check/check.js.map +1 -0
- package/src/commands/copy/copy.js +16 -15
- package/src/commands/copy/copy.js.map +1 -1
- package/src/commands/init/checkIfProjectPathExists.js +5 -5
- package/src/commands/init/checkIfProjectPathExists.js.map +1 -1
- package/src/commands/init/checkModSubdirectory.js +3 -3
- package/src/commands/init/checkModSubdirectory.js.map +1 -1
- package/src/commands/init/checkModTargetDirectory.js +7 -7
- package/src/commands/init/checkModTargetDirectory.js.map +1 -1
- package/src/commands/init/createProject.js +178 -0
- package/src/commands/init/createProject.js.map +1 -0
- package/src/commands/init/getAuthorName.js +28 -0
- package/src/commands/init/getAuthorName.js.map +1 -0
- package/src/commands/init/getModsDir.js +8 -8
- package/src/commands/init/getModsDir.js.map +1 -1
- package/src/commands/init/getProjectPath.js +12 -12
- package/src/commands/init/getProjectPath.js.map +1 -1
- package/src/commands/init/init.js +33 -30
- package/src/commands/init/init.js.map +1 -1
- package/src/commands/init/installVSCodeExtensions.js +7 -7
- package/src/commands/init/installVSCodeExtensions.js.map +1 -1
- package/src/commands/init/promptSaveSlot.js +2 -2
- package/src/commands/init/promptSaveSlot.js.map +1 -1
- package/src/commands/init/promptVSCode.js +7 -7
- package/src/commands/init/promptVSCode.js.map +1 -1
- package/src/commands/monitor/copyWatcherMod.js +7 -7
- package/src/commands/monitor/copyWatcherMod.js.map +1 -1
- package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +2 -2
- package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -1
- package/src/commands/monitor/monitor.js +56 -55
- package/src/commands/monitor/monitor.js.map +1 -1
- package/src/commands/monitor/notifyGame.js +9 -9
- package/src/commands/monitor/notifyGame.js.map +1 -1
- package/src/commands/monitor/saveDatWriter/saveDatWriter.js +6 -7
- package/src/commands/monitor/saveDatWriter/saveDatWriter.js.map +1 -1
- package/src/commands/monitor/spawnSaveDatWriter.js +8 -8
- package/src/commands/monitor/spawnSaveDatWriter.js.map +1 -1
- package/src/commands/monitor/touchWatcherSaveDatFiles.js +6 -6
- package/src/commands/monitor/touchWatcherSaveDatFiles.js.map +1 -1
- package/src/commands/publish/publish.js +55 -57
- package/src/commands/publish/publish.js.map +1 -1
- package/src/common.js +4 -4
- package/src/common.js.map +1 -1
- package/src/configFile.js +15 -15
- package/src/configFile.js.map +1 -1
- package/src/constants.js +33 -33
- package/src/constants.js.map +1 -1
- package/src/customStage.js +25 -25
- package/src/customStage.js.map +1 -1
- package/src/dev.js +4 -4
- package/src/dev.js.map +1 -1
- package/src/enums/DoorSlotFlag.js +9 -9
- package/src/enums/DoorSlotFlag.js.map +1 -1
- package/src/exec.js +28 -11
- package/src/exec.js.map +1 -1
- package/src/file.js +17 -17
- package/src/file.js.map +1 -1
- package/src/{commands/init/git.js → git.js} +38 -35
- package/src/git.js.map +1 -0
- package/src/index.js +2 -2
- package/src/index.js.map +1 -1
- package/src/json.js +1 -1
- package/src/json.js.map +1 -1
- package/src/main.js +63 -60
- package/src/main.js.map +1 -1
- package/src/objects/doorSlotToDoorSlotFlag.js +11 -11
- package/src/objects/doorSlotToDoorSlotFlag.js.map +1 -1
- package/src/objects/roomShapeDoorToSlotCoordinates.js +78 -78
- package/src/objects/roomShapeDoorToSlotCoordinates.js.map +1 -1
- package/src/packageManager.js +46 -32
- package/src/packageManager.js.map +1 -1
- package/src/parseArgs.js +23 -13
- package/src/parseArgs.js.map +1 -1
- package/src/plugins/addCrashDebugStatements.js +1 -1
- package/src/plugins/addCrashDebugStatements.js.map +1 -1
- package/src/plugins/addIsaacScriptCommentHeaderCommon.js +2 -2
- package/src/plugins/addIsaacScriptCommentHeaderCommon.js.map +1 -1
- package/src/tsconfig.js +10 -10
- package/src/tsconfig.js.map +1 -1
- package/src/utils.js +2 -2
- package/src/utils.js.map +1 -1
- package/src/validateInIsaacScriptProject.js +9 -9
- package/src/validateInIsaacScriptProject.js.map +1 -1
- package/src/validateNodeVersion.js +4 -4
- package/src/validateNodeVersion.js.map +1 -1
- package/src/validateOS.js +8 -4
- package/src/validateOS.js.map +1 -1
- package/src/version.js +20 -0
- package/src/version.js.map +1 -0
- package/file-templates/static-alt/check-file-updates.sh +0 -69
- package/src/commands/init/createMod.js +0 -170
- package/src/commands/init/createMod.js.map +0 -1
- package/src/commands/init/git.js.map +0 -1
|
@@ -12,9 +12,7 @@ jobs:
|
|
|
12
12
|
- name: Setup Node.js
|
|
13
13
|
uses: actions/setup-node@v3
|
|
14
14
|
with:
|
|
15
|
-
|
|
16
|
-
# We use 18, which is the official LTS version.
|
|
17
|
-
node-version: 18
|
|
15
|
+
node-version: lts/*
|
|
18
16
|
cache: PACKAGE-MANAGER-NAME
|
|
19
17
|
|
|
20
18
|
- name: Retrieve the cached "node_modules" directory (if present)
|
|
@@ -9,6 +9,35 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
|
|
9
9
|
REPO_ROOT="$DIR"
|
|
10
10
|
cd "$REPO_ROOT"
|
|
11
11
|
|
|
12
|
+
NPM_LOCK="$DIR/package-lock.json"
|
|
13
|
+
if test -f "$NPM_LOCK"; then
|
|
14
|
+
NPM_LOCK_EXISTS=1
|
|
15
|
+
fi
|
|
16
|
+
|
|
17
|
+
YARN_LOCK="$DIR/yarn.lock"
|
|
18
|
+
if test -f "$YARN_LOCK"; then
|
|
19
|
+
YARN_LOCK_EXISTS=1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
PNPM_LOCK="$DIR/pnpm-lock.yaml"
|
|
23
|
+
if test -f "$PNPM_LOCK"; then
|
|
24
|
+
PNPM_LOCK_EXISTS=1
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
if [[ -z "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXISTS" ]]; then
|
|
28
|
+
echo "No package manager lock files were found. You should manually invoke the package manager that you want to use for this project. e.g. \"npm install\""
|
|
29
|
+
exit 1
|
|
30
|
+
elif [[ ! -z "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXISTS" ]]; then
|
|
31
|
+
NPX="npx"
|
|
32
|
+
elif [[ -z "$NPM_LOCK_EXISTS" && ! -z "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXISTS" ]]; then
|
|
33
|
+
NPX="npx"
|
|
34
|
+
elif [[ -z "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && ! -z "$PNPM_LOCK_EXISTS" ]]; then
|
|
35
|
+
NPX="pnpx"
|
|
36
|
+
else
|
|
37
|
+
echo "Error: Multiple different kinds of package manager lock files were found. You should delete the ones that you are not using so that this program can correctly detect your package manager."
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
12
41
|
# Do nothing if the configuration file does not exist.
|
|
13
42
|
CSPELL_CONFIG_NAME="cspell.json"
|
|
14
43
|
CSPELL_CONFIG_PATH="$REPO_ROOT/$CSPELL_CONFIG_NAME"
|
|
@@ -31,7 +60,7 @@ CSPELL_CONFIG_TEMP_PATH="/tmp/cspell-temp.json"
|
|
|
31
60
|
mv "$CSPELL_CONFIG_PATH" "$CSPELL_CONFIG_TEMP_PATH"
|
|
32
61
|
echo "$CSPELL_CONFIG_WITHOUT_WORDS" > "$CSPELL_CONFIG_PATH"
|
|
33
62
|
MISSPELLED_WORDS_PATH="/tmp/misspelled-words.txt"
|
|
34
|
-
|
|
63
|
+
"$NPX" cspell --no-progress --no-summary --unique --words-only . | sort --ignore-case --unique > "$MISSPELLED_WORDS_PATH"
|
|
35
64
|
mv "$CSPELL_CONFIG_TEMP_PATH" "$CSPELL_CONFIG_PATH"
|
|
36
65
|
|
|
37
66
|
# Check that each "cspell.json" word is actually being used.
|
|
@@ -10,30 +10,30 @@ SECONDS=0
|
|
|
10
10
|
|
|
11
11
|
cd "$DIR"
|
|
12
12
|
|
|
13
|
-
#
|
|
14
|
-
|
|
13
|
+
# Use Prettier to check formatting.
|
|
14
|
+
# "--loglevel warn" makes it only output errors.
|
|
15
|
+
npx prettier --loglevel warn --check .
|
|
15
16
|
|
|
16
|
-
#
|
|
17
|
-
#
|
|
17
|
+
# Use ESLint to lint the TypeScript.
|
|
18
|
+
# "--max-warnings 0" makes warnings fail in CI, since we set all ESLint errors to warnings.
|
|
18
19
|
npx eslint --max-warnings 0 .
|
|
19
20
|
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
# npx ts-prune --error
|
|
21
|
+
# Check for unused exports.
|
|
22
|
+
# "--error" makes it return an error code of 1 if unused exports are found.
|
|
23
|
+
npx ts-prune --error
|
|
24
24
|
|
|
25
|
-
#
|
|
25
|
+
# Use `isaac-xml-validator` to validate XML files.
|
|
26
26
|
# (Skip this step if Python is not currently installed for whatever reason.)
|
|
27
27
|
if command -v python &> /dev/null; then
|
|
28
28
|
pip install isaac-xml-validator --upgrade --quiet
|
|
29
|
-
|
|
29
|
+
isaac-xml-validator --quiet
|
|
30
30
|
fi
|
|
31
31
|
|
|
32
|
-
#
|
|
33
|
-
#
|
|
32
|
+
# Spell check every file using CSpell.
|
|
33
|
+
# "--no-progress" and "--no-summary" make it only output errors.
|
|
34
34
|
npx cspell --no-progress --no-summary .
|
|
35
35
|
|
|
36
|
-
#
|
|
36
|
+
# Check for orphaned words.
|
|
37
37
|
bash "$DIR/check-orphaned-words.sh"
|
|
38
38
|
|
|
39
39
|
echo "Successfully linted in $SECONDS seconds."
|
|
@@ -43,7 +43,7 @@ elif [[ -z "$NPM_LOCK_EXISTS" && ! -z "$YARN_LOCK_EXISTS" && -z "$PNPM_LOCK_EXIS
|
|
|
43
43
|
elif [[ -z "$NPM_LOCK_EXISTS" && -z "$YARN_LOCK_EXISTS" && ! -z "$PNPM_LOCK_EXISTS" ]]; then
|
|
44
44
|
pnpm install
|
|
45
45
|
else
|
|
46
|
-
echo "Error: Multiple different kinds of package manager lock files were found. You should
|
|
46
|
+
echo "Error: Multiple different kinds of package manager lock files were found. You should delete the ones that you are not using so that this program can correctly detect your package manager."
|
|
47
47
|
exit 1
|
|
48
48
|
fi
|
|
49
49
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript",
|
|
3
|
-
"version": "3.5.0",
|
|
3
|
+
"version": "3.5.1-dev.0",
|
|
4
4
|
"description": "A command line tool for managing Isaac mods written in TypeScript.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -27,13 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"ajv": "^8.12.0",
|
|
30
|
-
"chalk": "
|
|
30
|
+
"chalk": "^5.2.0",
|
|
31
31
|
"command-exists": "^1.2.9",
|
|
32
|
-
"dotenv": "^16.0.3",
|
|
33
32
|
"figlet": "^1.5.2",
|
|
34
33
|
"git-dirty": "^1.0.2",
|
|
35
34
|
"glob": "^8.1.0",
|
|
36
|
-
"isaacscript-common-ts": "^
|
|
35
|
+
"isaacscript-common-ts": "^4.0.0",
|
|
37
36
|
"isaacscript-tsconfig": "^3.0.4",
|
|
38
37
|
"jsonc-parser": "^3.2.0",
|
|
39
38
|
"moment": "^2.29.4",
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkForWindowsTerminalBugs = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
-
const fs_1 = tslib_1.__importDefault(require("fs"));
|
|
7
6
|
const isaacscript_common_ts_1 = require("isaacscript-common-ts");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
7
|
+
const node_fs_1 = tslib_1.__importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
9
|
+
const constants_js_1 = require("./constants.js");
|
|
10
|
+
const file = tslib_1.__importStar(require("./file.js"));
|
|
11
|
+
const prompt_js_1 = require("./prompt.js");
|
|
12
|
+
const BASH_PROFILE_PATH = node_path_1.default.join(constants_js_1.HOME_DIR, ".bash_profile");
|
|
13
13
|
/**
|
|
14
14
|
* By default, Git Bash for Windows uses MINGW64. This will not work correctly with the prompt
|
|
15
15
|
* library. Try to detect this and warn the end-user.
|
|
@@ -30,7 +30,7 @@ async function checkForWindowsBugColor(verbose) {
|
|
|
30
30
|
}
|
|
31
31
|
console.error(chalk_1.default.red(`Error: It looks like you are using Git Bash for Windows (MINGW64) without the "${chalk_1.default.green("FORCE_COLOR")}" environment variable.`));
|
|
32
32
|
console.error("This is necessary in order for colors to work properly in the terminal.");
|
|
33
|
-
const shouldFixColors = await (0,
|
|
33
|
+
const shouldFixColors = await (0, prompt_js_1.getInputYesNo)("Do you want me to fix this for you?");
|
|
34
34
|
if (!shouldFixColors) {
|
|
35
35
|
return;
|
|
36
36
|
}
|
|
@@ -47,7 +47,7 @@ function applyFixesToBashProfile(verbose) {
|
|
|
47
47
|
}
|
|
48
48
|
const appendText = getBashProfileAppendText(bashProfileContents);
|
|
49
49
|
try {
|
|
50
|
-
|
|
50
|
+
node_fs_1.default.appendFileSync(BASH_PROFILE_PATH, appendText);
|
|
51
51
|
}
|
|
52
52
|
catch (err) {
|
|
53
53
|
(0, isaacscript_common_ts_1.error)(`Failed to append text to "${BASH_PROFILE_PATH}":`, err);
|
|
@@ -58,7 +58,7 @@ function applyFixesToBashProfile(verbose) {
|
|
|
58
58
|
}
|
|
59
59
|
function getBashProfileAppendText(bashProfileContents) {
|
|
60
60
|
let newText = "";
|
|
61
|
-
if (bashProfileContents !== "" && bashProfileContents.endsWith("\n")) {
|
|
61
|
+
if (bashProfileContents !== "" && !bashProfileContents.endsWith("\n")) {
|
|
62
62
|
// If the Bash profile exists and has data, it should end in a newline. Add an extra newline if
|
|
63
63
|
// this is not the case.
|
|
64
64
|
newText += "\n";
|
|
@@ -68,7 +68,7 @@ function getBashProfileAppendText(bashProfileContents) {
|
|
|
68
68
|
// the new lines added by us.
|
|
69
69
|
newText += "\n";
|
|
70
70
|
}
|
|
71
|
-
newText += `# Terminal fixes added by ${
|
|
71
|
+
newText += `# Terminal fixes added by ${constants_js_1.PROJECT_NAME}\n`;
|
|
72
72
|
newText += "export FORCE_COLOR=true\n";
|
|
73
73
|
return newText;
|
|
74
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkForWindowsTerminalBugs.js","sourceRoot":"","sources":["../../../../packages/isaacscript-cli/src/checkForWindowsTerminalBugs.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"checkForWindowsTerminalBugs.js","sourceRoot":"","sources":["../../../../packages/isaacscript-cli/src/checkForWindowsTerminalBugs.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C,8DAAyB;AACzB,kEAA6B;AAC7B,iDAAwD;AACxD,wDAAkC;AAClC,2CAA4C;AAE5C,MAAM,iBAAiB,GAAG,mBAAI,CAAC,IAAI,CAAC,uBAAQ,EAAE,eAAe,CAAC,CAAC;AAE/D;;;GAGG;AACI,KAAK,UAAU,2BAA2B,CAC/C,OAAgB;IAEhB,IAAI,OAAO,CAAC,QAAQ,KA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A0C,eAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAC3E,CAAC;IACF,OAAO,CAAC,GAAG,CACT,eAAK,CAAC,GAAG,CACP,sEAAsE,CACvE,CACF,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,wBAAwB,CAAC,mBAA2B;IAC3D,IAAI,OAAO,GAAG,EAAE,CAAC;IAEjB,IAAI,mBAAmB,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;QACrE,+FAA+F;QAC/F,wBAAwB;QACxB,OAAO,IAAI,IAAI,CAAC;KACjB;IAED,IAAI,mBAAmB,KAAK,EAAE,EAAE;QAC9B,+FAA+F;QAC/F,6BAA6B;QAC7B,OAAO,IAAI,IAAI,CAAC;KACjB;IAED,OAAO,IAAI,6BAA6B,2BAAY,IAAI,CAAC;IACzD,OAAO,IAAI,2BAA2B,CAAC;IAEvC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/src/classes/Config.js
CHANGED
|
@@ -4,18 +4,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Config = void 0;
|
|
5
5
|
/** This is the format for the "isaacscript.json" file. */
|
|
6
6
|
class Config {
|
|
7
|
+
$schema = "https://raw.githubusercontent.com/IsaacScript/isaacscript/main/packages/isaacscript-cli/schemas/isaacscript-schema.json";
|
|
8
|
+
/** The "mods" directory that lives next to the "isaac-ng.exe" program. */
|
|
9
|
+
modsDirectory = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\mods";
|
|
10
|
+
/** The save slot that you test your mod on. */
|
|
11
|
+
saveSlot = 1;
|
|
12
|
+
/**
|
|
13
|
+
* By default, the target mod directory name will be the same as the project directory name. This
|
|
14
|
+
* setting allows you to customize it.
|
|
15
|
+
*/
|
|
16
|
+
customTargetModDirectoryName;
|
|
17
|
+
/**
|
|
18
|
+
* When your code is recompiled, IsaacScript watcher can restart the game to ensure that any
|
|
19
|
+
* run-related variables are properly reset. This is set to true by default.
|
|
20
|
+
*/
|
|
21
|
+
enableIsaacScriptWatcherAutoRestart;
|
|
22
|
+
/**
|
|
23
|
+
* If set to true, the IsaacScript watcher will spawn an additional watcher process for the files
|
|
24
|
+
* in the `isaacscript-common` directory. (It assumes that you have `isaacscript-common` linked to
|
|
25
|
+
* a forked development repository.)
|
|
26
|
+
*/
|
|
27
|
+
isaacScriptCommonDev = false;
|
|
7
28
|
constructor(modsDirectory, saveSlot, isaacScriptCommonDev) {
|
|
8
|
-
this.$schema = "https://raw.githubusercontent.com/IsaacScript/isaacscript/main/packages/isaacscript-cli/schemas/isaacscript-schema.json";
|
|
9
|
-
/** The "mods" directory that lives next to the "isaac-ng.exe" program. */
|
|
10
|
-
this.modsDirectory = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\The Binding of Isaac Rebirth\\mods";
|
|
11
|
-
/** The save slot that you test your mod on. */
|
|
12
|
-
this.saveSlot = 1;
|
|
13
|
-
/**
|
|
14
|
-
* If set to true, the IsaacScript watcher will spawn an additional watcher process for the files
|
|
15
|
-
* in the `isaacscript-common` directory. (It assumes that you have `isaacscript-common` linked to
|
|
16
|
-
* a forked development repository.)
|
|
17
|
-
*/
|
|
18
|
-
this.isaacScriptCommonDev = false;
|
|
19
29
|
if (modsDirectory !== undefined) {
|
|
20
30
|
this.modsDirectory = modsDirectory;
|
|
21
31
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../../../../packages/isaacscript-cli/src/classes/Config.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0DAA0D;AAC1D,MAAa,MAAM;
|
|
1
|
+
{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../../../../packages/isaacscript-cli/src/classes/Config.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0DAA0D;AAC1D,MAAa,MAAM;IACjB,OAAO,GACL,yHAAyH,CAAC;IAE5H,0EAA0E;IAC1E,aAAa,GACX,uFAAuF,CAAC;IAE1F,+CAA+C;IAC/C,QAAQ,GAAG,CAAC,CAAC;IAEb;;;OAGG;IACH,4BAA4B,CAAU;IAEtC;;;OAGG;IACH,mCAAmC,CAAW;IAE9C;;;;OAIG;IACH,oBAAoB,GAAG,KAAK,CAAC;IAE7B,YACE,aAAsB,EACtB,QAAiB,EACjB,oBAA8B;QAE9B,IAAI,aAAa,KAAK,SAAS,EAAE;YAC/B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;SACpC;QAED,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;SAC1B;QAED,IAAI,oBAAoB,KAAK,SAAS,EAAE;YACtC,IAAI,CAAC,oBAAoB,GAAG,oBAAoB,CAAC;SAClD;IACH,CAAC;CACF;AA/CD,wBA+CC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.check = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
|
+
const isaacscript_common_ts_1 = require("isaacscript-common-ts");
|
|
7
|
+
const klaw_sync_1 = tslib_1.__importDefault(require("klaw-sync"));
|
|
8
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
9
|
+
const constants_js_1 = require("../../constants.js");
|
|
10
|
+
const PackageManager_js_1 = require("../../enums/PackageManager.js");
|
|
11
|
+
const exec_js_1 = require("../../exec.js");
|
|
12
|
+
const file = tslib_1.__importStar(require("../../file.js"));
|
|
13
|
+
const packageManager_js_1 = require("../../packageManager.js");
|
|
14
|
+
const URL_PREFIX = "https://raw.githubusercontent.com/IsaacScript/isaacscript/main/packages/isaacscript-cli/file-templates/static";
|
|
15
|
+
const MARKER_CUSTOMIZATION_START = "@template-customization-start";
|
|
16
|
+
const MARKER_CUSTOMIZATION_END = "@template-customization-end";
|
|
17
|
+
const MARKER_IGNORE_NEXT_LINE = "@template-ignore-next-line";
|
|
18
|
+
const PACKAGE_MANAGER_STRINGS = [
|
|
19
|
+
"PACKAGE-MANAGER-NAME",
|
|
20
|
+
"PACKAGE-MANAGER-INSTALL",
|
|
21
|
+
...(0, isaacscript_common_ts_1.getEnumValues)(PackageManager_js_1.PackageManager),
|
|
22
|
+
...(0, packageManager_js_1.getAllPackageManagerLockFileNames)(),
|
|
23
|
+
];
|
|
24
|
+
function check(args) {
|
|
25
|
+
const ignore = args.ignore ?? "";
|
|
26
|
+
const verbose = args.verbose === true;
|
|
27
|
+
let oneOrMoreErrors = false;
|
|
28
|
+
const ignoreFileNames = ignore.split(",");
|
|
29
|
+
const ignoreFileNamesSet = new Set(ignoreFileNames);
|
|
30
|
+
for (const klawItem of (0, klaw_sync_1.default)(constants_js_1.TEMPLATES_STATIC_DIR)) {
|
|
31
|
+
const templateFilePath = klawItem.path;
|
|
32
|
+
if (file.isDir(templateFilePath, verbose)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const originalFileName = node_path_1.default.basename(templateFilePath);
|
|
36
|
+
if (originalFileName === "main.ts") {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
const relativeTemplateFilePath = node_path_1.default.relative(constants_js_1.TEMPLATES_STATIC_DIR, templateFilePath);
|
|
40
|
+
const templateFileName = node_path_1.default.basename(relativeTemplateFilePath);
|
|
41
|
+
let projectFilePath = node_path_1.default.join(constants_js_1.CWD, relativeTemplateFilePath);
|
|
42
|
+
if (templateFileName === ".eslintrc.template.cjs") {
|
|
43
|
+
projectFilePath = node_path_1.default.join(projectFilePath, "..", ".eslintrc.cjs");
|
|
44
|
+
}
|
|
45
|
+
else if (templateFileName === "cspell.template.json") {
|
|
46
|
+
projectFilePath = node_path_1.default.join(projectFilePath, "..", "cspell.json");
|
|
47
|
+
}
|
|
48
|
+
else if (templateFileName === "gitattributes") {
|
|
49
|
+
projectFilePath = node_path_1.default.join(projectFilePath, "..", ".gitattributes");
|
|
50
|
+
}
|
|
51
|
+
const projectFileName = node_path_1.default.basename(projectFilePath);
|
|
52
|
+
if (ignoreFileNamesSet.has(projectFileName)) {
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
if (!compareTextFiles(projectFilePath, templateFilePath, originalFileName, verbose)) {
|
|
56
|
+
oneOrMoreErrors = true;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
{
|
|
60
|
+
const templateFilePath = constants_js_1.CI_YML_TEMPLATE_PATH;
|
|
61
|
+
const relativeTemplateFilePath = node_path_1.default.relative(constants_js_1.TEMPLATES_DYNAMIC_DIR, templateFilePath);
|
|
62
|
+
const projectFilePath = node_path_1.default.join(constants_js_1.CWD, relativeTemplateFilePath);
|
|
63
|
+
const originalFileName = node_path_1.default.basename(templateFilePath);
|
|
64
|
+
if (!compareTextFiles(projectFilePath, templateFilePath, originalFileName, verbose)) {
|
|
65
|
+
oneOrMoreErrors = true;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (oneOrMoreErrors) {
|
|
69
|
+
(0, isaacscript_common_ts_1.error)("The check command failed.");
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.check = check;
|
|
73
|
+
/** @returns Whether or not the project file is valid in reference to the template file. */
|
|
74
|
+
function compareTextFiles(projectFilePath, templateFilePath, originalFileName, verbose) {
|
|
75
|
+
if (!file.exists(projectFilePath, verbose)) {
|
|
76
|
+
console.log(`Failed to find the following file: ${projectFilePath}`);
|
|
77
|
+
printTemplateLocation(originalFileName);
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const [projectFileContents, ignoreLines] = getTruncatedFileText(projectFilePath, new Set(), verbose);
|
|
81
|
+
const [templateFileContents] = getTruncatedFileText(templateFilePath, ignoreLines, verbose);
|
|
82
|
+
if (templateFileContents === projectFileContents) {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
console.log(`The contents of the following file do not match: ${chalk_1.default.red(projectFilePath)}`);
|
|
86
|
+
printTemplateLocation(originalFileName);
|
|
87
|
+
const tempProjectFilePath = node_path_1.default.join(constants_js_1.CWD, "tempProjectFile.txt");
|
|
88
|
+
const tempTemplateFilePath = node_path_1.default.join(constants_js_1.CWD, "tempTemplateFile.txt");
|
|
89
|
+
file.write(tempProjectFilePath, projectFileContents, verbose);
|
|
90
|
+
file.write(tempTemplateFilePath, templateFileContents, verbose);
|
|
91
|
+
const { stdout } = (0, exec_js_1.execShell)("diff", [tempProjectFilePath, tempTemplateFilePath, "--ignore-blank-lines"], verbose, true);
|
|
92
|
+
console.log(`${stdout}\n`);
|
|
93
|
+
file.deleteFileOrDirectory(tempProjectFilePath, verbose);
|
|
94
|
+
file.deleteFileOrDirectory(tempTemplateFilePath, verbose);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @returns The a tuple containing the text of the file with all text removed between any flagged
|
|
99
|
+
* markers (and other specific hard-coded exclusions), as well as an array of lines that
|
|
100
|
+
* had a ignore-next-line marker below them.
|
|
101
|
+
*/
|
|
102
|
+
function getTruncatedFileText(filePath, linesBeforeIgnore, verbose) {
|
|
103
|
+
const fileName = node_path_1.default.basename(filePath);
|
|
104
|
+
const projectFileContents = file.read(filePath, verbose);
|
|
105
|
+
const lines = projectFileContents.split("\n");
|
|
106
|
+
const newLines = [];
|
|
107
|
+
const newLinesBeforeIgnore = new Set();
|
|
108
|
+
let currentlySkipping = false;
|
|
109
|
+
let markToIgnoreNextLine = false;
|
|
110
|
+
let previousLine = "";
|
|
111
|
+
for (const line of lines) {
|
|
112
|
+
if (line === "") {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
if (markToIgnoreNextLine) {
|
|
116
|
+
markToIgnoreNextLine = false;
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
if (linesBeforeIgnore.has(line)) {
|
|
120
|
+
markToIgnoreNextLine = true;
|
|
121
|
+
}
|
|
122
|
+
// -------------
|
|
123
|
+
// Marker checks
|
|
124
|
+
// -------------
|
|
125
|
+
if (line.includes(MARKER_CUSTOMIZATION_START)) {
|
|
126
|
+
currentlySkipping = true;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (line.includes(MARKER_CUSTOMIZATION_END)) {
|
|
130
|
+
currentlySkipping = false;
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
133
|
+
if (line.includes(MARKER_IGNORE_NEXT_LINE)) {
|
|
134
|
+
markToIgnoreNextLine = true;
|
|
135
|
+
// We mark the previous line so that we know the next line to skip in the template.
|
|
136
|
+
newLinesBeforeIgnore.add(previousLine);
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
// --------------------
|
|
140
|
+
// Specific file checks
|
|
141
|
+
// --------------------
|
|
142
|
+
// End-users can have different ignored words.
|
|
143
|
+
if ((fileName === "cspell.json" || fileName === "cspell.template.json") &&
|
|
144
|
+
line.includes('"words": [')) {
|
|
145
|
+
currentlySkipping = true;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if ((fileName === "cspell.json" || fileName === "cspell.template.json") &&
|
|
149
|
+
line.endsWith("]") &&
|
|
150
|
+
currentlySkipping) {
|
|
151
|
+
currentlySkipping = false;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
// End-users can have different package managers.
|
|
155
|
+
if (fileName === "ci.yml" && hasPackageManagerString(line)) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
// Ignore comments, since end-users are expected to delete the explanation.
|
|
159
|
+
if (fileName === "ci.yml" && line.match(/^\s*#/) !== null) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
// ------------
|
|
163
|
+
// Final checks
|
|
164
|
+
// ------------
|
|
165
|
+
if (!currentlySkipping) {
|
|
166
|
+
newLines.push(line);
|
|
167
|
+
previousLine = line;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const newText = newLines.join("\n");
|
|
171
|
+
return [newText, newLinesBeforeIgnore];
|
|
172
|
+
}
|
|
173
|
+
function printTemplateLocation(originalFileName) {
|
|
174
|
+
console.log(`You can find the template at: ${chalk_1.default.green(`${URL_PREFIX}/${originalFileName}`)}\n`);
|
|
175
|
+
}
|
|
176
|
+
function hasPackageManagerString(line) {
|
|
177
|
+
return PACKAGE_MANAGER_STRINGS.some((string) => line.includes(string));
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/check/check.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA6D;AAC7D,kEAAiC;AACjC,kEAA6B;AAC7B,qDAK4B;AAC5B,qEAA+D;AAC/D,2CAA0C;AAC1C,4DAAsC;AACtC,+DAA4E;AAG5E,MAAM,UAAU,GACd,+GAA+G,CAAC;AAElH,MAAM,0BAA0B,GAAG,+BAA+B,CAAC;AACnE,MAAM,wBAAwB,GAAG,6BAA6B,CAAC;AAC/D,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AAE7D,MAAM,uBAAuB,GAAG;IAC9B,sBAAsB;IACtB,yBAAyB;IACzB,GAAG,IAAA,qCAAa,EAAC,kCAAc,CAAC;IAChC,GAAG,IAAA,qDAAiC,GAAE;CAC9B,CAAC;AAEX,SAAgB,KAAK,CAAC,IAAU;IAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC;IACjC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC;IAEtC,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,MAAM,eAAe,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,kBAAkB,GAAG,IAAI,GAAG,C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AA2E;QAC3E,IAAI,QAAQ,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE;YACzD,SAAS;SACV;QAED,eAAe;QACf,eAAe;QACf,eAAe;QAEf,IAAI,CAAC,iBAAiB,EAAE;YACtB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACpB,YAAY,GAAG,IAAI,CAAC;SACrB;KACF;IAED,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpC,OAAO,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC;AACzC,CAAC;AAED,SAAS,qBAAqB,CAAC,gBAAwB;IACrD,OAAO,CAAC,GAAG,CACT,iCAAiC,eAAK,CAAC,KAAK,CAC1C,GAAG,UAAU,IAAI,gBAAgB,EAAE,CACpC,IAAI,CACN,CAAC;AACJ,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAY;IAC3C,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -2,29 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.compileAndCopy = exports.copy = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const file = tslib_1.__importStar(require("../../file"));
|
|
10
|
-
const
|
|
11
|
-
const
|
|
5
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
6
|
+
const constants_js_1 = require("../../constants.js");
|
|
7
|
+
const customStage_js_1 = require("../../customStage.js");
|
|
8
|
+
const exec_js_1 = require("../../exec.js");
|
|
9
|
+
const file = tslib_1.__importStar(require("../../file.js"));
|
|
10
|
+
const packageManager_js_1 = require("../../packageManager.js");
|
|
11
|
+
const utils_js_1 = require("../../utils.js");
|
|
12
12
|
async function copy(args, config) {
|
|
13
13
|
const verbose = args.verbose === true;
|
|
14
|
-
const packageManager = (0,
|
|
15
|
-
const modTargetDirectoryName = (0,
|
|
16
|
-
const modTargetPath =
|
|
17
|
-
await compileAndCopy(
|
|
14
|
+
const packageManager = (0, packageManager_js_1.getPackageManagerUsedForExistingProject)(args, verbose);
|
|
15
|
+
const modTargetDirectoryName = (0, utils_js_1.getModTargetDirectoryName)(config);
|
|
16
|
+
const modTargetPath = node_path_1.default.join(config.modsDirectory, modTargetDirectoryName);
|
|
17
|
+
await compileAndCopy(constants_js_1.MOD_SOURCE_PATH, modTargetPath, packageManager, verbose);
|
|
18
18
|
}
|
|
19
19
|
exports.copy = copy;
|
|
20
20
|
async function compileAndCopy(modSourcePath, modTargetPath, packageManager, verbose) {
|
|
21
|
-
await (0,
|
|
22
|
-
compile(verbose);
|
|
21
|
+
await (0, customStage_js_1.prepareCustomStages)(packageManager, verbose);
|
|
22
|
+
compile(packageManager, verbose);
|
|
23
23
|
copyMod(modSourcePath, modTargetPath, verbose);
|
|
24
24
|
}
|
|
25
25
|
exports.compileAndCopy = compileAndCopy;
|
|
26
|
-
function compile(verbose) {
|
|
27
|
-
(0,
|
|
26
|
+
function compile(packageManager, verbose) {
|
|
27
|
+
const packageManagerNPXCommand = (0, packageManager_js_1.getPackageManagerNPXCommand)(packageManager);
|
|
28
|
+
(0, exec_js_1.execShell)(packageManagerNPXCommand, ["tstl"], verbose);
|
|
28
29
|
console.log("Mod compiled successfully.");
|
|
29
30
|
}
|
|
30
31
|
function copyMod(modSourcePath, modTargetPath, verbose) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/copy/copy.ts"],"names":[],"mappings":";;;;AAAA,
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/copy/copy.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C,IAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;KACpD;IACD,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -4,11 +4,11 @@ exports.checkIfProjectPathExists = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
6
|
const isaacscript_common_ts_1 = require("isaacscript-common-ts");
|
|
7
|
-
const
|
|
8
|
-
const file = tslib_1.__importStar(require("../../file"));
|
|
9
|
-
const
|
|
7
|
+
const constants_js_1 = require("../../constants.js");
|
|
8
|
+
const file = tslib_1.__importStar(require("../../file.js"));
|
|
9
|
+
const prompt_js_1 = require("../../prompt.js");
|
|
10
10
|
async function checkIfProjectPathExists(projectPath, yes, verbose) {
|
|
11
|
-
if (projectPath ===
|
|
11
|
+
if (projectPath === constants_js_1.CWD || !file.exists(projectPath, verbose)) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
14
|
const fileType = file.isDir(projectPath, verbose) ? "directory" : "file";
|
|
@@ -18,7 +18,7 @@ async function checkIfProjectPathExists(projectPath, yes, verbose) {
|
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
console.log(`A ${fileType} already exists with a name of: ${chalk_1.default.green(projectPath)}`);
|
|
21
|
-
const shouldDelete = await (0,
|
|
21
|
+
const shouldDelete = await (0, prompt_js_1.getInputYesNo)("Do you want me to delete it?");
|
|
22
22
|
if (!shouldDelete) {
|
|
23
23
|
(0, isaacscript_common_ts_1.error)("Ok then. Goodbye.");
|
|
24
24
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkIfProjectPathExists.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/checkIfProjectPathExists.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C
|
|
1
|
+
{"version":3,"file":"checkIfProjectPathExists.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/checkIfProjectPathExists.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C,qDAAyC;AACzC,4DAAsC;AACtC,+CAAgD;AAEzC,KAAK,UAAU,wBAAwB,CAC5C,WAAmB,EACnB,GAAY,EACZ,OAAgB;IAEhB,IAAI,WAAW,KAAK,kBAAG,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC,EAAE;QAC7D,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;IAEzE,IAAI,GAAG,EAAE;QACP,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;QACjD,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,KAAK,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAChE,OAAO;KACR;IAED,OAAO,CAAC,GAAG,CACT,KAAK,QAAQ,mCAAmC,eAAK,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,CAC3E,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAa,EAAC,8BAA8B,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,IAAA,6BAAK,EAAC,mBAAmB,CAAC,CAAC;KAC5B;IAED,IAAI,CAAC,qBAAqB,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACnD,CAAC;AA3BD,4DA2BC"}
|
|
@@ -4,10 +4,10 @@ exports.checkModSubdirectory = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
6
|
const isaacscript_common_ts_1 = require("isaacscript-common-ts");
|
|
7
|
-
const
|
|
8
|
-
const file = tslib_1.__importStar(require("../../file"));
|
|
7
|
+
const constants_js_1 = require("../../constants.js");
|
|
8
|
+
const file = tslib_1.__importStar(require("../../file.js"));
|
|
9
9
|
function checkModSubdirectory(projectPath, modsDirectory) {
|
|
10
|
-
if (file.isSubDirOf(
|
|
10
|
+
if (file.isSubDirOf(constants_js_1.CWD, modsDirectory)) {
|
|
11
11
|
console.error(`Error: The project directory of "${chalk_1.default.green(projectPath)}" is a subdirectory of "${chalk_1.default.green(modsDirectory)}".`);
|
|
12
12
|
(0, isaacscript_common_ts_1.error)('You are supposed to have your project folder somewhere else on the system than the Isaac mods directory. (This is because we don\'t want to upload the ".git" folder or the TypeScript files to the Steam Workshop.) Exiting.');
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkModSubdirectory.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/checkModSubdirectory.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C
|
|
1
|
+
{"version":3,"file":"checkModSubdirectory.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/checkModSubdirectory.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C,qDAAyC;AACzC,4DAAsC;AAEtC,SAAgB,oBAAoB,CAClC,WAAmB,EACnB,aAAqB;IAErB,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAG,EAAE,aAAa,CAAC,EAAE;QACvC,OAAO,CAAC,KAAK,CACX,oCAAoC,eAAK,CAAC,KAAK,CAC7C,WAAW,CACZ,2BAA2B,eAAK,CAAC,KAAK,CAAC,aAAa,CAAC,IAAI,CAC3D,CAAC;QACF,IAAA,6BAAK,EACH,+NAA+N,CAChO,CAAC;KACH;AACH,CAAC;AAdD,oDAcC"}
|
|
@@ -4,12 +4,12 @@ exports.checkModTargetDirectory = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const chalk_1 = tslib_1.__importDefault(require("chalk"));
|
|
6
6
|
const isaacscript_common_ts_1 = require("isaacscript-common-ts");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const file = tslib_1.__importStar(require("../../file"));
|
|
10
|
-
const
|
|
7
|
+
const node_path_1 = tslib_1.__importDefault(require("node:path"));
|
|
8
|
+
const constants_js_1 = require("../../constants.js");
|
|
9
|
+
const file = tslib_1.__importStar(require("../../file.js"));
|
|
10
|
+
const prompt_js_1 = require("../../prompt.js");
|
|
11
11
|
async function checkModTargetDirectory(modsDirectory, projectName, yes, verbose) {
|
|
12
|
-
const modTargetPath =
|
|
12
|
+
const modTargetPath = node_path_1.default.join(modsDirectory, projectName);
|
|
13
13
|
if (!file.exists(modTargetPath, verbose)) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
@@ -20,8 +20,8 @@ async function checkModTargetDirectory(modsDirectory, projectName, yes, verbose)
|
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
22
|
console.log(`A ${fileType} already exists at at the mod path of: ${chalk_1.default.green(modTargetPath)}`);
|
|
23
|
-
console.log(`${
|
|
24
|
-
const shouldDelete = await (0,
|
|
23
|
+
console.log(`${constants_js_1.PROJECT_NAME} will need to sync your project folder with this directory.`);
|
|
24
|
+
const shouldDelete = await (0, prompt_js_1.getInputYesNo)("Do you want me to delete it?");
|
|
25
25
|
if (!shouldDelete) {
|
|
26
26
|
(0, isaacscript_common_ts_1.error)("Ok then. Goodbye.");
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkModTargetDirectory.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/checkModTargetDirectory.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C,
|
|
1
|
+
{"version":3,"file":"checkModTargetDirectory.js","sourceRoot":"","sources":["../../../../../../packages/isaacscript-cli/src/commands/init/checkModTargetDirectory.ts"],"names":[],"mappings":";;;;AAAA,0DAA0B;AAC1B,iEAA8C;AAC9C,kEAA6B;AAC7B,qDAAkD;AAClD,4DAAsC;AACtC,+CAAgD;AAEzC,KAAK,UAAU,uBAAuB,CAC3C,aAAqB,EACrB,WAAmB,EACnB,GAAY,EACZ,OAAgB;IAEhB,MAAM,aAAa,GAAG,mBAAI,CAAC,IAAI,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAC5D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,OAAO,CAAC,EAAE;QACxC,OAAO;KACR;IAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC;IAE3E,IAAI,GAAG,EAAE;QACP,IAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,WAAW,QAAQ,KAAK,eAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QAClE,OAAO;KACR;IAED,OAAO,CAAC,GAAG,CACT,KAAK,QAAQ,0CAA0C,eAAK,CAAC,KAAK,CAChE,aAAa,CACd,EAAE,CACJ,CAAC;IACF,OAAO,CAAC,GAAG,CACT,GAAG,2BAAY,6DAA6D,CAC7E,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAa,EAAC,8BAA8B,CAAC,CAAC;IAEzE,IAAI,CAAC,YAAY,EAAE;QACjB,IAAA,6BAAK,EAAC,mBAAmB,CAAC,CAAC;KAC5B;IAED,IAAI,CAAC,qBAAqB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAlCD,0DAkCC"}
|