Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bundling): react-standalone take into account bundler #14573

Merged
merged 1 commit into from
Jan 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion e2e/workspace-create/src/create-nx-workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('create-nx-workspace', () => {
checkFilesExist('project.json');
});

it('should create a workspace with a single react app at the root', () => {
it('should create a workspace with a single react app with vite at the root', () => {
const wsName = uniq('react');

runCreateWorkspace(wsName, {
Expand All @@ -45,6 +45,23 @@ describe('create-nx-workspace', () => {

checkFilesExist('package.json');
checkFilesExist('project.json');
checkFilesExist('vite.config.ts');
});

it('should create a workspace with a single react app with webpack at the root', () => {
const wsName = uniq('react');

runCreateWorkspace(wsName, {
preset: 'react-standalone',
appName: wsName,
style: 'css',
packageManager,
bundler: 'webpack',
});

checkFilesExist('package.json');
checkFilesExist('project.json');
checkFilesExist('webpack.config.js');
});

it('should be able to create an empty workspace built for apps', () => {
Expand Down
2 changes: 2 additions & 0 deletions packages/create-nx-workspace/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ async function main(parsedArgs: yargs.Arguments<Arguments>) {
skipGit,
commit,
framework,
bundler,
} = parsedArgs;

output.log({
Expand All @@ -266,6 +267,7 @@ async function main(parsedArgs: yargs.Arguments<Arguments>) {
nxCloud,
defaultBase,
framework,
bundler,
}
);

Expand Down
1 change: 1 addition & 0 deletions packages/workspace/src/generators/new/generate-preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export function generatePreset(host: Tree, opts: NormalizedSchema) {
opts.linter ? `--linter=${opts.linter}` : null,
opts.npmScope ? `--npmScope=${opts.npmScope}` : `--npmScope=${opts.name}`,
opts.preset ? `--preset=${opts.preset}` : null,
opts.bundler ? `--bundler=${opts.bundler}` : null,
opts.framework ? `--framework=${opts.framework}` : null,
opts.packageManager ? `--packageManager=${opts.packageManager}` : null,
parsedArgs.interactive ? '--interactive=true' : '--interactive=false',
Expand Down
1 change: 1 addition & 0 deletions packages/workspace/src/generators/new/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface Schema {
defaultBase: string;
framework?: string;
linter?: Linter;
bundler?: 'vite' | 'webpack';
packageManager?: PackageManager;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/workspace/src/generators/preset/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ async function createPreset(tree: Tree, options: Schema) {
rootProject: true,
bundler: options.bundler ?? 'vite',
e2eTestRunner: 'cypress',
unitTestRunner: 'vitest',
unitTestRunner: options.bundler === 'vite' ? 'vitest' : 'jest',
});
} else if (options.preset === Preset.NextJs) {
const { applicationGenerator: nextApplicationGenerator } = require('@nrwl' +
Expand Down