Skip to content

Commit

Permalink
fix(nx-plugin): build for CommonJS to use generators
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Apr 11, 2024
1 parent 3b8ca38 commit 518e734
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
10 changes: 2 additions & 8 deletions packages/nx-plugin/src/generators/configuration/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
readProjectConfiguration,
updateProjectConfiguration,
} from '@nx/devkit';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
import { join } from 'node:path';
import { ui } from '@code-pushup/utils';
import { AddToProjectGeneratorSchema } from './schema';

Expand All @@ -23,12 +22,7 @@ export async function addToProjectGenerator(
return;
}

generateFiles(
tree,
join(fileURLToPath(dirname(import.meta.url)), 'files'),
root,
options,
);
generateFiles(tree, join(__dirname, 'files'), root, options);

updateProjectConfiguration(tree, options.project, {
...projectConfiguration,
Expand Down
10 changes: 5 additions & 5 deletions packages/nx-plugin/src/generators/init/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
cpModelVersion,
cpNxPluginVersion,
cpUtilsVersion,
} from '../../utils/versions';
} from '../versions';
import { InitGeneratorSchema } from './schema';

const nxPluginPackageName = '@code-pushup/nx-plugin';
Expand All @@ -29,10 +29,10 @@ function checkDependenciesInstalled(host: Tree) {
packageJson.devDependencies = packageJson.devDependencies ?? {};

// base deps
devDependencies[nxPluginPackageName] = cpNxPluginVersion;
devDependencies['@code-pushup/models'] = cpModelVersion;
devDependencies['@code-pushup/utils'] = cpUtilsVersion;
devDependencies['@code-pushup/cli'] = cpCliVersion;
devDependencies[nxPluginPackageName] = cpNxPluginVersion();
devDependencies['@code-pushup/models'] = cpModelVersion();
devDependencies['@code-pushup/utils'] = cpUtilsVersion();
devDependencies['@code-pushup/cli'] = cpCliVersion();

return addDependenciesToPackageJson(host, dependencies, devDependencies);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nx-plugin/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"module": "ESNext"
"module": "CommonJS"
},
"files": [],
"include": [],
Expand Down

0 comments on commit 518e734

Please sign in to comment.