c1d788a4 by McLemore

init commit

1 parent 904df67e
1 {
2 "presets": [
3 "@babel/react",
4 "@babel/typescript",
5 "@babel/env"
6 ],
7 "plugins": [
8 "@babel/plugin-proposal-class-properties"
9 ]
10 }
...\ No newline at end of file ...\ No newline at end of file
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="UTF-8">
5 <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
6 <script src="https://zb100.oss-cn-shanghai.aliyuncs.com/f/flexible_css_flexible20171215.js"></script>
7 <title>${projectName} Demo</title>
8 </head>
9 <body>
10 <div id="app"></div>
11 </body>
12 </html>
...\ No newline at end of file ...\ No newline at end of file
1 import React from 'react'
2 import ReactDOM from 'react-dom'
3 import Component from '../src/index'
4
5 ReactDOM.render(<Component />, document.getElementById('app'))
...\ No newline at end of file ...\ No newline at end of file
File mode changed
1 node_modules/
2 src/
3 demo/
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "name": "${projectName}",
3 "version": "0.1.0",
4 "description": "${description}",
5 "main": "dist/${projectName}.js",
6 "scripts": {
7 "build": "webpack",
8 "dev": "webpack-dev-server --config=webpack.dev.js --hot --inline"
9 },
10 "repository": {
11 "type": "git",
12 "url": "ssh://git@gitlab.zb100.com:10022/${repo}.git"
13 },
14 "author": "${author}",
15 "license": "MIT",
16 "devDependencies": {
17 "@babel/core": "^7.1.6",
18 "@babel/plugin-proposal-class-properties": "^7.1.0",
19 "@babel/preset-env": "^7.1.6",
20 "@babel/preset-react": "^7.0.0",
21 "@babel/preset-typescript": "^7.1.0",
22 "@types/react": "^16.7.6",
23 "@types/react-dom": "^16.0.9",
24 "autoprefixer": "^9.3.1",
25 "babel-loader": "^8.0.4",
26 "css-loader": "^1.0.1",
27 "eslint-plugin-typescript": "^0.13.0",
28 "html-webpack-plugin": "^3.2.0",
29 "ip": "^1.1.5",
30 "less": "^3.8.1",
31 "less-loader": "^4.1.0",
32 "mini-css-extract-plugin": "^0.4.4",
33 "postcss-loader": "^3.0.0",
34 "postcss-pxtorem": "^4.0.1",
35 "react": "^16.6.3",
36 "react-dom": "^16.6.3",
37 "style-loader": "^0.23.1",
38 "typescript": "^3.1.6",
39 "typescript-eslint-parser": "^21.0.1",
40 "typings-for-css-modules-loader": "^1.7.0",
41 "webpack": "^4.25.1",
42 "webpack-cli": "^3.1.2",
43 "webpack-dev-server": "^3.1.10"
44 },
45 "files": [
46 "dist"
47 ],
48 "standard": {
49 "parser": "typescript-eslint-parser",
50 "plugins": [
51 "typescript"
52 ]
53 }
54 }
1 module.exports = {
2 plugins: [
3 require('autoprefixer')({
4 browsers: [
5 'last 2 versions',
6 'Firefox ESR',
7 '> 1%',
8 'ie >= 8',
9 'iOS >= 8',
10 'Android >= 4'
11 ]
12 }),
13 require('postcss-pxtorem')({
14 rootValue: 37.5,
15 propWhiteList: []
16 })
17 ]
18 }
1 import React from 'react'
2 import styles from './styles/index.less'
3
4 interface PropsInterface {
5
6 }
7
8 interface StateInterface {
9
10 }
11
12 class Component extends React.Component<PropsInterface, StateInterface> {
13 render () {
14 return (
15 <div className={styles.container}>
16 ${projectName}
17 </div>
18 )
19 }
20 }
21
22 export default Component
...\ No newline at end of file ...\ No newline at end of file
1 .container {
2 font-weight: 400;
3 font-family:
4 system, -apple-system, BlinkMacSystemFont,
5 "PingFang SC", "Segoe UI", "Microsoft YaHei", "wenquanyi micro hei","Hiragino Sans GB", "Hiragino Sans GB W3", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans",
6 "Helvetica Neue", Helvetica, Arial, sans-serif;
7 }
...\ No newline at end of file ...\ No newline at end of file
1 {
2 "compilerOptions": {
3 "allowJs": true,
4 "allowSyntheticDefaultImports": true,
5 "baseUrl": ".",
6 "jsx": "preserve",
7 "lib": ["dom", "es2017"],
8 "module": "esnext",
9 "moduleResolution": "node",
10 "noEmit": true,
11 "noUnusedLocals": true,
12 "noUnusedParameters": true,
13 "preserveConstEnums": true,
14 "removeComments": false,
15 "skipLibCheck": true,
16 "sourceMap": true,
17 "strict": true,
18 "target": "esnext"
19 },
20 "includes": [
21 "./externals.d.ts"
22 ]
23 }
...\ No newline at end of file ...\ No newline at end of file
1 const path = require('path')
2 const MiniCssExtractPlugin = require('mini-css-extract-plugin')
3
4 module.exports = {
5 mode: 'production',
6 entry: './src/index.tsx',
7 output: {
8 filename: '${projectName}.js',
9 path: path.resolve(__dirname, 'dist'),
10 library: '${projectName}',
11 libraryTarget: 'umd'
12 },
13 resolve: {
14 extensions: [
15 '.ts',
16 '.tsx',
17 '.js'
18 ]
19 },
20 module: {
21 rules: [{
22 test: /\.tsx?$/,
23 loader: 'babel-loader'
24 }, {
25 test: /\.less$/,
26 use: [
27 MiniCssExtractPlugin.loader,
28 {
29 loader: 'css-loader',
30 options: {
31 modules: true,
32 localIdentName: '${projectName}__[local]__[hash:base64:5]',
33 importLoaders: 1
34 }
35 }, {
36 loader: 'less-loader'
37 }
38 ]
39 }]
40 },
41 externals: {
42 react: {
43 commonjs: 'react',
44 amd: 'react',
45 root: 'React',
46 commonjs2: 'react'
47 }
48 },
49 plugins: [
50 new MiniCssExtractPlugin({
51 filename: '${projectName}.css',
52 chunkFilename: '[id].css'
53 })
54 ]
55 }
1 const HtmlWebpackPlugin = require('html-webpack-plugin')
2 const ip = require('ip')
3
4 module.exports = {
5 mode: 'development',
6 entry: './demo/index.tsx',
7 output: {
8 filename: 'demo.js',
9 publicPath: '/'
10 },
11 resolve: {
12 extensions: [
13 '.ts',
14 '.tsx',
15 '.js'
16 ]
17 },
18 module: {
19 rules: [{
20 test: /\.tsx?$/,
21 loader: 'babel-loader'
22 }, {
23 test: /\.less$/,
24 use: [
25 'style-loader',
26 {
27 loader: 'typings-for-css-modules-loader',
28 options: {
29 namedExport: true,
30 modules: true,
31 localIdentName: '${projectName}__[local]__[hash:base64:5]',
32 importLoaders: 2
33 }
34 }, {
35 loader: 'postcss-loader'
36 }, {
37 loader: 'less-loader'
38 }
39 ]
40 }]
41 },
42 plugins: [new HtmlWebpackPlugin({
43 template: 'demo/index.html'
44 })],
45 devServer: {
46 host: ip.address(),
47 open: true,
48 port: 9527
49 },
50 devtool: 'source-map'
51 }
1 module.exports = {
2 projectName: {
3 desc: '请输入工程名称',
4 default: 'my-awesome-project'
5 },
6 description: {
7 desc: '请输入工程描述',
8 default: 'my awesome project'
9 },
10 author: {
11 desc: '请输入开发者名称',
12 default: '公瑾'
13 },
14 repo: {
15 desc: '请输入 git 仓库名',
16 default: 'ui/my-awesome-project'
17 }
18 }
1 {
2 "name": "pkg-template",
3 "version": "0.1.0",
4 "description": "",
5 "main": "index.js",
6 "scripts": {
7 "test": "echo \"Error: no test specified\" && exit 1"
8 },
9 "repository": {
10 "type": "git",
11 "url": "ssh://git@gitlab.zb100.com:10022/templates/pkg-template.git"
12 },
13 "author": "公瑾",
14 "license": "MIT"
15 }