Skip to content

Commit

Permalink
fix(bundling): react-standalone take into account bundler (#14573)
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Jan 24, 2023
1 parent d7536aa commit 6116460
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
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

1 comment on commit 6116460

@vercel
Copy link

@vercel vercel bot commented on 6116460 Jan 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.