Skip to content

Commit

Permalink
support jsx (#80)
Browse files Browse the repository at this point in the history
* support jsx

* fix test
  • Loading branch information
chenshuai2144 authored Jan 20, 2021
1 parent 67bd15c commit 78ec0a1
Show file tree
Hide file tree
Showing 302 changed files with 5,664 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml → .github/workflows/jstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
run: npm install

- name: install
run: cd example && npm install
run: cd jsExample && npm install

- name: test
run: npm run test
run: npm run testJS
19 changes: 19 additions & 0 deletions .github/workflows/tstest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# @format

on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest

steps:
- name: checkout
uses: actions/checkout@master

- name: install
run: npm install

- name: install
run: cd tsExample && npm install

- name: test
run: npm run testTS
File renamed without changes.
8 changes: 8 additions & 0 deletions jsExample/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/lambda/
/scripts
/config
.history
public
dist
.umi
mock
11 changes: 11 additions & 0 deletions jsExample/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const path = require('path');

console.log(require.resolve(path.join(__dirname, '../', 'dist/eslint')));
module.exports = {
extends: [require.resolve(path.join(__dirname, '../', 'dist/eslint'))],
globals: {
ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: true,
REACT_APP_ENV: true,
page: true,
},
};
File renamed without changes.
23 changes: 23 additions & 0 deletions jsExample/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**/*.svg
package.json
.umi
.umi-production
/dist
.dockerignore
.DS_Store
.eslintignore
*.png
*.toml
docker
.editorconfig
Dockerfile*
.gitignore
.prettierignore
LICENSE
.eslintcache
*.lock
yarn-error.log
.history
CNAME
/build
/public
File renamed without changes.
File renamed without changes.
57 changes: 57 additions & 0 deletions jsExample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Ant Design Pro

This project is initialized with [Ant Design Pro](https://pro.ant.design). Follow is the quick guide for how to use.

## Environment Prepare

Install `node_modules`:

```bash
npm install
```

or

```bash
yarn
```

## Provided Scripts

Ant Design Pro provides some useful script to help you quick start and build with web project, code style check and test.

Scripts provided in `package.json`. It's safe to modify or add additional script:

### Start project

```bash
npm start
```

### Build project

```bash
npm run build
```

### Check code style

```bash
npm run lint
```

You can also use script to auto fix some lint error:

```bash
npm run lint:fix
```

### Test code

```bash
npm test
```

## More

You can view full document on our [official website](https://pro.ant.design). And welcome any feedback in our [github](https://github.com/ant-design/ant-design-pro).
15 changes: 15 additions & 0 deletions jsExample/config/config.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// https://umijs.org/config/
import { defineConfig } from 'umi';

export default defineConfig({
plugins: [
// https://github.com/zthxxx/react-dev-inspector
'react-dev-inspector/plugins/umi/react-inspector',
],
// https://github.com/zthxxx/react-dev-inspector#inspector-loader-props
inspectorConfig: {
exclude: [],
babelPlugins: [],
babelOptions: {},
},
});
43 changes: 43 additions & 0 deletions jsExample/config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// https://umijs.org/config/
import { defineConfig } from 'umi';
import defaultSettings from './defaultSettings';
import proxy from './proxy';
import routes from './routes';

const { REACT_APP_ENV } = process.env;
export default defineConfig({
hash: true,
antd: {},
dva: {
hmr: true,
},
history: {
type: 'browser',
},
locale: {
// default zh-CN
default: 'zh-CN',
antd: true,
// default true, when it is true, will use `navigator.language` overwrite default
baseNavigator: true,
},
dynamicImport: {
loading: '@/components/PageLoading/index',
},
targets: {
ie: 11,
},
// umi routes: https://umijs.org/docs/routing
routes,
// Theme for antd: https://ant.design/docs/react/customize-theme-cn
theme: {
'primary-color': defaultSettings.primaryColor,
},
title: false,
ignoreMomentLocale: true,
proxy: proxy[REACT_APP_ENV || 'dev'],
manifest: {
basePath: '/',
},
esbuild: {},
});
14 changes: 14 additions & 0 deletions jsExample/config/defaultSettings.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const proSettings = {
navTheme: 'dark',
// 拂晓蓝
primaryColor: '#1890ff',
layout: 'side',
contentWidth: 'Fluid',
fixedHeader: false,
fixSiderbar: true,
colorWeak: false,
title: 'Ant Design Pro',
pwa: false,
iconfontUrl: '',
};
export default proSettings;
36 changes: 36 additions & 0 deletions jsExample/config/proxy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* 在生产环境 代理是无法生效的,所以这里没有生产环境的配置
* The agent cannot take effect in the production environment
* so there is no configuration of the production environment
* For details, please see
* https://pro.ant.design/docs/deploy
*/
export default {
dev: {
'/api/': {
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: {
'^': '',
},
},
},
test: {
'/api/': {
target: 'https://preview.pro.ant.design',
changeOrigin: true,
pathRewrite: {
'^': '',
},
},
},
pre: {
'/api/': {
target: 'your pre url',
changeOrigin: true,
pathRewrite: {
'^': '',
},
},
},
};
73 changes: 73 additions & 0 deletions jsExample/config/routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
export default [
{
path: '/',
component: '../layouts/BlankLayout',
routes: [
{
path: '/user',
component: '../layouts/UserLayout',
routes: [
{
name: 'login',
path: '/user/login',
component: './User/login',
},
],
},
{
path: '/',
component: '../layouts/SecurityLayout',
routes: [
{
path: '/',
component: '../layouts/BasicLayout',
authority: ['admin', 'user'],
routes: [
{
path: '/',
redirect: '/welcome',
},
{
path: '/welcome',
name: 'welcome',
icon: 'smile',
component: './Welcome',
},
{
path: '/admin',
name: 'admin',
icon: 'crown',
component: './Admin',
authority: ['admin'],
routes: [
{
path: '/admin/sub-page',
name: 'sub-page',
icon: 'smile',
component: './Welcome',
authority: ['admin'],
},
],
},
{
name: 'list.table-list',
icon: 'table',
path: '/list',
component: './TableList',
},
{
component: './404',
},
],
},
{
component: './404',
},
],
},
],
},
{
component: './404',
},
];
Loading

0 comments on commit 78ec0a1

Please sign in to comment.