Skip to content

Commit

Permalink
feat!: remove old install folder migration (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz committed Feb 9, 2024
1 parent b9eea58 commit 54e9510
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions sources/folderUtils.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,12 @@
import {UsageError} from 'clipanion';
import {existsSync, mkdirSync, renameSync} from 'fs';
import {homedir, tmpdir} from 'os';
import {join} from 'path';
import process from 'process';
import {UsageError} from 'clipanion';
import {mkdirSync} from 'fs';
import {homedir, tmpdir} from 'os';
import {join} from 'path';
import process from 'process';

import type {NodeError} from './nodeUtils';
import type {NodeError} from './nodeUtils';

export function getInstallFolder() {
if (process.env.COREPACK_HOME == null) {
// TODO: remove this block on the next major.
const oldCorepackDefaultHome = join(homedir(), `.node`, `corepack`);
const newCorepackDefaultHome = join(
process.env.XDG_CACHE_HOME ??
process.env.LOCALAPPDATA ??
join(
homedir(),
process.platform === `win32` ? `AppData/Local` : `.cache`,
),
`node/corepack`,
);
if (
existsSync(oldCorepackDefaultHome) &&
!existsSync(newCorepackDefaultHome)
) {
mkdirSync(newCorepackDefaultHome, {recursive: true});
renameSync(oldCorepackDefaultHome, newCorepackDefaultHome);
}
return newCorepackDefaultHome;
}
return (
process.env.COREPACK_HOME ??
join(
Expand Down

0 comments on commit 54e9510

Please sign in to comment.