Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
4cbcad2
Update README.md
nankaNULL Mar 25, 2019
f0c9c6b
启用代理
nankaNULL May 8, 2019
73259d0
dev&prod环境下配置修改调试
nankaNULL May 9, 2019
e6dcbe5
dev环境下启用redux devTools
nankaNULL May 9, 2019
60bd465
webpack配置修改
nankaNULL May 9, 2019
713ec9f
配置文档
nankaNULL May 9, 2019
60c5d7d
rename
nankaNULL May 9, 2019
0f50a75
配置更改
nankaNULL May 9, 2019
8a9409f
ico
nankaNULL May 9, 2019
86512cb
外部扩展
nankaNULL May 9, 2019
40e2819
重定向
nankaNULL May 9, 2019
abdaf53
webpack配置文档更新
nankaNULL May 9, 2019
1707b11
Update README.md
nankaNULL May 10, 2019
098983e
Update README.md
nankaNULL May 10, 2019
0ac305f
Update README.md
nankaNULL May 10, 2019
b190b36
Update README.md
nankaNULL May 10, 2019
6ae1257
支持fusion design UI库,配置主题包
nankaNULL May 10, 2019
a05d821
Merge branch 'master' of github.com:nankaNULL/typescript-react-webpack
nankaNULL May 10, 2019
2dfcbaf
配置全局样式
nankaNULL May 10, 2019
9c4576a
配置iconfont
nankaNULL May 10, 2019
dd55eae
拖拽布局,组件封装
nankaNULL May 14, 2019
d78f25d
拖拽组件及其添加删除操作
nankaNULL May 16, 2019
83fcdd9
自动创建组件
nankaNULL May 22, 2019
220e0eb
修改模板
nankaNULL May 22, 2019
9b2df28
test key
nankaNULL Jun 19, 2019
9d06747
babel升级
nankaNULL Jul 22, 2019
0eed6bb
babal 升级
nankaNULL Jul 22, 2019
3e9e99e
文档更新
nankaNULL Jul 22, 2019
893eea4
polyfill 替换
nankaNULL Jul 22, 2019
31fcaed
history引用改写
nankaNULL Nov 4, 2019
5d7f1be
Bump fstream from 1.0.11 to 1.0.12
dependabot[bot] Nov 4, 2019
0d9b3fd
node-sass update
nankaNULL Nov 18, 2019
45e5f4f
update
nankaNULL Nov 18, 2019
dc24e5a
Merge pull request #4 from nankaNULL/dependabot/npm_and_yarn/fstream-…
nankaNULL Nov 18, 2019
4d5965a
update
nankaNULL Dec 10, 2019
e692b8f
合并冲突
nankaNULL Dec 10, 2019
de249a6
Create npm-publish.yml
nankaNULL Jul 16, 2020
afedef1
Merge pull request #11 from nankaNULL/nankaNULL-patch-1
nankaNULL Jul 16, 2020
0daad14
Create main.yml
nankaNULL Jul 16, 2020
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
16 changes: 8 additions & 8 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"presets": [
["env", {
["@babel/preset-env", {
"modules": false
}],
"react",
"stage-0"
"@babel/preset-react",
],
"plugins": [
["import",
{ "libraryName": "antd", "style": true }
],
"transform-runtime",
"transform-decorators-legacy"
["import", { "libraryName": "antd", "style": true }, "antd"],
["import", { "libraryName": "@alifd/next", "style": true }, "@alifd/next"],

["@babel/plugin-transform-runtime",{"corejs": 2}],
["@babel/plugin-proposal-decorators", { "legacy": true }],
["@babel/plugin-proposal-class-properties", { "loose": true }]
]
}
60 changes: 60 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ typescript ]
pull_request:
branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
code_quality:
runs-on: ubuntu-lates
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: lint
run: npm run lint
env:
CI: true

# 当 merge_requests 执行 tsc 类型检查
check_types:
runs-on: ubuntu-lates
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- name: check-types
run: npm run check-types
env:
CI: true

# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
47 changes: 47 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}

publish-gpr:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
64 changes: 63 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,64 @@
# my-react
尝试搭建脚手架
react-webpack脚手架,参考pc-react-ant.design + 云日志 + 各种文档

==========================

### typescript-react
```text
typescript 的 在分支typescript下
```

==========================

#### 新增fusion design
1. 安装依赖
```
yarn add @alifd/next

// 主题包
yarn add @alifd/theme-4
yarn add @alifd/next-theme-loader @alifd/next-theme-webpack-plugin

```
2. 按需引入配置
(1) babel配置修改
```
"plugins": [
["import",[
{ "libraryName": "antd", "style": true },
{ "libraryName": "@alifd/next", "style": true }
]],
...
]
```
(2) webpack 配置
```
module: {
rules: [
{
test: /\.scss$/,
use: [
...
'@alifd/next-theme-loader?{"theme":"@alifd/theme-4"}' // 主题包
]
},
...
]
},
plugins: [
new ThemePlugin({ theme: '@alifd/theme-4' }), // 主题包
...
]

```
3. 注意点
```
官方文档在主题包css文件按需引入的webpack配置中用了extract-text-webpack-plugin
但这个插件默认安装的版本是不支持webpack4.x的,但他又一个4.0的beta版本支持webpack4.x
因此 yarn add extract-text-webpack-plugin@next -D

```
<!-- test key -->



62 changes: 35 additions & 27 deletions build/dev.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
// const CopyWebpackPlugin = require('copy-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const buildPath = path.resolve(__dirname, '../dist');
const ThemePlugin = require('@alifd/next-theme-webpack-plugin');
// const theme = require('../antd-theme.js');
module.exports = {
mode:'development',
devtool: 'cheap-module-eval-source-map',
context:path.resolve(__dirname, '../src'), // 解析起点
entry:{
vendor: ['react'],
vendor: ['react', 'react-dom', 'react-router', 'moment'],
app: ['./main.js']
},
output: {
Expand All @@ -36,7 +37,7 @@ module.exports = {
test: /\.js|jsx$/,
exclude: /node_modules/, // exclude不包括,include只命中
use:['babel-loader?cacheDirectory'],
// use: { // 这算是第二种写法,和上面的意义是一样的
// use: { // 这算是第二种写法,和上面的意义是一样的
// loader: 'babel-loader',
// options: {
// cacheDirectory:true
Expand All @@ -46,18 +47,19 @@ module.exports = {
{
test: /\.(less|css)$/,
use: [
'style-loader',
'css-loader',
'less-loader'
// 'less-loader?{modifyVars:'+JSON.stringify(theme)+'}'
],
'style-loader',
'css-loader',
'less-loader'
// 'less-loader?{modifyVars:'+JSON.stringify(theme)+'}'
],
},
{
test: /\.(scss|sass)$/,
use: [
'style-loader', //上面的简写方式
'css-loader',
'sass-loader'
'sass-loader',
'@alifd/next-theme-loader?{"theme":"@alifd/theme-4"}'
]
},
{
Expand All @@ -70,33 +72,39 @@ module.exports = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
hash: false,
chunksSortMode:'none',
title:'webpack-react',
assets: {
favicon: '/images/favicon.ico',
config_js: '/config/conf.dev.js'
}
}),
new webpack.NamedModulesPlugin(),
// new webpack.HotModuleReplacementPlugin(),
// new CopyWebpackPlugin([
// {from: path.resolve(__dirname,'../public/config'),to:'config'},
// {from: path.resolve(__dirname,'../public/mock'),to:'mock'},
// {from: path.resolve(__dirname,'../public/images'),to:'images'},
// {from: path.resolve(__dirname,'../public/fonts'),to:'fonts'},
// {from: path.resolve(__dirname,'../public/pages'),to:'pages'}
// ])
new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({__PRODUCTION: JSON.stringify(false)}),
new CopyWebpackPlugin([
{from: path.resolve(__dirname,'../public/images'),to:'images'},
{from: path.resolve(__dirname,'../public/config'),to:'config'},
{from: path.resolve(__dirname,'../public/fonts'),to:'fonts'},
]),
new ThemePlugin({ theme: '@alifd/theme-4' }),
],
devServer: {
host: '0.0.0.0',
port: '8181',
contentBase: buildPath,
publicPath: '/',
historyApiFallback: true,
// disableHostCheck: true,
// compress: true,
// hot: true, // 开启模块热替换功能
// inline:true, // 自动刷新网页实现实时预览
// proxy: [{
// path: '/api',
// // target: 'http://172.16.0.98:8788',//本地
// target: 'http://47.101.183.209:8788',//测试
// changeOrigin: true
// }]
disableHostCheck: true,
compress: true,
hot: true, // 开启模块热替换功能
inline:true, // 自动刷新网页实现实时预览
proxy: [{
path: '/users',
target: 'https://api.github.com',//测试
changeOrigin: true
}]
}
};

28 changes: 18 additions & 10 deletions build/prod.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const buildPath = path.resolve(__dirname, '../dist');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
Expand All @@ -9,8 +10,8 @@ module.exports = {
mode:'production',
context:path.resolve(__dirname, '../src'), // 解析起点
entry:{
vendor: ['react'],
app: ['./main.js']
vendor: ['react', 'react-dom', 'react-router', 'moment'],
app: ['babel-polyfill','./main.js']
},
output: {
path: buildPath, // 输出文件存放在本地的目录
Expand Down Expand Up @@ -102,20 +103,27 @@ module.exports = {
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
hash: false,
chunksSortMode:'none',
title:'webpack-react',
assets: {
favicon: '/images/favicon.ico',
config_js: '/config/conf.prod.js'
}
}),
new webpack.NamedModulesPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(true),
new MiniCssExtractPlugin({
filename: 'css/[name].[hash].css',
chunkFilename: 'css/[name].[hash].css'
}),
// new CopyWebpackPlugin([
// {from: path.resolve(__dirname,'../public/config'),to:'config'},
// {from: path.resolve(__dirname,'../public/mock'),to:'mock'},
// {from: path.resolve(__dirname,'../public/images'),to:'images'},
// {from: path.resolve(__dirname,'../public/fonts'),to:'fonts'},
// {from: path.resolve(__dirname,'../public/pages'),to:'pages'}
// ]),
new CopyWebpackPlugin([
{from: path.resolve(__dirname,'../public/images'),to:'images'},
{from: path.resolve(__dirname,'../public/config'),to:'config'},
// {from: path.resolve(__dirname,'../public/mock'),to:'mock'},
// {from: path.resolve(__dirname,'../public/images'),to:'images'},
{from: path.resolve(__dirname,'../public/fonts'),to:'fonts'},
// {from: path.resolve(__dirname,'../public/pages'),to:'pages'}
]),
new webpack.DefinePlugin({
__PRODUCTION: JSON.stringify(true)
}),
Expand Down
Loading