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

Feat optimize app template #1210

Merged
merged 6 commits into from
Aug 6, 2019
Merged
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
9 changes: 0 additions & 9 deletions packages/rax-cli/src/generator/app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ Open [http://localhost:9999](http://localhost:9999) to view it in the browser.

The page will reload if you make edits.

### `npm run lint`

You will see the lint errors in the console.

### `npm run build`

Builds the app for production to the `build` folder.


## Post-Processing CSS

You can customize your target support browsers by adjusting the `browserslist` key in `package.json` according to the [Browserslist specification](https://github.com/browserslist/browserslist#readme).
5 changes: 0 additions & 5 deletions packages/rax-cli/src/generator/app/_eslintignore

This file was deleted.

168 changes: 0 additions & 168 deletions packages/rax-cli/src/generator/app/_eslintrc.js

This file was deleted.

10 changes: 4 additions & 6 deletions packages/rax-cli/src/generator/app/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,20 @@
"driver-universal": "^1.0.1",
"history": "^4.9.0",
"rax": "^1.0.8",
"rax-image": "^1.0.3",
"rax-link": "^1.0.1",
<%_ if (projectTargets.includes('web')) { -%>
"rax-pwa": "^1.0.2",
<%_ } -%>
"rax-view": "^1.0.0",
"rax-text": "^1.0.0",
"rax-view": "^1.0.0",
"universal-app-runtime": "^0.1.3"
},
"devDependencies": {
<%_ if (projectFeatures.includes('ssr')) { -%>
"rax-plugin-ssr": "^0.0.0",
"rax-plugin-ssr": "^0.1.0",
<%_ } -%>
"babel-eslint": "^10.0.1",
"eslint": "^5.16.0",
"eslint-config-rax": "^0.0.0",
"eslint-plugin-import": "^2.17.2",
"eslint-plugin-react": "^7.12.4",
"rax-scripts": "^2.0.0-0",
"rax-plugin-app": "^0.1.0-1"
}
Expand Down
4 changes: 0 additions & 4 deletions packages/rax-cli/src/generator/app/src/app.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
import { createElement } from 'rax';
import { useAppEffect} from '@core/app';
import { useRouter } from '@core/router';

export default function App(props) {
const { routerConfig } = props;
useAppEffect('launch', (options) => {

});

const { Router } = useRouter(routerConfig);

Expand Down
28 changes: 28 additions & 0 deletions packages/rax-cli/src/generator/app/src/components/Main/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.home {
align-items: center;
margin-top: 30rpx;
}

.logo {
width: 200rpx;
height: 180rpx;
margin-bottom: 20rpx;
}

.title {
font-size: 45rpx;
font-weight: bold;
margin: 20rpx 0;
}

.box {
flex-direction: row;
}

.info {
font-size: 42rpx;
}

.btn {
margin-bottom: 20rpx;
}
39 changes: 39 additions & 0 deletions packages/rax-cli/src/generator/app/src/components/Main/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import './index.css';
import { createElement } from 'rax';
import View from 'rax-view';
import Text from 'rax-text';
import Link from 'rax-link';
import Image from 'rax-image';

export default (props) => {
return (
<View className="home">
<%_ if (!projectFeatures.includes('ssr')) { -%>
<Image
className="logo"
source={{
uri: '//gw.alicdn.com/tfs/TB1MRC_cvb2gK0jSZK9XXaEgFXa-1701-1535.png',
}}
/>
<%_ } -%>
<Text className="title">Welcome to Your Rax App</Text>

<Text className="info">More infomation about</Text>
<Text className="info">how to cutomize this project</Text>
<View className="box">
<Text className="info">check the</Text>
<Link className="info" href="https://rax.js.org" target="__blank">
Rax Documation
</Link>
</View>

<Text className="info">More about Rax</Text>
<View className="box">
<Text className="info">check the</Text>
<Link className="info" href="https://github.com/alibaba/rax" target="__blank">
Rax Gihub
</Link>
</View>
</View>
);
};

This file was deleted.

12 changes: 0 additions & 12 deletions packages/rax-cli/src/generator/app/src/components/Site/index.js

This file was deleted.

4 changes: 2 additions & 2 deletions packages/rax-cli/src/generator/app/src/document/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function Document(props) {
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<title>WebApp</title>
<title><%= projectName %></title>
</head>
<body>
{/* root container */}
Expand All @@ -34,7 +34,7 @@ function Document(props) {
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, minimum-scale=1, user-scalable=no" />
<title>WebApp</title>
<title><%= projectName %></title>
</head>
<body>
{/* root container */}
Expand Down
17 changes: 0 additions & 17 deletions packages/rax-cli/src/generator/app/src/pages/about/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/rax-cli/src/generator/app/src/pages/home/index.css

This file was deleted.

24 changes: 3 additions & 21 deletions packages/rax-cli/src/generator/app/src/pages/home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,9 @@
import './index.css';
import { createElement } from 'rax';
import { usePageEffect } from '@core/page';
// app should use Link in @core/router rather than rax-link
import { push, Link } from '@core/router';
import Text from 'rax-text';
import View from 'rax-view';

export default function Home() {
usePageEffect('show', () => {

});

usePageEffect('hide', () => {

});
import Main from '../../components/Main';

export default function Home() {
return (
<View className="home">
<Text>hello, world</Text>
<Link to="/about">Link to about</Link>
<View onClick={() => push('/about')}>
<Text>Push to about</Text>
</View>
</View>
<Main />
);
}
1 change: 1 addition & 0 deletions packages/rax-plugin-app/src/config/babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const config = {
]
],
plugins: [
require.resolve('babel-plugin-transform-jsx-stylesheet'),
[
require.resolve('@babel/plugin-transform-runtime'),
{
Expand Down
Loading