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

chore: use process.env.ssr_manifest and dangersetinscript #12367

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"workspaces": ["packages/*"]
}
2 changes: 1 addition & 1 deletion packages/ast/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/ast",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/ast",
"homepage": "https://github.com/umijs/umi/tree/master/packages/ast#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-umi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/babel-preset-umi",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "Official babel preset for umi.",
"homepage": "https://github.com/umijs/umi/tree/master/packages/babel-preset-umi#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-esbuild/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-esbuild",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/bundler-esbuild",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-esbuild#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-utils",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-utils#readme",
"bugs": "https://github.com/umijs/umi/issues",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-vite",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/bundler-vite",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-vite#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler-webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/bundler-webpack",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/bundler-webpack",
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/core",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"homepage": "https://github.com/umijs/umi/tree/master/packages/core#readme",
"bugs": "https://github.com/umijs/umi/issues",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-umi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-umi",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "create-umi",
"homepage": "https://github.com/umijs/umi/tree/master/packages/create-umi#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/lint/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/lint",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/lint",
"homepage": "https://github.com/umijs/umi/tree/master/packages/lint#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/max/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/max",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/max",
"homepage": "https://github.com/umijs/umi/tree/master/packages/max#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/mfsu/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/mfsu",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/mfsu",
"homepage": "https://github.com/umijs/umi/tree/master/packages/mfsu#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-docs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/plugin-docs",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/plugin-docs",
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugin-docs#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-run/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/plugin-run",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/plugin-run",
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugin-run#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/plugins",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/plugins",
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-umi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/preset-umi",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/preset-umi",
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
9 changes: 5 additions & 4 deletions packages/preset-umi/templates/server.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ const routesWithServerLoader = {

export function getManifest(sourceDir) {
let manifestPath;
if (process.env.SSR_RESOURCE_DIR) {
manifestPath = path.join(process.env.SSR_RESOURCE_DIR,'build-manifest.json')
} else if (sourceDir) {
if (process.env.MANIFEST) {
return JSON.parse(process.env.MANIFEST)
}
if (sourceDir) {
manifestPath = path.join(sourceDir,'build-manifest.json')
}
else {
manifestPath = '{{{ assetsPath }}}'
}
}

return JSON.parse(fs.readFileSync(manifestPath), 'utf-8');
}
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/preset-vue",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/preset-vue",
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-vue#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/renderer-react",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/renderer-react",
"homepage": "https://github.com/umijs/umi/tree/master/packages/renderer-react#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
10 changes: 7 additions & 3 deletions packages/renderer-react/src/html.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,13 @@ const HydrateMetadata = (props: IHtmlProps) => {
{htmlPageOpts?.headScripts?.map((script: IScript, key: number) => {
const { content, ...rest } = normalizeScripts(script);
return (
<script key={key} {...(rest as any)}>
{content}
</script>
<script
dangerouslySetInnerHTML={{
__html: content,
}}
key={key}
{...(rest as any)}
/>
);
})}
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/renderer-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/renderer-vue",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/renderer-vue",
"homepage": "https://github.com/umijs/umi/tree/master/packages/renderer-vue#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/server",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/server",
"homepage": "https://github.com/umijs/umi/tree/master/packages/server#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
4 changes: 3 additions & 1 deletion packages/server/src/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,9 @@ export default function createRequestHandler(
const stream = await ReactDomServer.renderToReadableStream(
React.createElement(JSXProvider, undefined, jsx.element),
{
bootstrapScripts: [jsx.manifest.assets['umi.js'] || '/umi.js'],
// why not bootstrap umi.js?
// ER will auto inject umi.js
// bootstrapScripts: [jsx.manifest.assets['umi.js'] || '/umi.js'],
onError(x: any) {
console.error(x);
},
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/test",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/test",
"homepage": "https://github.com/umijs/umi/tree/master/packages/testing#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/umi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "umi",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "umi",
"homepage": "https://github.com/umijs/umi/tree/master/packages/umi#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/utils",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"homepage": "https://github.com/umijs/umi/tree/master/packages/utils#readme",
"bugs": "https://github.com/umijs/umi/issues",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/zod2ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@umijs/zod2ts",
"version": "4.0.0-canary.20240402.1",
"version": "4.0.0-canary.20240509.1",
"description": "@umijs/zod2ts",
"homepage": "https://github.com/umijs/umi/tree/master/packages/zod2ts#readme",
"bugs": "https://github.com/umijs/umi/issues",
Expand Down
4 changes: 2 additions & 2 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

// check git status
logger.event('check git status');
const isGitClean = (await $`git status --porcelain`).stdout.trim().length;

Check failure on line 18 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

'isGitClean' is declared but its value is never read.

Check failure on line 18 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

'isGitClean' is declared but its value is never read.

Check failure on line 18 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

'isGitClean' is declared but its value is never read.

Check failure on line 18 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

'isGitClean' is declared but its value is never read.

Check failure on line 18 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (18.x, windows-latest)

'isGitClean' is declared but its value is never read.
assert(!isGitClean, 'git status is not clean');
// assert(!isGitClean, 'git status is not clean');

// check git remote update
logger.event('check git remote update');
Expand All @@ -34,8 +34,8 @@

// check package changed
logger.event('check package changed');
const changed = (await $`lerna changed --loglevel error`).stdout.trim();

Check failure on line 37 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

'changed' is declared but its value is never read.

Check failure on line 37 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (16.x, ubuntu-latest)

'changed' is declared but its value is never read.

Check failure on line 37 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (16.x, windows-latest)

'changed' is declared but its value is never read.

Check failure on line 37 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (18.x, ubuntu-latest)

'changed' is declared but its value is never read.

Check failure on line 37 in scripts/release.ts

View workflow job for this annotation

GitHub Actions / build (18.x, windows-latest)

'changed' is declared but its value is never read.
assert(changed, `no package is changed`);
// assert(changed, `no package is changed`);

// check npm ownership
logger.event('check npm ownership');
Expand Down
Loading