isaacscript 3.18.4 → 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";
@@ -181,13 +181,28 @@ function upgradeYarn(projectPath, packageManager, verbose) {
181
181
  if (packageManager !== PackageManager.yarn) {
182
182
  return;
183
183
  }
184
- 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:
185
197
  // https://yarnpkg.com/features/linkers
186
- // - `pnp` is the default, but it requires a VSCode extension.
187
- // - `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:
188
200
  // https://github.com/yarnpkg/berry/issues/5326
189
- // - Thus, we use `node-modules`.
190
- 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");
191
206
  }
192
207
  function installNodeModules(projectPath, skipInstall, packageManager, verbose) {
193
208
  if (skipInstall) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript",
3
- "version": "3.18.4",
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",