Skip to content

Commit

Permalink
chore: publint CI (#3353)
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy authored Jan 1, 2025
1 parent 60a4b28 commit eda5184
Show file tree
Hide file tree
Showing 18 changed files with 376 additions and 243 deletions.
7 changes: 7 additions & 0 deletions .changeset/ai-hungry-cat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@module-federation/enhanced": patch
---

Reordered the "import" and "require" fields in export mappings for consistency.

```
87 changes: 73 additions & 14 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,75 @@
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
./tmp
./scripts
./.git
packages/storybook-addon
packages/core
packages/utilities
packages/typescript
# Cache and temporary files
**/.cache/
**/.temp/
**/coverage/
**/dist/

# Documentation and config files
**/*.md
**/*.yaml
**/*.yml
**/.eslintrc*
**/.prettierrc*
**/.swcrc
**/jest.config.*
**/tsconfig.*
**/*/stats.json

# First ignore everything
*

# Then allow specific packages and their contents
!packages/webpack-bundler-runtime/
!packages/webpack-bundler-runtime/**/*
!packages/sdk/
!packages/sdk/**/*
!packages/enhanced/
!packages/enhanced/**/*

# Allow package.json files
!package.json
!packages/*/package.json
!**/package.json

# Explicitly ignore specific packages
packages/dts-plugin/
packages/typescript/
packages/native-*
apps
**/configCases
**/dist
apps/**
*.snap
*.js
packages/core/
packages/assemble-release-plan/
packages/native-federation-typescript/
packages/esbuild/

# Ignore specific directories
apps/
webpack/tooling/
webpack/setup/
webpack/test/
webpack/benchmark/
tools/
.husky/
.github/
.vscode/
.verdaccio/

# Ignore specific files
.cursorignore
jest.preset.js
babel.config.json
nx.json
LICENSE
.nxignore
netlify.toml
renovate.json
.npmrc
.cursorrules
.prettierignore
.editorconfig
ai-lint-fix.js
manifest.json
typedoc.json
typedoc.base.json
commitlint.config.js
.eslintignore
commit-gen.js
main.py
14 changes: 14 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ jobs:
- name: Run Build for All
run: npx nx run-many --targets=build --projects=tag:type:pkg --skip-nx-cache

- name: Check Package Publishing Compatibility
run: |
for pkg in packages/*; do
if [ -f "$pkg/package.json" ] && \
[ "$pkg" != "packages/assemble-release-plan" ] && \
[ "$pkg" != "packages/chrome-devtools" ] && \
[ "$pkg" != "packages/core" ] && \
[ "$pkg" != "packages/esbuild" ] && \
[ "$pkg" != "packages/utilities" ]; then
echo "Checking $pkg..."
npx publint "$pkg"
fi
done
- name: Run Affected Test
uses: nick-fields/retry@v3
with:
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@
"postcss-url": "10.1.3",
"prettier": "3.3.3",
"prettier-eslint": "16.3.0",
"publint": "^0.2.12",
"react-refresh": "0.14.2",
"rimraf": "^3.0.2",
"rollup-plugin-copy": "3.5.0",
Expand Down
27 changes: 16 additions & 11 deletions packages/data-prefetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,36 @@
"publishConfig": {
"access": "public"
},
"files": [
"dist",
"README.md",
"LICENSE"
],
"exports": {
".": {
"types": "./dist/index.cjs.d.ts",
"import": "./dist/index.esm.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.cjs.d.ts"
"require": "./dist/index.cjs.js"
},
"./react": {
"types": "./dist/react.cjs.d.ts",
"import": "./dist/react.esm.mjs",
"require": "./dist/react.cjs.js",
"types": "./dist/react.cjs.d.ts"
"require": "./dist/react.cjs.js"
},
"./cli": {
"types": "./dist/cli.cjs.d.ts",
"import": "./dist/cli.esm.mjs",
"require": "./dist/cli.cjs.js",
"types": "./dist/cli.cjs.d.ts"
"require": "./dist/cli.cjs.js"
},
"./babel-plugin": {
"types": "./dist/babel.cjs.d.ts",
"import": "./dist/babel.esm.mjs",
"require": "./dist/babel.cjs.js",
"types": "./dist/babel.cjs.d.ts"
"require": "./dist/babel.cjs.js"
},
"./universal": {
"types": "./dist/universal.cjs.d.ts",
"import": "./dist/universal.esm.mjs",
"require": "./dist/universal.cjs.js",
"types": "./dist/universal.cjs.d.ts"
"require": "./dist/universal.cjs.js"
}
},
"typesVersions": {
Expand All @@ -62,7 +67,7 @@
]
}
},
"main": "dist/index.cjs",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.mjs",
"peerDependencies": {
"react": ">=16.9.0",
Expand Down
20 changes: 10 additions & 10 deletions packages/enhanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,28 +35,28 @@
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"require": "./dist/src/index.js",
"import": "./dist/src/index.js"
"import": "./dist/src/index.js",
"require": "./dist/src/index.js"
},
"./webpack": {
"types": "./dist/src/webpack.d.ts",
"require": "./dist/src/webpack.js",
"import": "./dist/src/webpack.js"
"import": "./dist/src/webpack.js",
"require": "./dist/src/webpack.js"
},
"./rspack": {
"types": "./dist/src/rspack.d.ts",
"require": "./dist/src/rspack.js",
"import": "./dist/src/rspack.js"
"import": "./dist/src/rspack.js",
"require": "./dist/src/rspack.js"
},
"./runtime": {
"types": "./dist/src/runtime.d.ts",
"require": "./dist/src/runtime.js",
"import": "./dist/src/runtime.js"
"import": "./dist/src/runtime.js",
"require": "./dist/src/runtime.js"
},
"./prefetch": {
"types": "./dist/src/prefetch.d.ts",
"require": "./dist/src/prefetch.js",
"import": "./dist/src/prefetch.js"
"import": "./dist/src/prefetch.js",
"require": "./dist/src/prefetch.js"
}
},
"typesVersions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/managers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
},
"exports": {
".": {
"types": "./dist/index.cjs.d.ts",
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"types": "./dist/index.cjs.d.ts"
"require": "./dist/index.cjs.js"
}
},
"typesVersions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/manifest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
},
"exports": {
".": {
"types": "./dist/index.cjs.d.ts",
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"types": "./dist/index.cjs.d.ts"
"require": "./dist/index.cjs.js"
}
},
"typesVersions": {
Expand Down
24 changes: 12 additions & 12 deletions packages/modernjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
},
"exports": {
".": {
"types": "./dist/types/cli/index.d.ts",
"import": "./dist/esm/cli/index.js",
"require": "./dist/cjs/cli/index.js",
"types": "./dist/types/cli/index.d.ts"
"require": "./dist/cjs/cli/index.js"
},
"./runtime": {
"types": "./dist/types/runtime/index.d.ts",
Expand All @@ -32,29 +32,29 @@
"default": "./dist/esm/ssr-runtime/index.js"
},
"./config-plugin": {
"types": "./dist/types/cli/configPlugin.d.ts",
"import": "./dist/esm/cli/configPlugin.js",
"require": "./dist/cjs/cli/configPlugin.js",
"types": "./dist/types/cli/configPlugin.d.ts"
"require": "./dist/cjs/cli/configPlugin.js"
},
"./ssr-plugin": {
"types": "./dist/types/cli/ssrPlugin.d.ts",
"import": "./dist/esm/cli/ssrPlugin.js",
"require": "./dist/cjs/cli/ssrPlugin.js",
"types": "./dist/types/cli/ssrPlugin.d.ts"
"require": "./dist/cjs/cli/ssrPlugin.js"
},
"./shared-strategy": {
"types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts",
"import": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js",
"require": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js",
"types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts"
"require": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js"
},
"./resolve-entry-ipv4": {
"types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts",
"import": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js",
"require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js",
"types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts"
"require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js"
},
"./inject-node-fetch": {
"types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts",
"import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
"require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
"types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
"require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js"
}
},
"typesVersions": {
Expand Down
4 changes: 2 additions & 2 deletions packages/native-federation-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
],
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"require": "./dist/index.js"
},
"./rollup": {
"types": "./dist/rollup.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/native-federation-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
},
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
"require": "./dist/index.js"
},
"./rollup": {
"types": "./dist/rollup.d.ts",
Expand Down
1 change: 0 additions & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"import": "./dist/src/utils/index.js",
"require": "./dist/src/utils/index.js"
},
"./src/plugins/RemotePublicPathPlugin.js": "./dist/src/plugins/RemotePublicPathPlugin.js",
"./src/plugins/NodeFederationPlugin.js": "./dist/src/plugins/NodeFederationPlugin.js",
"./universe-entry-chunk-tracker-plugin": "./dist/src/plugins/UniverseEntryChunkTrackerPlugin.js",
"./src/": "./dist/src/"
Expand Down
8 changes: 4 additions & 4 deletions packages/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"author": "hanric <hanric.zhang@gmail.com>",
"sideEffects": false,
"main": "./dist/index.cjs.js",
"module": "./dist/index.esm.js",
"module": "./dist/index.esm.mjs",
"types": "./dist/index.cjs.d.ts",
"dependencies": {
"@module-federation/bridge-react-webpack-plugin": "workspace:*",
Expand All @@ -37,9 +37,9 @@
},
"exports": {
".": {
"import": "./dist/index.esm.js",
"require": "./dist/index.cjs.js",
"types": "./dist/index.cjs.d.ts"
"types": "./dist/index.cjs.d.ts",
"import": "./dist/index.esm.mjs",
"require": "./dist/index.cjs.js"
},
"./plugin": {
"types": "./dist/plugin.cjs.d.ts",
Expand Down
29 changes: 29 additions & 0 deletions packages/rspack/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,35 @@ module.exports = (rollupConfig, projectOptions) => {
process.cwd(),
'./packages/rspack/src/ModuleFederationPlugin.ts',
);

if (Array.isArray(rollupConfig.output)) {
rollupConfig.output = rollupConfig.output.map((c) => ({
...c,
hoistTransitiveImports: false,
entryFileNames:
c.format === 'esm'
? c.entryFileNames.replace('.js', '.mjs')
: c.entryFileNames,
chunkFileNames:
c.format === 'esm'
? c.chunkFileNames.replace('.js', '.mjs')
: c.chunkFileNames,
}));
} else {
rollupConfig.output = {
...rollupConfig.output,
hoistTransitiveImports: false,
entryFileNames:
rollupConfig.output.format === 'esm'
? rollupConfig.output.entryFileNames.replace('.js', '.mjs')
: rollupConfig.output.entryFileNames,
chunkFileNames:
rollupConfig.output.format === 'esm'
? rollupConfig.output.chunkFileNames.replace('.js', '.mjs')
: rollupConfig.output.chunkFileNames,
};
}

rollupConfig.plugins.push(
replace({
__VERSION__: JSON.stringify(pkg.version),
Expand Down
Loading

0 comments on commit eda5184

Please sign in to comment.