Skip to content

Commit

Permalink
chore: reuse CHAIN_ID from Rsbuild (#5410)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Feb 20, 2024
1 parent e1199b8 commit a3a788b
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 244 deletions.
12 changes: 2 additions & 10 deletions .pnpmfile.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ function readPackage(pkg, _context) {

// Some packages still depend on esbuild < 0.17, so we upgrade it manually.
// ref: https://github.com/lukeed/tsm/issues/48
if (
pkg.name === 'tsm' ||
pkg.name === 'vite' ||
pkg.name === 'esbuild-loader'
) {
if (pkg.name === 'tsm' || pkg.name === 'vite') {
pkg.dependencies.esbuild = '0.17.19';
}

Expand All @@ -38,17 +34,13 @@ function readPackage(pkg, _context) {
}
}

const outsideModernPkgList = ['@modern-js/mdx-rs-binding'];

if (
(pkg.name?.startsWith('@rspress/') || pkg.name?.startsWith('rspress')) &&
pkg.dependencies
) {
pkg.dependencies = Object.fromEntries(
Object.entries(pkg.dependencies).map(([key, value]) =>
key.startsWith('@modern-js/') && !outsideModernPkgList.includes(key)
? [key, 'workspace:*']
: [key, value],
key.startsWith('@modern-js/') ? [key, 'workspace:*'] : [key, value],
),
);
}
Expand Down
21 changes: 1 addition & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,38 +100,19 @@
}
},
"allowedDeprecatedVersions": {
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
"@babel/plugin-proposal-object-rest-spread": "7.12.1 || 7.20.7",
"@babel/plugin-proposal-optional-chaining": "7.21.0",
"@babel/plugin-proposal-private-methods": "7.18.6",
"@babel/plugin-proposal-private-property-in-object": "7.21.0",
"@financial-times/polyfill-useragent-normaliser": "1.10.2",
"core-js": "2.6.11",
"formidable": "1.2.6",
"hast": "1.0.0",
"sourcemap-codec": "1.4.8",
"uuid-browser": "3.1.0",
"stable": "0.1.8",
"js-polyfills": "0.1.43",
"picturefill": "3.0.3",
"string-similarity": "4.0.4",
"querystring": "0.2.0",
"string-similarity": "4.0.4",
"source-map-resolve": "0.6.0 || 0.5.3",
"@formatjs/intl-utils": "3.8.4",
"debug": "4.1.1",
"sane": "4.1.0",
"mkdirp": "0.3.5",
"@npmcli/move-file": "1.1.2",
"uuid": "3.4.0",
"chokidar": "2.1.8",
"consolidate": "0.15.1",
"fsevents": "1.2.13",
"source-map-url": "0.4.1",
"urix": "0.1.0",
"resolve-url": "0.2.1",
"superagent": "6.1.0",
"@types/sass": "1.45.0",
"trim": "0.0.1"
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/cli/plugin-bff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"@swc/helpers": "0.5.3"
},
"devDependencies": {
"@rsbuild/shared": "0.4.3",
"@modern-js/runtime": "workspace:*",
"@modern-js/core": "workspace:*",
"@modern-js/bff-runtime": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/plugin-bff/tests/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ResolvedConfigContext,
} from '@modern-js/core';
import Chain from '@modern-js/utils/webpack-chain';
import { CHAIN_ID } from '@modern-js/utils';
import { CHAIN_ID } from '@rsbuild/shared';
import type { AppToolsHooks } from '@modern-js/app-tools';
import plugin from '../src/cli';
import './helper';
Expand Down
1 change: 1 addition & 0 deletions packages/runtime/plugin-garfish/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
"react-dom": ">=17"
},
"devDependencies": {
"@rsbuild/shared": "0.4.3",
"@modern-js/app-tools": "workspace:*",
"@modern-js/core": "workspace:*",
"@modern-js/plugin-router-v5": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/runtime/plugin-garfish/tests/cli.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@testing-library/jest-dom';
import { manager, CliPlugin } from '@modern-js/core';
import WebpackChain from '@modern-js/utils/webpack-chain';
import { CHAIN_ID } from '@modern-js/utils';
import { CHAIN_ID } from '@rsbuild/shared';
import type { AppUserConfig } from '@modern-js/app-tools';
import { garfishPlugin, externals } from '../src/cli';
import type { UseConfig } from '../src/cli';
Expand Down
3 changes: 2 additions & 1 deletion packages/storybook/builder/src/docgen/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Options } from '@storybook/types';
import { CHAIN_ID, logger } from '@modern-js/utils';
import { logger } from '@modern-js/utils';
import { CHAIN_ID } from '@rsbuild/shared';
import type { RspackConfig, WebpackChain } from '@rsbuild/shared';

export type DocgenOptions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,3 @@ export const INTERNAL_SERVER_PLUGINS: InternalPlugins = {
[SERVER_PLUGIN_SERVER]: '@modern-js/plugin-server/server',
[SERVER_PLUGIN_POLYFILL]: '@modern-js/plugin-polyfill/server',
};

export * from './chainId';
201 changes: 0 additions & 201 deletions packages/toolkit/utils/src/cli/constants/chainId.ts

This file was deleted.

13 changes: 6 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion scripts/prebundle/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
"tsconfig-paths": "4.1.1",
"upath": "2.0.1",
"url-join": "4.0.1",
"v8-compile-cache": "2.3.0",
"webpack-chain": "npm:[email protected]"
}
}

0 comments on commit a3a788b

Please sign in to comment.