Skip to content

Commit

Permalink
chore(misc): clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Feb 19, 2025
1 parent 8a2077c commit 7942ad5
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 343 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
checkFilesExist,
getPackageManagerCommand,
getPublishedVersion,
getSelectedPackageManager,
readFile,
readJson,
runCLI,
Expand All @@ -21,6 +22,12 @@ import {
describe('nx init (for React - legacy)', () => {
let pmc: ReturnType<typeof getPackageManagerCommand>;

beforeAll(() => {
pmc = getPackageManagerCommand({
packageManager: getSelectedPackageManager(),
});
});

it('should convert to an standalone workspace with Vite', () => {
const appName = 'my-app';
createReactApp(appName);
Expand All @@ -31,7 +38,7 @@ describe('nx init (for React - legacy)', () => {
} nx@${getPublishedVersion()} init --no-interactive`
);

expect(craToNxOutput).toContain('Successfully created the workspace');
expect(craToNxOutput).toContain('Done!');

checkFilesDoNotExist(
'libs/.gitkeep',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ export function addViteCommandsToPackageScripts(
const packageJson = readJsonFile(packageJsonPath);
packageJson.scripts = {
...packageJson.scripts,
start: 'nx exec -- vite',
serve: 'nx exec -- vite',
build: `nx exec -- vite build`,
test: 'nx exec -- vitest',
// These should be replaced by the vite init generator later.
start: 'vite',
test: 'vitest',
dev: 'vite',
build: 'vite build',
eject: undefined,
};
writeJsonFile(packageJsonPath, packageJson, { spaces: 2 });
}
Loading

0 comments on commit 7942ad5

Please sign in to comment.