-
-
Notifications
You must be signed in to change notification settings - Fork 268
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
324 changed files
with
13,605 additions
and
1,537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: E2E Test for ModernJS SSR | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
e2e-modern: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Install Pnpm | ||
run: corepack enable | ||
|
||
- name: Setup Node.js 18 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18' | ||
cache: 'pnpm' | ||
|
||
- name: Set Nx SHA | ||
uses: nrwl/nx-set-shas@v3 | ||
|
||
- name: Set SKIP_DEVTOOLS_POSTINSTALL environment variable | ||
run: echo "SKIP_DEVTOOLS_POSTINSTALL=true" >> $GITHUB_ENV | ||
|
||
- name: Install Dependencies | ||
run: pnpm install | ||
|
||
- name: Install Cypress | ||
run: npx cypress install | ||
|
||
- name: Run Build for All | ||
run: npx nx run-many --targets=build --projects=tag:type:pkg | ||
|
||
- name: Run condition check script | ||
id: check-ci | ||
run: node tools/scripts/ci-is-affected.mjs --appName=modernjs | ||
|
||
- name: E2E Test for Modern.js SSR | ||
if: steps.check-ci.outcome == 'success' | ||
run: | | ||
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs -r kill && | ||
pnpm run app:modern:dev & | ||
sleep 1 && | ||
npx wait-on http://127.0.0.1:3050/ && | ||
npx wait-on http://127.0.0.1:3051/ && | ||
npx wait-on http://127.0.0.1:3052/ && | ||
npx wait-on http://127.0.0.1:3053/ && | ||
npx wait-on http://127.0.0.1:3054/ && | ||
npx wait-on http://127.0.0.1:3055/ && | ||
npx wait-on http://127.0.0.1:3056/ && | ||
npx nx run modernjs-ssr-host:e2e && | ||
lsof -ti tcp:3050,3051,3052,3053,3054,3055,3056 | xargs kill |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# modernjs-ssr | ||
|
||
## Running Demo | ||
|
||
- host: [localhost:3050](http://localhost:3050/) | ||
- remote: [localhost:3051](http://localhost:3051/) | ||
- nested-remote: [localhost:3052](http://localhost:3052/) | ||
- dynamic-remote: [localhost:3053](http://localhost:3053/) | ||
- dynamic-nested-remote: [localhost:3054](http://localhost:3054/) | ||
- remote-new-version: [localhost:3055](http://localhost:3055/) | ||
- dynamic-remote-new-version: [localhost:3056](http://localhost:3056/) | ||
|
||
## How to start the demos ? | ||
|
||
```bash | ||
# Root directory | ||
pnpm i | ||
|
||
nx build modern-js-plugin | ||
|
||
pnpm run app:modern:dev | ||
|
||
open http://localhost:3050/ | ||
``` |
2 changes: 2 additions & 0 deletions
2
apps/modernjs-ssr/dynamic-nested-remote/@mf-types/dynamic_remote/Image.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './compiled-types/Image'; | ||
export { default } from './compiled-types/Image'; |
4 changes: 4 additions & 0 deletions
4
apps/modernjs-ssr/dynamic-nested-remote/@mf-types/dynamic_remote/compiled-types/Image.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
declare const _default: ({ text }: { | ||
text: string; | ||
}) => JSX.Element; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# modernjs-ssr-dynamic-nested-remote | ||
|
||
## 0.1.13 | ||
|
||
### Patch Changes | ||
|
||
- @module-federation/modern-js@0.3.1 | ||
|
||
## 0.1.12 | ||
|
||
### Patch Changes | ||
|
||
- Updated dependencies [fa37cc4] | ||
- @module-federation/modern-js@0.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { appTools, defineConfig } from '@modern-js/app-tools'; | ||
import { moduleFederationPlugin } from '@module-federation/modern-js'; | ||
|
||
// https://modernjs.dev/en/configure/app/usage | ||
export default defineConfig({ | ||
dev: { | ||
port: 3054, | ||
}, | ||
runtime: { | ||
router: true, | ||
}, | ||
server: { | ||
ssr: { | ||
mode: 'stream', | ||
}, | ||
port: 3054, | ||
}, | ||
plugins: [appTools(), moduleFederationPlugin()], | ||
}); |
12 changes: 12 additions & 0 deletions
12
apps/modernjs-ssr/dynamic-nested-remote/module-federation.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { createModuleFederationConfig } from '@module-federation/modern-js'; | ||
export default createModuleFederationConfig({ | ||
name: 'dynamic_nested_remote', | ||
filename: 'remoteEntry.js', | ||
exposes: { | ||
'./Content': './src/components/Content.tsx', | ||
}, | ||
shared: { | ||
react: { singleton: true }, | ||
'react-dom': { singleton: true }, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"name": "modernjs-ssr-dynamic-nested-remote", | ||
"private": true, | ||
"version": "0.1.13", | ||
"scripts": { | ||
"reset": "npx rimraf ./**/node_modules", | ||
"dev": "modern dev", | ||
"build": "modern build", | ||
"start": "FEDERATION_DEBUG=true modern start", | ||
"serve": "modern serve", | ||
"new": "modern new", | ||
"lint": "modern lint", | ||
"upgrade": "modern upgrade" | ||
}, | ||
"engines": { | ||
"node": ">=16.18.1" | ||
}, | ||
"lint-staged": { | ||
"*.{js,jsx,ts,tsx,mjs,cjs}": [ | ||
"node --max_old_space_size=8192 ./node_modules/eslint/bin/eslint.js --fix --color --cache --quiet" | ||
] | ||
}, | ||
"eslintIgnore": [ | ||
"node_modules/", | ||
"dist/" | ||
], | ||
"dependencies": { | ||
"@modern-js/runtime": "2.56.1", | ||
"react": "~18.2.0", | ||
"react-dom": "~18.2.0", | ||
"@module-federation/modern-js": "workspace:*", | ||
"@babel/runtime": "7.24.4", | ||
"antd": "4.24.15" | ||
}, | ||
"devDependencies": { | ||
"@modern-js/app-tools": "2.56.1", | ||
"@modern-js/eslint-config": "2.56.1", | ||
"@modern-js/tsconfig": "2.56.1", | ||
"@modern-js-app/eslint-config": "2.56.1", | ||
"typescript": "~5.0.4", | ||
"@types/jest": "~29.5.0", | ||
"@types/node": "~16.11.7", | ||
"@types/react": "~18.2.0", | ||
"@types/react-dom": "~18.2.0", | ||
"lint-staged": "~13.1.0", | ||
"prettier": "~2.8.1", | ||
"rimraf": "~3.0.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"name": "modernjs-ssr-dynamic-nested-remote", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "apps/modernjs-ssr/modernjs-ssr-dynamic-nested-remote/src", | ||
"projectType": "application", | ||
"targets": { | ||
"build": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"dependsOn": [ | ||
{ | ||
"target": "build", | ||
"dependencies": true | ||
} | ||
], | ||
"commands": [ | ||
{ | ||
"command": "cd apps/modernjs-ssr/dynamic-nested-remote; pnpm run build", | ||
"forwardAllArgs": true | ||
} | ||
] | ||
} | ||
}, | ||
"serve": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"dependsOn": [ | ||
{ | ||
"target": "build", | ||
"dependencies": true | ||
} | ||
], | ||
"commands": [ | ||
{ | ||
"command": "cd apps/modernjs-ssr/dynamic-nested-remote; pnpm run dev", | ||
"forwardAllArgs": false | ||
} | ||
] | ||
} | ||
}, | ||
"e2e": { | ||
"executor": "@nx/cypress:cypress", | ||
"options": { | ||
"cypressConfig": "apps/modernjs-ssr/modernjs-ssr-dynamic-nested-remote/cypress.config.ts", | ||
"testingType": "e2e", | ||
"baseUrl": "http://localhost:4001", | ||
"browser": "chrome" | ||
}, | ||
"configurations": { | ||
"development": { | ||
"runnerUi": true, | ||
"browser": "electron", | ||
"exit": false, | ||
"watch": true | ||
} | ||
} | ||
}, | ||
"test:e2e": { | ||
"executor": "nx:run-commands", | ||
"options": { | ||
"parallel": true, | ||
"commands": [ | ||
{ | ||
"command": "lsof -i :8080 || nx run modernjs-ssr-dynamic-nested-remote:serve & echo 'done'", | ||
"forwardAllArgs": false | ||
}, | ||
{ | ||
"command": "sleep 20 && nx run modernjs-ssr-dynamic-nested-remote:e2e", | ||
"forwardAllArgs": true | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"tags": [], | ||
"implicitDependencies": ["typescript"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// eslint-disable-next-line import/no-commonjs | ||
module.exports = { | ||
root: true, | ||
extends: ['@modern-js-app'], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: ['../tsconfig.json'], | ||
}, | ||
}; |
10 changes: 10 additions & 0 deletions
10
apps/modernjs-ssr/dynamic-nested-remote/src/components/Button.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import Button from 'antd/lib/button'; | ||
|
||
export default (): JSX.Element => ( | ||
<div className="testlll"> | ||
<Button onClick={() => alert('Client side Javascript works!')}> | ||
This button will appear after 1000ms | ||
</Button> | ||
</div> | ||
); |
10 changes: 10 additions & 0 deletions
10
apps/modernjs-ssr/dynamic-nested-remote/src/components/Button2.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import React from 'react'; | ||
import Button from 'antd/lib/button'; | ||
|
||
export default (): JSX.Element => ( | ||
<div className="testlll"> | ||
<Button onClick={() => alert('Client side Javascript works!')}> | ||
This button will appear after 2000ms | ||
</Button> | ||
</div> | ||
); |
Oops, something went wrong.