isaacscript 1.2.25 → 1.2.28
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 +7 -6
- package/dist/src/commands/copy/copy.js +0 -1
- package/dist/src/commands/copy/copy.js.map +1 -1
- package/dist/src/commands/init/createMod.js +18 -106
- package/dist/src/commands/init/createMod.js.map +1 -1
- package/dist/src/commands/init/getProjectPath.js +4 -2
- package/dist/src/commands/init/getProjectPath.js.map +1 -1
- package/dist/src/commands/init/git.js +167 -0
- package/dist/src/commands/init/git.js.map +1 -0
- package/dist/src/commands/init/init.js +3 -1
- package/dist/src/commands/init/init.js.map +1 -1
- package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js +0 -5
- package/dist/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.js.map +1 -1
- package/dist/src/commands/publish/publish.js +4 -21
- package/dist/src/commands/publish/publish.js.map +1 -1
- package/dist/src/configFile.js +2 -2
- package/dist/src/configFile.js.map +1 -1
- package/dist/src/prompt.js +1 -0
- package/dist/src/prompt.js.map +1 -1
- package/file-templates/static/.github/workflows/ci.yml +3 -3
- package/{src → file-templates/static}/plugins/addCrashDebugStatements.ts +0 -0
- package/file-templates/static/plugins/addIsaacScriptCommentHeader.ts +35 -0
- package/file-templates/static/tsconfig.json +8 -0
- package/isaacscript-watcher/metadata.xml +5 -5
- package/package.json +7 -6
- package/src/commands/copy/copy.ts +0 -1
- package/src/commands/init/createMod.ts +29 -188
- package/src/commands/init/getProjectPath.ts +5 -3
- package/src/commands/init/git.ts +232 -0
- package/src/commands/init/init.ts +8 -1
- package/src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts +0 -6
- package/src/commands/publish/publish.ts +4 -26
- package/src/configFile.ts +3 -3
- package/src/exec.ts +1 -1
- package/src/prompt.ts +1 -0
- package/dist/src/monkeyPatch.js +0 -82
- package/dist/src/monkeyPatch.js.map +0 -1
- package/dist/src/plugins/addCrashDebugStatements.js +0 -44
- package/dist/src/plugins/addCrashDebugStatements.js.map +0 -1
- package/src/monkeyPatch.ts +0 -62
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.28",
|
|
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,6 +16,7 @@
|
|
|
16
16
|
"isaacscript": "./dist/src/main.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@types/node": "^17.0.23",
|
|
19
20
|
"chalk": "4.1.2",
|
|
20
21
|
"command-exists": "^1.2.9",
|
|
21
22
|
"dotenv": "^16.0.0",
|
|
@@ -29,21 +30,21 @@
|
|
|
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
|
|
33
|
+
"ts-node": "^10.7.0",
|
|
34
|
+
"typescript": "^4.6.3",
|
|
35
|
+
"typescript-to-lua": "^1.4.2",
|
|
34
36
|
"update-notifier": "^5.1.0",
|
|
35
37
|
"yaml": "^1.10.2",
|
|
36
|
-
"yargs": "^17.
|
|
38
|
+
"yargs": "^17.4.0"
|
|
37
39
|
},
|
|
38
40
|
"devDependencies": {
|
|
39
41
|
"@types/command-exists": "^1.2.0",
|
|
40
42
|
"@types/figlet": "^1.5.4",
|
|
41
43
|
"@types/fs-extra": "^9.0.13",
|
|
42
|
-
"@types/node": "^17.0.21",
|
|
43
44
|
"@types/prompt": "^1.1.2",
|
|
44
45
|
"@types/source-map-support": "^0.5.4",
|
|
45
46
|
"@types/update-notifier": "^5.1.0",
|
|
46
47
|
"@types/yargs": "^17.0.10",
|
|
47
|
-
"isaacscript-lint": "^1.0.
|
|
48
|
+
"isaacscript-lint": "^1.0.95"
|
|
48
49
|
}
|
|
49
50
|
}
|
|
@@ -41,7 +41,6 @@ function copy(argv, config) {
|
|
|
41
41
|
exports.copy = copy;
|
|
42
42
|
function compileAndCopy(modSourcePath, modTargetPath, verbose) {
|
|
43
43
|
compile(verbose);
|
|
44
|
-
// monkeyPatchMainLua(modSourcePath);
|
|
45
44
|
copyMod(modSourcePath, modTargetPath, verbose);
|
|
46
45
|
}
|
|
47
46
|
exports.compileAndCopy = compileAndCopy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../../src/commands/copy/copy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,+CAAkD;AAClD,qCAAuC;AACvC,iDAAmC;AAEnC,uCAAwD;AAExD,SAAgB,IAAI,CAAC,IAA6B,EAAE,MAAc;IAChE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC;IAEtC,MAAM,sBAAsB,GAAG,IAAA,iCAAyB,EAAC,MAAM,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC;IAE9E,cAAc,CAAC,2BAAe,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAPD,oBAOC;AAED,SAAgB,cAAc,CAC5B,aAAqB,EACrB,aAAqB,EACrB,OAAgB;IAEhB,OAAO,CAAC,OAAO,CAAC,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../../src/commands/copy/copy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,+CAAkD;AAClD,qCAAuC;AACvC,iDAAmC;AAEnC,uCAAwD;AAExD,SAAgB,IAAI,CAAC,IAA6B,EAAE,MAAc;IAChE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC;IAEtC,MAAM,sBAAsB,GAAG,IAAA,iCAAyB,EAAC,MAAM,CAAC,CAAC;IACjE,MAAM,aAAa,GAAG,cAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC;IAE9E,cAAc,CAAC,2BAAe,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AAC1D,CAAC;AAPD,oBAOC;AAED,SAAgB,cAAc,CAC5B,aAAqB,EACrB,aAAqB,EACrB,OAAgB;IAEhB,OAAO,CAAC,OAAO,CAAC,CAAC;IACjB,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAPD,wCAOC;AAED,SAAS,OAAO,CAAC,OAAgB;IAC/B,IAAA,gBAAS,EAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC;AAED,SAAS,OAAO,CACd,aAAqB,EACrB,aAAqB,EACrB,OAAgB;IAEhB,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;QAC9B,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"}
|
|
@@ -28,50 +28,39 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.createMod = void 0;
|
|
30
30
|
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
-
const command_exists_1 = __importDefault(require("command-exists"));
|
|
32
31
|
const path_1 = __importDefault(require("path"));
|
|
33
|
-
const yaml_1 = __importDefault(require("yaml"));
|
|
34
32
|
const configFile = __importStar(require("../../configFile"));
|
|
35
33
|
const constants_1 = require("../../constants");
|
|
36
34
|
const exec_1 = require("../../exec");
|
|
37
35
|
const file = __importStar(require("../../file"));
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
const REQUIRED_GIT_MAJOR_VERSION = 2;
|
|
41
|
-
const REQUIRED_GIT_MINOR_VERSION = 30;
|
|
42
|
-
async function createMod(projectName, projectPath, createNewDir, modsDirectory, saveSlot, skipNPMInstall, verbose) {
|
|
36
|
+
const git_1 = require("./git");
|
|
37
|
+
function createMod(projectName, projectPath, createNewDir, modsDirectory, saveSlot, gitRemoteURL, skipNPMInstall, verbose) {
|
|
43
38
|
if (createNewDir) {
|
|
44
39
|
file.makeDir(projectPath, verbose);
|
|
45
40
|
}
|
|
46
41
|
const config = configFile.createObject(modsDirectory, saveSlot);
|
|
47
42
|
configFile.createFile(projectPath, config, verbose);
|
|
48
43
|
const targetModDirectory = path_1.default.join(config.modsDirectory, projectName);
|
|
49
|
-
|
|
44
|
+
updateNodeModules(projectPath, verbose);
|
|
45
|
+
installNodeModules(projectPath, skipNPMInstall, verbose);
|
|
50
46
|
makeSubdirectories(projectPath, verbose);
|
|
51
47
|
copyStaticFiles(projectPath, verbose);
|
|
52
48
|
copyDynamicFiles(projectName, projectPath, targetModDirectory, verbose);
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
// Only make the initial commit once all of the files have been copied
|
|
50
|
+
(0, git_1.initGitRepository)(projectPath, gitRemoteURL, verbose);
|
|
55
51
|
console.log(`Successfully created mod: ${chalk_1.default.green(projectName)}`);
|
|
56
52
|
}
|
|
57
53
|
exports.createMod = createMod;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const remoteURL = await getGitRemoteURL(projectName);
|
|
65
|
-
if (remoteURL === "") {
|
|
54
|
+
function updateNodeModules(projectPath, verbose) {
|
|
55
|
+
console.log("Finding out the latest versions of the NPM packages...");
|
|
56
|
+
(0, exec_1.execShell)("npx", ["npm-check-updates", "--upgrade", "--packageFile", "package.json"], verbose, false, projectPath);
|
|
57
|
+
}
|
|
58
|
+
function installNodeModules(projectPath, skipNPMInstall, verbose) {
|
|
59
|
+
if (skipNPMInstall) {
|
|
66
60
|
return;
|
|
67
61
|
}
|
|
68
|
-
|
|
69
|
-
(0, exec_1.execShell)("
|
|
70
|
-
(0, exec_1.execShell)("git", ["remote", "add", "origin", remoteURL], verbose, false, projectPath);
|
|
71
|
-
if (isGitNameAndEmailConfigured(verbose)) {
|
|
72
|
-
(0, exec_1.execShell)("git", ["add", "--all"], verbose, false, projectPath);
|
|
73
|
-
(0, exec_1.execShell)("git", ["commit", "--message", `${constants_1.PROJECT_NAME} template`], verbose, false, projectPath);
|
|
74
|
-
}
|
|
62
|
+
console.log("Installing node modules... (This can take a long time.)");
|
|
63
|
+
(0, exec_1.execShell)("npm", ["install"], verbose, false, projectPath);
|
|
75
64
|
}
|
|
76
65
|
function makeSubdirectories(projectPath, verbose) {
|
|
77
66
|
// The "src" directory is created during copying of static files
|
|
@@ -80,7 +69,7 @@ function makeSubdirectories(projectPath, verbose) {
|
|
|
80
69
|
file.makeDir(srcPath, verbose);
|
|
81
70
|
}
|
|
82
71
|
}
|
|
83
|
-
|
|
72
|
+
/** Copy static files, like ".eslintrc.js", "tsconfig.json", etc. */
|
|
84
73
|
function copyStaticFiles(projectPath, verbose) {
|
|
85
74
|
const staticFileList = file.getDirList(constants_1.TEMPLATES_STATIC_DIR);
|
|
86
75
|
staticFileList.forEach((fileName) => {
|
|
@@ -91,7 +80,7 @@ function copyStaticFiles(projectPath, verbose) {
|
|
|
91
80
|
}
|
|
92
81
|
});
|
|
93
82
|
}
|
|
94
|
-
|
|
83
|
+
/** Copy files that need to have text replaced inside of them. */
|
|
95
84
|
function copyDynamicFiles(projectName, projectPath, targetModDirectory, verbose) {
|
|
96
85
|
// ".gitignore"
|
|
97
86
|
{
|
|
@@ -137,6 +126,7 @@ function copyDynamicFiles(projectName, projectPath, targetModDirectory, verbose)
|
|
|
137
126
|
const modPath = path_1.default.join(projectPath, "mod");
|
|
138
127
|
const destinationPath = path_1.default.join(modPath, fileName);
|
|
139
128
|
file.write(destinationPath, metadataXML, verbose);
|
|
129
|
+
(0, exec_1.execShell)("npx", ["prettier", "--write", destinationPath]);
|
|
140
130
|
}
|
|
141
131
|
// "mod/metadata.vdf"
|
|
142
132
|
{
|
|
@@ -159,85 +149,7 @@ function copyDynamicFiles(projectName, projectPath, targetModDirectory, verbose)
|
|
|
159
149
|
const mainTS = template.replace(/MOD_NAME_TO_REPLACE/g, projectName);
|
|
160
150
|
const destinationPath = path_1.default.join(srcPath, fileName);
|
|
161
151
|
file.write(destinationPath, mainTS, verbose);
|
|
152
|
+
(0, exec_1.execShell)("npx", ["prettier", "--write", destinationPath]);
|
|
162
153
|
}
|
|
163
154
|
}
|
|
164
|
-
function updateNodeModules(projectPath, verbose) {
|
|
165
|
-
console.log("Finding out the latest versions of the NPM packages...");
|
|
166
|
-
(0, exec_1.execShell)("npx", ["npm-check-updates", "--upgrade", "--packageFile", "package.json"], verbose, false, projectPath);
|
|
167
|
-
}
|
|
168
|
-
async function getGitRemoteURL(projectName) {
|
|
169
|
-
const guessedRemoteURL = guessRemoteURL(projectName);
|
|
170
|
-
if (guessedRemoteURL !== undefined) {
|
|
171
|
-
const shouldUseGuessedURL = await (0, prompt_1.getInputYesNo)(`Do you want to use a Git remote URL of: ${chalk_1.default.green(guessedRemoteURL)}`);
|
|
172
|
-
if (shouldUseGuessedURL) {
|
|
173
|
-
return guessedRemoteURL;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return (0, prompt_1.getInputString)(`Paste in the remote Git URL for your project.
|
|
177
|
-
For example, if you have an SSH key, it would be something like:
|
|
178
|
-
${chalk_1.default.green("git@github.com:Alice/green-candle.git")}
|
|
179
|
-
If you don't have an SSH key, it would be something like:
|
|
180
|
-
${chalk_1.default.green("https://github.com/Alice/green-candle.git")}
|
|
181
|
-
If you don't want to initialize a Git repository for this project, press enter to skip.
|
|
182
|
-
`);
|
|
183
|
-
}
|
|
184
|
-
function checkOldGitVersion(verbose) {
|
|
185
|
-
const [, stdout] = (0, exec_1.execShell)("git", ["--version"], verbose);
|
|
186
|
-
const outputPrefix = "git version ";
|
|
187
|
-
if (!stdout.startsWith(outputPrefix)) {
|
|
188
|
-
(0, utils_1.error)(`Failed to parse the output from the "git --version" command: ${stdout}`);
|
|
189
|
-
}
|
|
190
|
-
const gitVersionString = stdout.slice(outputPrefix.length);
|
|
191
|
-
const [majorVersion, minorVersion] = (0, utils_1.parseSemVer)(gitVersionString);
|
|
192
|
-
if (majorVersion >= REQUIRED_GIT_MAJOR_VERSION &&
|
|
193
|
-
minorVersion >= REQUIRED_GIT_MINOR_VERSION) {
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
console.error(`Your Git version is: ${chalk_1.default.red(gitVersionString)}`);
|
|
197
|
-
console.error(`${constants_1.PROJECT_NAME} requires a Git version of ${chalk_1.default.red(`${REQUIRED_GIT_MAJOR_VERSION}.${REQUIRED_GIT_MINOR_VERSION}.0`)} or greater.`);
|
|
198
|
-
console.error(`Please upgrade your version of Git before using ${constants_1.PROJECT_NAME}.`);
|
|
199
|
-
process.exit(1);
|
|
200
|
-
}
|
|
201
|
-
function guessRemoteURL(projectName) {
|
|
202
|
-
const gitHubUsername = getGitHubUsername();
|
|
203
|
-
if (gitHubUsername === undefined) {
|
|
204
|
-
return undefined;
|
|
205
|
-
}
|
|
206
|
-
return `git@github.com:${gitHubUsername}/${projectName}.git`;
|
|
207
|
-
}
|
|
208
|
-
function getGitHubUsername() {
|
|
209
|
-
// If the GitHub CLI is installed, we can derive the user's GitHub username
|
|
210
|
-
if (!command_exists_1.default.sync("gh") ||
|
|
211
|
-
process.env.APPDATA === undefined ||
|
|
212
|
-
process.env.APPDATA === "") {
|
|
213
|
-
return undefined;
|
|
214
|
-
}
|
|
215
|
-
const githubCLIHostsPath = path_1.default.join(process.env.APPDATA, "GitHub CLI", "hosts.yml");
|
|
216
|
-
if (!file.exists(githubCLIHostsPath)) {
|
|
217
|
-
return undefined;
|
|
218
|
-
}
|
|
219
|
-
const configYAMLRaw = file.read(githubCLIHostsPath);
|
|
220
|
-
const configYAML = yaml_1.default.parse(configYAMLRaw);
|
|
221
|
-
const githubCom = configYAML["github.com"];
|
|
222
|
-
if (githubCom === undefined) {
|
|
223
|
-
return undefined;
|
|
224
|
-
}
|
|
225
|
-
const { user } = githubCom;
|
|
226
|
-
if (user === "") {
|
|
227
|
-
return undefined;
|
|
228
|
-
}
|
|
229
|
-
return user;
|
|
230
|
-
}
|
|
231
|
-
function isGitNameAndEmailConfigured(verbose) {
|
|
232
|
-
const [nameExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.name"], verbose, true);
|
|
233
|
-
const [emailExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.email"], verbose, true);
|
|
234
|
-
return nameExitStatus === 0 && emailExitStatus === 0;
|
|
235
|
-
}
|
|
236
|
-
function installNodeModules(projectPath, skipNPMInstall, verbose) {
|
|
237
|
-
if (skipNPMInstall) {
|
|
238
|
-
return;
|
|
239
|
-
}
|
|
240
|
-
console.log("Installing node modules... (This can take a long time.)");
|
|
241
|
-
(0, exec_1.execShell)("npm", ["install"], verbose, false, projectPath);
|
|
242
|
-
}
|
|
243
155
|
//# sourceMappingURL=createMod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMod.js","sourceRoot":"","sources":["../../../../src/commands/init/createMod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"createMod.js","sourceRoot":"","sources":["../../../../src/commands/init/createMod.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,6DAA+C;AAC/C,+C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CAAC,eAAe,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;KACnD;IAED,gBAAgB;IAChB;QACE,iDAAiD;QACjD,mFAAmF;QACnF,MAAM,OAAO,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,mBAAO,CAAC;QACzB,MAAM,YAAY,GAAG,iCAAqB,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,sBAAsB,EAAE,WAAW,CAAC,CAAC;QACrE,MAAM,eAAe,GAAG,cAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACrD,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAA,gBAAS,EAAC,KAAK,EAAE,CAAC,UAAU,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAAC;KAC5D;AACH,CAAC"}
|
|
@@ -32,7 +32,7 @@ async function getProjectPath(argv) {
|
|
|
32
32
|
projectPath = constants_1.CWD;
|
|
33
33
|
createNewDir = false;
|
|
34
34
|
}
|
|
35
|
-
else if (projectName !==
|
|
35
|
+
else if (projectName !== undefined) {
|
|
36
36
|
// The project name was specified on the command-line
|
|
37
37
|
projectPath = path_1.default.join(constants_1.CWD, projectName);
|
|
38
38
|
createNewDir = true;
|
|
@@ -49,7 +49,9 @@ async function getProjectPath(argv) {
|
|
|
49
49
|
}
|
|
50
50
|
exports.getProjectPath = getProjectPath;
|
|
51
51
|
function getProjectNameFromCommandLineArgument(argv) {
|
|
52
|
-
return typeof argv.name === "string" && argv.name !== ""
|
|
52
|
+
return typeof argv.name === "string" && argv.name !== ""
|
|
53
|
+
? argv.name
|
|
54
|
+
: undefined;
|
|
53
55
|
}
|
|
54
56
|
async function getNewProjectName() {
|
|
55
57
|
console.log("You did not specify a project name as a command-line argument.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getProjectPath.js","sourceRoot":"","sources":["../../../../src/commands/init/getProjectPath.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,+CAA8D;AAC9D,yCAA6D;AAC7D,uCAA4C;AAE5C,4EAA4E;AAC5E,MAAM,wCAAwC,GAAG;IAC/C,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC;AAEK,KAAK,UAAU,cAAc,CAClC,IAA6B;IAE7B,IAAI,WAAW,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,WAAmB,CAAC;IACxB,IAAI,YAAqB,CAAC;IAC1B,IAAI,IAAI,CAAC,aAAa,KAAK,SAAS,EAAE;QACpC,2DAA2D;QAC3D,yCAAyC;QACzC,WAAW,GAAG,kCAAsB,CAAC;QACrC,WAAW,GAAG,eAAG,CAAC;QAClB,YAAY,GAAG,KAAK,CAAC;KACtB;SAAM,IAAI,WAAW,KAAK,
|
|
1
|
+
{"version":3,"file":"getProjectPath.js","sourceRoot":"","sources":["../../../../src/commands/init/getProjectPath.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,gDAAwB;AACxB,+CAA8D;AAC9D,yCAA6D;AAC7D,uCAA4C;AAE5C,4EAA4E;AAC5E,MAAM,wCAAwC,GAAG;IAC/C,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,IAAI;IACJ,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC;AAEK,KAAK,UAAU,cAAc,CAClC,IAA6B;IAE7B,IAAI,WAAW,GAAG,qCAAqC,CAAC,IAAI,CAAC,CAAC;IAC9D,IAAI,WAAmB,CAAC;IACxB,IAAI,YAAqB,CAAC;IAC1B,IAAI,IAAI,CAAC,aAAa,K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AAC,CAAC;IAC3E,MAAM,WAAW,GAAG,cAAI,CAAC,IAAI,CAAC,eAAG,EAAE,WAAW,CAAC,CAAC;IAEhD,OAAO,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,SAAS,mBAAmB,CAAC,WAAmB;IAC9C,IAAI,WAAW,KAAK,EAAE,EAAE;QACtB,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC9D,OAAO,KAAK,CAAC;KACd;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE;QAChC,KAAK,MAAM,SAAS,IAAI,wCAAwC,EAAE;YAChE,IAAI,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;gBACnC,OAAO,CAAC,KAAK,CACX,eAAe,SAAS,oDAAoD,CAC7E,CAAC;gBACF,OAAO,KAAK,CAAC;aACd;SACF;KACF;IAED,IAAI,IAAA,qBAAa,EAAC,WAAW,CAAC,EAAE;QAC9B,OAAO,CAAC,KAAK,CACX,iIAAiI,CAClI,CAAC;QACF,OAAO,KAAK,CAAC;KACd;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.gitCommitIfChanges = exports.isGitDirty = exports.initGitRepository = exports.promptGitHubRepoOrGitRemoteURL = void 0;
|
|
30
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
31
|
+
const command_exists_1 = __importDefault(require("command-exists"));
|
|
32
|
+
const path_1 = __importDefault(require("path"));
|
|
33
|
+
const yaml_1 = __importDefault(require("yaml"));
|
|
34
|
+
const constants_1 = require("../../constants");
|
|
35
|
+
const exec_1 = require("../../exec");
|
|
36
|
+
const file = __importStar(require("../../file"));
|
|
37
|
+
const prompt_1 = require("../../prompt");
|
|
38
|
+
const utils_1 = require("../../utils");
|
|
39
|
+
const REQUIRED_GIT_MAJOR_VERSION = 2;
|
|
40
|
+
const REQUIRED_GIT_MINOR_VERSION = 30;
|
|
41
|
+
async function promptGitHubRepoOrGitRemoteURL(projectName, verbose) {
|
|
42
|
+
// We do not need to prompt the user if they do not have Git installed
|
|
43
|
+
if (!command_exists_1.default.sync("git")) {
|
|
44
|
+
console.log('Git does not seem to be installed. (The "git" command is not in the path.) Skipping Git-related things.');
|
|
45
|
+
return undefined;
|
|
46
|
+
}
|
|
47
|
+
validateNewGitVersion(verbose);
|
|
48
|
+
const gitHubUsername = getGitHubUsername();
|
|
49
|
+
if (gitHubUsername !== undefined) {
|
|
50
|
+
const [exitStatus] = (0, exec_1.execShell)("gh", ["repo", "view", projectName], verbose, true);
|
|
51
|
+
const gitHubRepoExists = exitStatus === 0;
|
|
52
|
+
const url = `https://github.com/${gitHubUsername}/${projectName}`;
|
|
53
|
+
if (gitHubRepoExists) {
|
|
54
|
+
console.log(`Detected an existing GitHub repository at: ${chalk_1.default.green(url)}`);
|
|
55
|
+
const guessedRemoteURL = getGitRemoteURL(projectName, gitHubUsername);
|
|
56
|
+
const shouldUseGuessedURL = await (0, prompt_1.getInputYesNo)(`Do you want to use a Git remote URL of: ${chalk_1.default.green(guessedRemoteURL)}`);
|
|
57
|
+
if (shouldUseGuessedURL) {
|
|
58
|
+
return guessedRemoteURL;
|
|
59
|
+
}
|
|
60
|
+
// Assume that since they do not want to connect this project to the existing GitHub
|
|
61
|
+
// repository, they do not want to initialize Git either
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
const createNewGitHubRepo = await (0, prompt_1.getInputYesNo)(`Would you like to create a new GitHub repository at: ${chalk_1.default.green(url)}`);
|
|
65
|
+
if (createNewGitHubRepo) {
|
|
66
|
+
(0, exec_1.execShell)("gh", ["repo", "create", "poop", "--public"]);
|
|
67
|
+
console.log("Successfully created a new GitHub repository.");
|
|
68
|
+
return getGitRemoteURL(projectName, gitHubUsername);
|
|
69
|
+
}
|
|
70
|
+
// Assume that since they do not want to create a new GitHub repository, they do not want to
|
|
71
|
+
// initialize Git either
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const gitRemoteURL = await (0, prompt_1.getInputString)(`Paste in the remote Git URL for your project.
|
|
75
|
+
For example, if you have an SSH key, it would be something like:
|
|
76
|
+
${chalk_1.default.green("git@github.com:Alice/green-candle.git")}
|
|
77
|
+
If you don't have an SSH key, it would be something like:
|
|
78
|
+
${chalk_1.default.green("https://github.com/Alice/green-candle.git")}
|
|
79
|
+
If you don't want to initialize a Git repository for this project, press enter to skip.
|
|
80
|
+
`);
|
|
81
|
+
return gitRemoteURL === "" ? undefined : gitRemoteURL;
|
|
82
|
+
}
|
|
83
|
+
exports.promptGitHubRepoOrGitRemoteURL = promptGitHubRepoOrGitRemoteURL;
|
|
84
|
+
function validateNewGitVersion(verbose) {
|
|
85
|
+
const [, stdout] = (0, exec_1.execShell)("git", ["--version"], verbose);
|
|
86
|
+
const outputPrefix = "git version ";
|
|
87
|
+
if (!stdout.startsWith(outputPrefix)) {
|
|
88
|
+
(0, utils_1.error)(`Failed to parse the output from the "git --version" command: ${stdout}`);
|
|
89
|
+
}
|
|
90
|
+
const gitVersionString = stdout.slice(outputPrefix.length);
|
|
91
|
+
const [majorVersion, minorVersion] = (0, utils_1.parseSemVer)(gitVersionString);
|
|
92
|
+
if (majorVersion >= REQUIRED_GIT_MAJOR_VERSION &&
|
|
93
|
+
minorVersion >= REQUIRED_GIT_MINOR_VERSION) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
console.error(`Your Git version is: ${chalk_1.default.red(gitVersionString)}`);
|
|
97
|
+
console.error(`${constants_1.PROJECT_NAME} requires a Git version of ${chalk_1.default.red(`${REQUIRED_GIT_MAJOR_VERSION}.${REQUIRED_GIT_MINOR_VERSION}.0`)} or greater.`);
|
|
98
|
+
console.error(`Please upgrade your version of Git before using ${constants_1.PROJECT_NAME}.`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
function getGitHubUsername() {
|
|
102
|
+
// If the GitHub CLI is installed, we can derive the user's GitHub username
|
|
103
|
+
if (!command_exists_1.default.sync("gh") ||
|
|
104
|
+
process.env.APPDATA === undefined ||
|
|
105
|
+
process.env.APPDATA === "") {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
const githubCLIHostsPath = path_1.default.join(process.env.APPDATA, "GitHub CLI", "hosts.yml");
|
|
109
|
+
if (!file.exists(githubCLIHostsPath)) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
const configYAMLRaw = file.read(githubCLIHostsPath);
|
|
113
|
+
const configYAML = yaml_1.default.parse(configYAMLRaw);
|
|
114
|
+
const githubCom = configYAML["github.com"];
|
|
115
|
+
if (githubCom === undefined) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
const { user } = githubCom;
|
|
119
|
+
if (user === "") {
|
|
120
|
+
return undefined;
|
|
121
|
+
}
|
|
122
|
+
return user;
|
|
123
|
+
}
|
|
124
|
+
function getGitRemoteURL(projectName, gitHubUsername) {
|
|
125
|
+
return `git@github.com:${gitHubUsername}/${projectName}.git`;
|
|
126
|
+
}
|
|
127
|
+
function initGitRepository(projectPath, gitRemoteURL, verbose) {
|
|
128
|
+
// We already checked to see if the "git" command is installed earlier on in the initialization
|
|
129
|
+
// process
|
|
130
|
+
if (gitRemoteURL === undefined) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
(0, exec_1.execShell)("git", ["init"], verbose, false, projectPath);
|
|
134
|
+
(0, exec_1.execShell)("git", ["branch", "-M", "main"], verbose, false, projectPath);
|
|
135
|
+
(0, exec_1.execShell)("git", ["remote", "add", "origin", gitRemoteURL], verbose, false, projectPath);
|
|
136
|
+
if (isGitNameAndEmailConfigured(verbose)) {
|
|
137
|
+
(0, exec_1.execShell)("git", ["add", "--all"], verbose, false, projectPath);
|
|
138
|
+
(0, exec_1.execShell)("git", ["commit", "--message", `${constants_1.PROJECT_NAME} template`], verbose, false, projectPath);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.initGitRepository = initGitRepository;
|
|
142
|
+
function isGitNameAndEmailConfigured(verbose) {
|
|
143
|
+
const [nameExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.name"], verbose, true);
|
|
144
|
+
const [emailExitStatus] = (0, exec_1.execShell)("git", ["config", "--global", "user.email"], verbose, true);
|
|
145
|
+
return nameExitStatus === 0 && emailExitStatus === 0;
|
|
146
|
+
}
|
|
147
|
+
function isGitDirty(verbose) {
|
|
148
|
+
// From: https://remarkablemark.org/blog/2017/10/12/check-git-dirty/
|
|
149
|
+
const [, stdout] = (0, exec_1.execShell)("git", ["status", "--porcelain"], verbose);
|
|
150
|
+
return stdout !== "";
|
|
151
|
+
}
|
|
152
|
+
exports.isGitDirty = isGitDirty;
|
|
153
|
+
function gitCommitIfChanges(version, verbose) {
|
|
154
|
+
// Throw an error if this is not a git repository
|
|
155
|
+
(0, exec_1.execShell)("git", ["status"], verbose);
|
|
156
|
+
if (!isGitDirty(verbose)) {
|
|
157
|
+
console.log("There are no changes to commit.");
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
const commitMessage = `v${version}`;
|
|
161
|
+
(0, exec_1.execShell)("git", ["add", "-A"], verbose);
|
|
162
|
+
(0, exec_1.execShell)("git", ["commit", "-m", commitMessage], verbose);
|
|
163
|
+
(0, exec_1.execShell)("git", ["push"], verbose);
|
|
164
|
+
console.log(`Committed and pushed to the git repository with a message of: ${commitMessage}`);
|
|
165
|
+
}
|
|
166
|
+
exports.gitCommitIfChanges = gitCommitIfChanges;
|
|
167
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../../../src/commands/init/git.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,oEAA2C;AAC3C,gDAAwB;AACxB,gDAAwB;AACxB,+CAA+C;AAC/C,qCAAuC;AACvC,iDAAmC;AACnC,yCAA6D;AAE7D,uCAAiD;AAEjD,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE/B,KAAK,UAAU,8BAA8B,CAClD,WAAmB,EACnB,OAAgB;IAEhB,sEAAsE;IACtE,IAAI,CAAC,wBAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QAC9B,OAAO,CAAC,GAAG,CACT,yG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AAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,CAAC;IAEtC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE;QACxB,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAC/C,OAAO;KACR;IAED,MAAM,aAAa,GAAG,IAAI,OAAO,EAAE,CAAC;IACpC,IAAA,gBAAS,EAAC,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;IACzC,IAAA,gBAAS,EAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;IAC3D,IAAA,gBAAS,EAAC,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IAEpC,OAAO,CAAC,GAAG,CACT,iEAAiE,aAAa,EAAE,CACjF,CAAC;AACJ,CAAC;AAjBD,gDAiBC"}
|
|
@@ -14,6 +14,7 @@ const checkModTargetDirectory_1 = require("./checkModTargetDirectory");
|
|
|
14
14
|
const createMod_1 = require("./createMod");
|
|
15
15
|
const getModsDir_1 = require("./getModsDir");
|
|
16
16
|
const getProjectPath_1 = require("./getProjectPath");
|
|
17
|
+
const git_1 = require("./git");
|
|
17
18
|
const installVSCodeExtensions_1 = require("./installVSCodeExtensions");
|
|
18
19
|
const promptSaveSlot_1 = require("./promptSaveSlot");
|
|
19
20
|
const promptVSCode_1 = require("./promptVSCode");
|
|
@@ -29,7 +30,8 @@ async function init(argv) {
|
|
|
29
30
|
const projectName = path_1.default.basename(projectPath);
|
|
30
31
|
await (0, checkModTargetDirectory_1.checkModTargetDirectory)(modsDirectory, projectName, verbose);
|
|
31
32
|
const saveSlot = await (0, promptSaveSlot_1.promptSaveSlot)(argv);
|
|
32
|
-
await (0,
|
|
33
|
+
const gitRemoteURL = await (0, git_1.promptGitHubRepoOrGitRemoteURL)(projectName, verbose);
|
|
34
|
+
(0, createMod_1.createMod)(projectName, projectPath, createNewDir, modsDirectory, saveSlot, gitRemoteURL, skipNPMInstall, verbose);
|
|
33
35
|
await openVSCode(projectPath, vscode, verbose);
|
|
34
36
|
printFinishMessage(projectPath, projectName);
|
|
35
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/commands/init/init.ts"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,oEAA2C;AAC3C,gDAAwB;AACxB,+CAAoD;AACpD,yEAAsE;AACtE,iEAA8D;AAC9D,uEAAoE;AACpE,2CAAwC;AACxC,6CAA0C;AAC1C,qDAAkD;AAClD,uEAAoE;AACpE,qDAAkD;AAClD,iDAA8C;AAEvC,KAAK,UAAU,IAAI,CAAC,IAA6B;IACtD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC;IACpC,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,KAAK,IAAI,CAAC;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC;IAEtC,sEAAsE;IACtE,MAAM,CAAC,WAAW,EAAE,YAAY,CAAC,GAAG,MAAM,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,IAAA,mDAAwB,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACrD,MAAM,aAAa,GAAG,MAAM,IAAA,uBAAU,EAAC,IAAI,CAAC,CAAC;IAC7C,IAAA,2CAAoB,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,cAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IAC/C,MAAM,IAAA,iDAAuB,EAAC,aAAa,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IACnE,MAAM,QAAQ,GAAG,MAAM,IAAA,+BAAc,EAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/commands/init/init.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BAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAC/C,CAAC;AA/BD,oBA+BC;AAED,KAAK,UAAU,UAAU,CACvB,WAAmB,EACnB,MAAe,EACf,OAAgB;IAEhB,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;IACzC,IAAI,aAAa,KAAK,IAAI,EAAE;QAC1B,OAAO,CAAC,GAAG,CACT,gHAAgH,CACjH,CAAC;QACF,OAAO;KACR;IAED,IAAA,iDAAuB,EAAC,WAAW,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;IAC7D,MAAM,IAAA,2BAAY,EAAC,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,gBAAgB;IACvB,KAAK,MAAM,aAAa,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,EAAE;QAC3E,IAAI,wBAAa,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;YACrC,OAAO,aAAa,CAAC;SACtB;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,kBAAkB,CAAC,WAAmB,EAAE,WAAmB;IAClE,IAAI,cAAc,GAAG,EAAE,CAAC;IACxB,IAAI,WAAW,KAAK,eAAG,EAAE;QACvB,cAAc,IAAI,IAAI,eAAK,CAAC,KAAK,CAAC,MAAM,WAAW,EAAE,CAAC,QAAQ,CAAC;KAChE;IACD,cAAc,IAAI,IAAI,eAAK,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,cAAc,wBAAY,cAAc,cAAc,GAAG,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -31,11 +31,6 @@ function afterEachSync(params) {
|
|
|
31
31
|
if (params === undefined) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
/*
|
|
35
|
-
if (params.relativePath === path.sep + MAIN_LUA) {
|
|
36
|
-
monkeyPatchMainLua(modTargetPath);
|
|
37
|
-
}
|
|
38
|
-
*/
|
|
39
34
|
if (params.eventType !== "init:copy") {
|
|
40
35
|
send(`${constants_1.FILE_SYNCED_MESSAGE} ${params.relativePath}`);
|
|
41
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modDirectorySyncer.js","sourceRoot":"","sources":["../../../../../src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAAyD;AAEzD,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAE1B,IAAI,EAAE,CAAC;AAEP,SAAS,IAAI;IACX,MAAM,OAAO,GAAG,CAAC,CAAC;IAClB,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,OAAO,EAAE;QACvC,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;KACH;IAED,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhC,IAAA,wBAAa,EAAC,aAAa,EAAE,aAAa,EAAE;QAC1C,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,MAAM;QACZ,aAAa;QACb,OAAO;QACP,oBAAoB,EAAE;YACpB,gBAAgB,EAAE;gBAChB,kBAAkB,EAAE,IAAI;aACzB;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,MAMtB;IACC,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO;KACR;IAED
|
|
1
|
+
{"version":3,"file":"modDirectorySyncer.js","sourceRoot":"","sources":["../../../../../src/commands/monitor/modDirectorySyncer/modDirectorySyncer.ts"],"names":[],"mappings":";;;;;AAAA,oEAA2C;AAC3C,kDAAyD;AAEzD,IAAI,aAAqB,CAAC;AAC1B,IAAI,aAAqB,CAAC;AAE1B,IAAI,EAAE,CAAC;AAEP,SAAS,IAAI;IACX,MAAM,OAAO,GAAG,CAAC,CAAC;IAClB,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,GAAG,OAAO,EAAE;QACvC,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;KACH;IAED,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAChC,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAEhC,IAAA,wBAAa,EAAC,aAAa,EAAE,aAAa,EAAE;QAC1C,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,MAAM;QACZ,aAAa;QACb,OAAO;QACP,oBAAoB,EAAE;YACpB,gBAAgB,EAAE;gBAChB,kBAAkB,EAAE,IAAI;aACzB;SACF;KACF,CAAC,CAAC;AACL,CAAC;AAED,SAAS,aAAa,CAAC,MAMtB;IACC,IAAI,MAAM,KAAK,SAAS,EAAE;QACxB,OAAO;KACR;IAED,IAAI,MAAM,CAAC,SAAS,KAAK,WAAW,EAAE;QACpC,IAAI,CAAC,GAAG,+BAAmB,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;KACvD;AACH,CAAC;AAED,SAAS,OAAO,CAAC,GAAU;IACzB,OAAO,CAAC,KAAK,CAAC,4CAA4C,EAAE,GAAG,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE;QACtC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACnB;AACH,CAAC"}
|
|
@@ -34,6 +34,7 @@ const exec_1 = require("../../exec");
|
|
|
34
34
|
const file = __importStar(require("../../file"));
|
|
35
35
|
const utils_1 = require("../../utils");
|
|
36
36
|
const copy_1 = require("../copy/copy");
|
|
37
|
+
const git_1 = require("../init/git");
|
|
37
38
|
const UPDATE_SCRIPT_NAME = "update.sh";
|
|
38
39
|
function publish(argv, config) {
|
|
39
40
|
const skipVersionIncrement = argv.skip === true;
|
|
@@ -59,7 +60,7 @@ function validateVersion(setVersion) {
|
|
|
59
60
|
}
|
|
60
61
|
}
|
|
61
62
|
function validateGitNotDirty(verbose) {
|
|
62
|
-
if (isGitDirty(verbose)) {
|
|
63
|
+
if ((0, git_1.isGitDirty)(verbose)) {
|
|
63
64
|
(0, utils_1.error)(chalk_1.default.red("Before publishing, you must push your current changes to git. (Version commits should be not contain any code changes.)"));
|
|
64
65
|
}
|
|
65
66
|
}
|
|
@@ -74,7 +75,7 @@ function validateIsaacScriptOtherCopiesNotRunning(verbose) {
|
|
|
74
75
|
line.includes("isaacscript") &&
|
|
75
76
|
!line.includes("isaacscript publish"));
|
|
76
77
|
if (otherCopiesOfRunningIsaacScript.length > 0) {
|
|
77
|
-
(0, utils_1.error)(`Other copies of ${constants_1.PROJECT_NAME} appear to be running. You must close those copies before publishing.`);
|
|
78
|
+
(0, utils_1.error)(chalk_1.default.red(`Other copies of ${constants_1.PROJECT_NAME} appear to be running. You must close those copies before publishing.`));
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
function startPublish(modSourcePath, modTargetPath, skipVersionIncrement, setVersion, steamCmdPath, dryRun, verbose) {
|
|
@@ -94,7 +95,7 @@ function startPublish(modSourcePath, modTargetPath, skipVersionIncrement, setVer
|
|
|
94
95
|
purgeRoomXMLs(modTargetPath, verbose);
|
|
95
96
|
runReleaseScriptPostCopy(verbose);
|
|
96
97
|
if (!dryRun) {
|
|
97
|
-
gitCommitIfChanges(version, verbose);
|
|
98
|
+
(0, git_1.gitCommitIfChanges)(version, verbose);
|
|
98
99
|
uploadMod(modTargetPath, steamCmdPath, verbose);
|
|
99
100
|
}
|
|
100
101
|
const dryRunSuffix = dryRun ? " (dry run)" : "";
|
|
@@ -200,24 +201,6 @@ function runReleaseScriptPostCopy(verbose) {
|
|
|
200
201
|
console.log(stdout);
|
|
201
202
|
}
|
|
202
203
|
}
|
|
203
|
-
function gitCommitIfChanges(version, verbose) {
|
|
204
|
-
// Throw an error if this is not a git repository
|
|
205
|
-
(0, exec_1.execShell)("git", ["status"], verbose);
|
|
206
|
-
if (!isGitDirty(verbose)) {
|
|
207
|
-
console.log("There are no changes to commit.");
|
|
208
|
-
return;
|
|
209
|
-
}
|
|
210
|
-
const commitMessage = `v${version}`;
|
|
211
|
-
(0, exec_1.execShell)("git", ["add", "-A"], verbose);
|
|
212
|
-
(0, exec_1.execShell)("git", ["commit", "-m", commitMessage], verbose);
|
|
213
|
-
(0, exec_1.execShell)("git", ["push"], verbose);
|
|
214
|
-
console.log(`Committed and pushed to the git repository with a message of: ${commitMessage}`);
|
|
215
|
-
}
|
|
216
|
-
function isGitDirty(verbose) {
|
|
217
|
-
// From: https://remarkablemark.org/blog/2017/10/12/check-git-dirty/
|
|
218
|
-
const [, stdout] = (0, exec_1.execShell)("git", ["status", "--porcelain"], verbose);
|
|
219
|
-
return stdout !== "";
|
|
220
|
-
}
|
|
221
204
|
function purgeRoomXMLs(modTargetPath, verbose) {
|
|
222
205
|
const roomsPath = path_1.default.join(modTargetPath, "resources", "rooms");
|
|
223
206
|
if (!file.exists(roomsPath) || !file.isDir(roomsPath)) {
|