c1d788a4 by McLemore

init commit

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