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

feat: remove rspack generator #5358

Merged
merged 2 commits into from
Feb 2, 2024
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
1 change: 0 additions & 1 deletion .changeset/fuzzy-ants-destroy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
'@modern-js/rspack-generator': patch
'@modern-js/generator-common': patch
---

Expand Down
7 changes: 7 additions & 0 deletions .changeset/poor-panthers-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@modern-js/mwa-generator': patch
'@modern-js/generator-common': patch
---

feat(generator): remove rspack generator, you can enable it by one line configration
feat(generator): 移除 rspack 生成器, 现在只需要一行配置即可开启
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.handlebars
1 change: 0 additions & 1 deletion packages/generator/generator-common/src/common/solution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ export const getScenesSchema = (extra: Record<string, any> = {}): Schema => {

export const BaseGenerator = '@modern-js/base-generator';
export const PackagesGenerator = '@modern-js/packages-generator';
export const RspackGenerator = '@modern-js/rspack-generator';

export const SolutionGenerator: Record<Solution, string> = {
[Solution.MWA]: '@modern-js/mwa-generator',
Expand Down
1 change: 0 additions & 1 deletion packages/generator/generators/mwa-generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"@modern-js/generator-common": "workspace:*",
"@modern-js/generator-utils": "workspace:*",
"@modern-js/packages-generator": "workspace:*",
"@modern-js/rspack-generator": "workspace:*",
"@modern-js/plugin-i18n": "workspace:*",
"@scripts/build": "workspace:*",
"@scripts/jest-config": "workspace:*",
Expand Down
28 changes: 12 additions & 16 deletions packages/generator/generators/mwa-generator/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
EntryGenerator,
PackagesGenerator,
BuildTools,
RspackGenerator,
} from '@modern-js/generator-common';
import {
getMWAProjectPath,
Expand Down Expand Up @@ -117,6 +116,12 @@ export const handleTemplateFile = async (
generator.logger.debug(`inputData=${JSON.stringify(ans)}`, ans);

const { packageName, packagePath, language, packageManager } = ans;
const { packagesInfo, buildTools } = context.config;

const bundler =
buildTools === BuildTools.Rspack
? `'experimental-rspack',`
: `'webpack', // Set to 'experimental-rspack' to enable rspack ⚡️🦀`;

const projectPath = getMWAProjectPath(
packagePath as string,
Expand Down Expand Up @@ -155,6 +160,9 @@ export const handleTemplateFile = async (
resourceKey
.replace('templates/ts-template/', projectPath)
.replace('.handlebars', ''),
{
bundler,
},
);
} else {
await appApi.forgeTemplate(
Expand All @@ -164,6 +172,9 @@ export const handleTemplateFile = async (
resourceKey
.replace('templates/js-template/', projectPath)
.replace('.handlebars', ''),
{
bundler,
},
);
}

Expand All @@ -183,21 +194,6 @@ export const handleTemplateFile = async (
});
}

const { packagesInfo, buildTools } = context.config;

if (buildTools === BuildTools.Rspack) {
await appApi.runSubGenerator(
getGeneratorPath(RspackGenerator, context.config.distTag),
undefined,
{
...context.config,
isNewProject: true,
isSubGenerator: true,
modernVersion,
},
);
}

if (packagesInfo && Object.keys(packagesInfo).length > 0) {
await appApi.runSubGenerator(
getGeneratorPath(PackagesGenerator, context.config.distTag),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ module.exports = {
runtime: {
router: true,
},
plugins: [appTools()],
plugins: [
appTools({
bundler: {{{ bundler }}}
}),
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ export default defineConfig({
runtime: {
router: true,
},
plugins: [appTools()],
plugins: [
appTools({
bundler: {{{ bundler }}}
}),
],
});
8 changes: 0 additions & 8 deletions packages/generator/generators/rspack-generator/.eslintrc.js

This file was deleted.

265 changes: 0 additions & 265 deletions packages/generator/generators/rspack-generator/CHANGELOG.md

This file was deleted.

Loading
Loading