isaacscript 3.18.3 → 3.18.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import chalk from "chalk";
2
- import { PACKAGE_JSON, PackageManager, copyFileOrDirectory, getFileNamesInDirectory, getPackageManagerExecCommand, getPackageManagerInstallCICommand, getPackageManagerInstallCommand, getPackageManagerLockFileName, isFile, makeDirectory, readFile, renameFile, updatePackageJSON, writeFile, } from "isaacscript-common-node";
2
+ import { PACKAGE_JSON, PackageManager, copyFileOrDirectory, deleteFileOrDirectory, getFileNamesInDirectory, getPackageManagerExecCommand, getPackageManagerInstallCICommand, getPackageManagerInstallCommand, getPackageManagerLockFileName, isFile, makeDirectory, readFile, renameFile, updatePackageJSON, writeFile, } from "isaacscript-common-node";
3
3
  import { removeLinesBetweenMarkers, removeLinesMatching, repeat, } from "isaacscript-common-ts";
4
4
  import path from "node:path";
5
5
  import { Config } from "../../classes/Config.js";
@@ -123,7 +123,10 @@ function copyDynamicFiles(projectName, authorName, projectPath, packageManager,
123
123
  const template = readFile(templatePath);
124
124
  // "PROJECT-NAME" must be hyphenated, as using an underscore will break Prettier for some
125
125
  // reason.
126
- const readmeMD = template.replaceAll("PROJECT-NAME", projectName);
126
+ const command = getPackageManagerInstallCICommand(packageManager);
127
+ const readmeMD = template
128
+ .replaceAll("PROJECT-NAME", projectName)
129
+ .replaceAll("PACKAGE-MANAGER-INSTALL-COMMAND", command);
127
130
  const destinationPath = path.join(projectPath, README_MD);
128
131
  writeFile(destinationPath, readmeMD);
129
132
  }
@@ -178,13 +181,28 @@ function upgradeYarn(projectPath, packageManager, verbose) {
178
181
  if (packageManager !== PackageManager.yarn) {
179
182
  return;
180
183
  }
181
- execShell("yarn", ["set", "version", "latest"], verbose, false, projectPath);
184
+ // This command will do two things:
185
+ // - It creates `./.yarn/releases/yarn-#.#.#.cjs`.
186
+ // - It creates the following string in the "package.json" file: `"packageManager": "yarn@#.#.#"`
187
+ // Having the "yarn-#.#.#.cjs" file inside of the repository is now discouraged in Yarn 4+, so
188
+ // we can safely delete this directory.
189
+ execShellString("yarn set version latest", verbose, false, projectPath);
190
+ const yarnDirectoryPath = path.join(projectPath, ".yarn");
191
+ deleteFileOrDirectory(yarnDirectoryPath);
192
+ // - The ".yarnrc.yml" file will now look like this: `yarnPath: .yarn/releases/yarn-4.0.1.cjs`
193
+ // - As mentioned above, we do not need the "yarnPath" setting if the "yarn-#.#.#.cjs" file is not
194
+ // inside of the repository, so we need to delete it.
195
+ // - Additionally, since there is not a setting specified for "nodeLinker", it will use `pnp`,
196
+ // which is not desired:
182
197
  // https://yarnpkg.com/features/linkers
183
- // - `pnp` is the default, but it requires a VSCode extension.
184
- // - `pnpm` is fast, but it does not work with a D drive:
198
+ // - `pnp` is the default, but it requires a VSCode extension.
199
+ // - `pnpm` is fast, but it does not work with a D drive:
185
200
  // https://github.com/yarnpkg/berry/issues/5326
186
- // - Thus, we use `node-modules`.
187
- execShell("yarn", ["config", "set", "nodeLinker", "node-modules"], verbose, false, projectPath);
201
+ // - Thus, we use `node-modules`, which can be set with: `yarn config set nodeLinker node-modules`
202
+ // - However, in order to fix both of these at the same time, we just overwrite the file, which is
203
+ // simpler than running commands or manually editing the file.
204
+ const yarnConfigPath = path.join(projectPath, ".yarnrc.yml");
205
+ writeFile(yarnConfigPath, "nodeLinker: node-modules\n");
188
206
  }
189
207
  function installNodeModules(projectPath, skipInstall, packageManager, verbose) {
190
208
  if (skipInstall) {
@@ -18,6 +18,7 @@ If you are a developer, or if the mod is not yet uploaded to the Steam Workshop,
18
18
  - Unzip the zip file to a new directory.
19
19
  - Open the command prompt (or another shell of your choice).
20
20
  - Use the `cd` command to navigate to the place where you unzipped the repository.
21
- - Use the `npm run start` command to start the IsaacScript watcher.
21
+ - Use the `PACKAGE-MANAGER-INSTALL-COMMAND` command to install the project dependencies.
22
+ - Use the `npx isaacscript` command to start the IsaacScript watcher.
22
23
  - If IsaacScript is successful, you will see "Compilation successful." (You can continue to leave the terminal window open; it will monitor for changes in your project, and recompile if necessary.)
23
24
  - Completely close Isaac if it is already open, and then open the game again, and the mod should be in the list of mods. You can now play or test the mod.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript",
3
- "version": "3.18.3",
3
+ "version": "3.18.5",
4
4
  "description": "A command line tool for managing Isaac mods written in TypeScript.",
5
5
  "keywords": [
6
6
  "isaac",