diff --git a/packages/cli-alias/bin/codeshift-cli.js b/packages/cli-alias/bin/codeshift-cli.js index af523d395..9ff5293bd 100755 --- a/packages/cli-alias/bin/codeshift-cli.js +++ b/packages/cli-alias/bin/codeshift-cli.js @@ -1,4 +1,2 @@ #!/usr/bin/env node -const path = require('path'); - -require(path.join('..', 'dist', 'index.js')); +export * from '../dist/index.js'; diff --git a/packages/cli-alias/src/index.ts b/packages/cli-alias/src/index.ts index 9a747839b..769c40bde 100644 --- a/packages/cli-alias/src/index.ts +++ b/packages/cli-alias/src/index.ts @@ -1 +1 @@ -export * from '@hypermod/cli'; +import '@hypermod/cli'; diff --git a/packages/cli-alias/tsconfig.json b/packages/cli-alias/tsconfig.json index fa460117d..d8ebadead 100644 --- a/packages/cli-alias/tsconfig.json +++ b/packages/cli-alias/tsconfig.json @@ -3,9 +3,7 @@ "compilerOptions": { "rootDir": "src", "outDir": "dist", - "baseUrl": ".", - "module": "NodeNext", - "moduleResolution": "NodeNext" + "baseUrl": "." }, "include": ["src"], "references": [ diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index d198539f2..ed1c513b0 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -9,10 +9,12 @@ import init from './init.js'; import validate from './validate.js'; import { InvalidUserInputError, InvalidConfigError } from './errors.js'; -const __dirname = path.dirname(new URL(import.meta.url).pathname); - const packageJson = readFileSync( - path.join(__dirname, '..', 'package.json'), + path.join( + path.dirname(new URL(import.meta.url).pathname), + '..', + 'package.json', + ), 'utf-8', ); diff --git a/packages/cli/src/main.ts b/packages/cli/src/main.ts index d6a82baa6..a263d1796 100644 --- a/packages/cli/src/main.ts +++ b/packages/cli/src/main.ts @@ -37,6 +37,7 @@ const ExperimentalModuleLoader = () => { }; const install = async (packageName: string) => { + const __dirname = path.dirname(new URL(import.meta.url).pathname); await installPackage(packageName, { cwd: __dirname, packageManager: 'npm', @@ -79,7 +80,11 @@ export default async function main( } const pluginManagerConfig: Partial = { - pluginsPath: path.join(__dirname, '..', 'node_modules'), + pluginsPath: path.join( + path.dirname(new URL(import.meta.url).pathname), + '..', + 'node_modules', + ), }; // If a registry is provided in the CLI flags, use it for the pluginManagers configuration.