Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
feat: 一大波更新 (#1366)
Browse files Browse the repository at this point in the history
- 真正的「混合开发」,React 代码会跟小程序代码一起构建, close #1153 
- Web 端的的多页模式
- 支持小程序插件开发,close #705 
- 集成 redbox-react,close #1077
  • Loading branch information
yesmeck committed Nov 24, 2020
1 parent 4cb412e commit 45dab88
Show file tree
Hide file tree
Showing 1,581 changed files with 72,138 additions and 104,979 deletions.
28 changes: 18 additions & 10 deletions .codesandbox/ci.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
{
"installCommand": "install:codesandbox",
"packages": [
"packages/remax-types",
"packages/remax-macro",
"packages/remax-ali",
"packages/remax-wechat",
"packages/remax-toutiao",
"packages/remax-router",
"packages/remax-web",
"packages/remax-one",
"packages/babel-plugin-remax-host-component",
"packages/babel-plugin-remax-lifecycle",
"packages/babel-plugin-remax-regenerator-runtime",
"packages/babel-plugin-remax-turbo-render",
"packages/babel-preset-remax",
"packages/postcss-remax-tag",
"packages/remax",
"packages/remax-ali",
"packages/remax-build-store",
"packages/remax-cli",
"packages/remax-framework-shared",
"packages/remax-macro",
"packages/remax-one",
"packages/remax-plugin-devtools",
"packages/remax-plugin-error-screen",
"packages/remax-runtime",
"packages/postcss-remax-tag",
"packages/remax-cli"
"packages/remax-shared",
"packages/remax-toutiao",
"packages/remax-types",
"packages/remax-web",
"packages/remax-wechat"
],
"sandboxes": ["github/remaxjs/examples/tree/master/one"]
}
32 changes: 32 additions & 0 deletions .github/workflows/e2e-web-mpa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: E2E web mpa

on:
push:
branches: [master]
pull_request:
types: [opened, synchronize]

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [14.x]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: yarn install --frozen-lockfile
- name: build
run: yarn build
- name: e2e
run: yarn test:e2e-web
env:
CI: true
MPA: true
31 changes: 31 additions & 0 deletions .github/workflows/e2e-web-spa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: E2E web spa

on:
push:
branches: [master]
pull_request:
types: [opened, synchronize]

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [14.x]
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: install
run: yarn install --frozen-lockfile
- name: build
run: yarn build
- name: e2e
run: yarn test:e2e-web
env:
CI: true
4 changes: 0 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ jobs:
run: yarn test:cov
env:
CI: true
- name: e2e
run: yarn test:e2e
env:
CI: true
- name: Upload coverage to Codecov
if: success() && runner.os == 'Linux'
run: curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN
Expand Down
9 changes: 9 additions & 0 deletions e2e/app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dist/
yarn-error.log
yarn.lock
.tea
.vscode
.DS_Store
!src/node_modules
build/
miniapptools_dist/
4 changes: 4 additions & 0 deletions e2e/app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
1 change: 1 addition & 0 deletions e2e/app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Remax E2E test
11 changes: 11 additions & 0 deletions e2e/app/jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
launch: {
headless: process.env.HEADLESS !== 'false',
},
server: {
debug: true,
command: 'npm run serve',
port: 5678,
launchTimeout: 60000,
},
};
3 changes: 3 additions & 0 deletions e2e/app/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
preset: './tests/preset.js',
};
19 changes: 19 additions & 0 deletions e2e/app/mini.project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"miniprogramRoot": "build/src",
"scripts": {
"watch": "npm run watch:mini",
"beforePreview": "npm run build",
"beforeUpload": "npm run build"
},
"exclude": [
"src/**",
"node_modules",
"node_modules/**",
"babel.config.js",
"package-lock.json",
"package.json",
"remax.config.js",
"app.json",
"miniapptools_dist/**/*"
]
}
50 changes: 50 additions & 0 deletions e2e/app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "e2e-app",
"private": true,
"version": "1.1.0",
"description": "intergration tests for Remax",
"main": "index.js",
"keywords": [],
"author": "Wei Zhu <[email protected]>",
"license": "MIT",
"scripts": {
"watch:mini": "remax build -w",
"dev:mini": " mini build -w ./",
"dev:web": "remax build -w -t web",
"dev:web:mpa": "MPA=1 remax build -w -t web",
"clean": "rimraf dist",
"build": "./scripts/build.sh",
"serve": "http-server ./dist/webng --cors --port=5678 -s",
"pretest": "npm run build",
"test": "jest",
"test:mini": "TEST_TARGET=mini npm run test",
"test:web": "TEST_TARGET=web npm run test"
},
"dependencies": {
"remax": "^2.8.8",
"@remax/plugin-less": "^1.0.0",
"clsx": "^1.0.4",
"mini-antui": "^0.4.34",
"react": "^16.8.6"
},
"devDependencies": {
"@types/expect-puppeteer": "^4.4.0",
"@types/jest": "^25.2.3",
"@types/puppeteer": "^2.0.0",
"@types/react": "^16.9.1",
"cross-env": "^6.0.3",
"http-server": "^0.12.3",
"jest": "^24.9.0",
"jest-puppeteer": "^4.4.0",
"merge": "^1.2.1",
"rimraf": "^2.6.3",
"ts-jest": "^24.1.0",
"typescript": "^3.7.2"
},
"workspaces": {
"nohoist": [
"mini-antui",
"react"
]
}
}
16 changes: 16 additions & 0 deletions e2e/app/remax.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const path = require('path');
const less = require('@remax/plugin-less');

module.exports = {
output: process.env.REMAX_PLATFORM === 'web' ? 'dist/webng' : 'build/src',
plugins: [less()],
configWebpack({ config }) {
if (process.env.REMAX_PLATFORM === 'web') {
config.output.publicPath('/');
}
},
turboRenders: !!process.env.TURBO_RENDERS,
web: {
mpa: !!process.env.MPA,
},
};
13 changes: 13 additions & 0 deletions e2e/app/scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -x

if [ -z "$SKIP_BUILD" ]; then
npm run clean

if [ "$TEST_TARGET" = "web" ]; then
npx remax build -t web
else
npx remax build && cd build && cube build --webng=appxng --native=false --appxcompatible && mv dist ..
fi
fi
5 changes: 5 additions & 0 deletions e2e/app/src/GlobalContext.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import * as React from 'react';

export const GlobalContext = React.createContext({
name: '',
});
4 changes: 4 additions & 0 deletions e2e/app/src/_error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as React from 'react';
import { View } from 'remax/one';

export default () => <View>custom error</View>;
80 changes: 80 additions & 0 deletions e2e/app/src/app.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
const pages = [
'pages/index/index',
'pages/error/index',
'pages/lifecycle/index',
'pages/image/index',
'pages/query/index',
'pages/navigate/one/index',
'pages/navigate/two/index',
];

if (process.env.REMAX_PLATFORM === 'ali') {
pages.push(
...[
'pages/native-component/index',
'pages/native-component/module',
'pages/native-component/commonChunk1',
'pages/native-component/commonChunk2',
'pages/turbo-page/index',
'pages/insert-before/index',
'pages/hybrid/index',
]
);
}

module.exports.ali = {
pages,
window: {
defaultTitle: 'Test App',
titleBarColor: '#323239',
},
subPackages: [
{
root: 'packageA',
pages: ['pages/index'],
},
],
tabBar: {
textColor: '#ffffff',
selectedColor: '#000000',
backgroundColor: '#212121',
items: [
{
pagePath: 'pages/index/index',
name: '首页',
icon: './assets/images/cat.jpg',
activeIcon: './assets/images/dog.jpg',
},
{
pagePath: 'packageA/pages/index',
name: '其他',
icon: './assets/images/cat.jpg',
activeIcon: './assets/images/dog.jpg',
},
],
},
};

module.exports.web = {
pages,
title: 'Remax Web Template',
tabBar: {
backgroundColor: '#fff',
activeTitleColor: 'red',
titleColor: 'blue',
items: [
{
url: 'pages/index/index',
title: '首页',
image: './assets/images/cat.jpg',
activeImage: './assets/images/dog.jpg',
},
{
url: 'packageA/pages/index',
title: '其他',
image: './assets/images/cat.jpg',
activeImage: './assets/images/dog.jpg',
},
],
},
};
16 changes: 16 additions & 0 deletions e2e/app/src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from 'react';
import { useAppEvent } from 'remax/macro';
import { GlobalContext } from './GlobalContext';

const App = props => {
const [name, setName] = React.useState('');

useAppEvent('onLaunch', () => {
console.log('launch');
setName('launch');
});

return <GlobalContext.Provider value={{ name }}>{props.children}</GlobalContext.Provider>;
};

export default App;
File renamed without changes
File renamed without changes
1 change: 1 addition & 0 deletions e2e/app/src/components/a/index.axml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<view id="a" class="{{className}}">a</view>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 8 additions & 0 deletions e2e/app/src/node_modules/empty/index.js

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

Loading

1 comment on commit 45dab88

@vercel
Copy link

@vercel vercel bot commented on 45dab88 Nov 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.