Skip to content

Commit

Permalink
fixes node-entrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Del Core committed Sep 17, 2024
1 parent be0ed7b commit d3162ae
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 1 addition & 3 deletions packages/cli-alias/bin/codeshift-cli.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
#!/usr/bin/env node
const path = require('path');

require(path.join('..', 'dist', 'index.js'));
export * from '../dist/index.js';
2 changes: 1 addition & 1 deletion packages/cli-alias/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from '@hypermod/cli';
import '@hypermod/cli';
4 changes: 1 addition & 3 deletions packages/cli-alias/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"baseUrl": ".",
"module": "NodeNext",
"moduleResolution": "NodeNext"
"baseUrl": "."
},
"include": ["src"],
"references": [
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
);

Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -79,7 +80,11 @@ export default async function main(
}

const pluginManagerConfig: Partial<PluginManagerOptions> = {
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.
Expand Down

0 comments on commit d3162ae

Please sign in to comment.