Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
zenghongtu committed Feb 7, 2023
1 parent 0d62710 commit 8f7f0f7
Show file tree
Hide file tree
Showing 22 changed files with 13,601 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 🎨 http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dist/
deploy_versions/
.temp/
.rn_temp/
node_modules/
.DS_Store
.swc
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
dist
tests
*.d.ts
*.js
*.md
*.yaml
.vscode
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"printWidth": 80,
"singleQuote": true,
"trailingComma": "all",
"proseWrap": "never",
"overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }],
"plugins": [
"./node_modules/prettier-plugin-packagejson",
"./node_modules/prettier-plugin-organize-imports"
]
}
22 changes: 22 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: true
}]
],
plugins: [
[
"import",
{
"libraryName": "@nutui/nutui-react-taro",
"libraryDirectory": "dist/esm",
"style": true,
"camel2DashComponentName": false
},
'nutui-react-taro'
]
]
}
9 changes: 9 additions & 0 deletions config/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
mini: {},
h5: {}
}
89 changes: 89 additions & 0 deletions config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
const path = require('path');

const config = {
projectName: 'GitHub-Pro',
date: '2023-2-7',
designWidth: 375,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2,
375: 2 / 1,
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: ['@tarojs/plugin-html'],
defineConstants: {},
alias: {
'@/src': path.resolve(__dirname, '..', 'src'),
},
copy: {
patterns: [],
options: {},
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false, // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
sass: {
data: `@import "@nutui/nutui-react-taro/dist/styles/variables.scss";`,
},
mini: {
miniCssExtractPluginOption: {
ignoreOrder: true,
},
postcss: {
pxtransform: {
enable: true,
config: {
selectorBlackList: ['nut-'],
},
},
url: {
enable: true,
config: {
limit: 1024, // 设定转换尺寸上限
},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
h5: {
publicPath: '/',
staticDirectory: 'static',
// esnextModules: ['nutui-react'],
postcss: {
pxtransform: {
enable: true,
config: {
selectorBlackList: ['nut-'],
},
},
autoprefixer: {
enable: true,
config: {},
},
cssModules: {
enable: true, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]',
},
},
},
},
};

module.exports = function (merge) {
if (process.env.NODE_ENV === 'development') {
return merge({}, config, require('./dev'));
}
return merge({}, config, require('./prod'));
};
37 changes: 37 additions & 0 deletions config/prod.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
module.exports = {
env: {
NODE_ENV: '"production"'
},
defineConstants: {
},
mini: {},
h5: {
/**
* WebpackChain 插件配置
* @docs https://github.com/neutrinojs/webpack-chain
*/
// webpackChain (chain) {
// /**
// * 如果 h5 端编译后体积过大,可以使用 webpack-bundle-analyzer 插件对打包体积进行分析。
// * @docs https://github.com/webpack-contrib/webpack-bundle-analyzer
// */
// chain.plugin('analyzer')
// .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])

// /**
// * 如果 h5 端首屏加载时间过长,可以使用 prerender-spa-plugin 插件预加载首页。
// * @docs https://github.com/chrisvfritz/prerender-spa-plugin
// */
// const path = require('path')
// const Prerender = require('prerender-spa-plugin')
// const staticDir = path.join(__dirname, '..', 'dist')
// chain
// .plugin('prerender')
// .use(new Prerender({
// staticDir,
// routes: [ '/pages/index/index' ],
// postProcess: (context) => ({ ...context, outputPath: path.join(staticDir, 'index.html') })
// }))
// }
}
}
91 changes: 91 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"name": "GitHub-Pro",
"version": "1.0.0",
"private": true,
"description": "",
"license": "MIT",
"author": "jasonzeng <[email protected]>",
"scripts": {
"build:alipay": "taro build --type alipay",
"build:h5": "taro build --type h5",
"build:jd": "taro build --type jd",
"build:qq": "taro build --type qq",
"build:quickapp": "taro build --type quickapp",
"build:rn": "taro build --type rn",
"build:swan": "taro build --type swan",
"build:tt": "taro build --type tt",
"build:weapp": "taro build --type weapp",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:h5": "npm run build:h5 -- --watch",
"dev:jd": "npm run build:jd -- --watch",
"dev:qq": "npm run build:qq -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:tt": "npm run build:tt -- --watch",
"dev:weapp": "npm run build:weapp -- --watch",
"format": "prettier --write \"src/**/*.{ts,tsx}\""
},
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"dependencies": {
"@babel/runtime": "^7.7.7",
"@nutui/nutui-react-taro": "^1.3.4",
"@tarojs/components": "3.5.12",
"@tarojs/helper": "3.5.12",
"@tarojs/plugin-framework-react": "3.5.12",
"@tarojs/plugin-html": "3.5.12",
"@tarojs/plugin-platform-alipay": "3.5.12",
"@tarojs/plugin-platform-jd": "3.5.12",
"@tarojs/plugin-platform-qq": "3.5.12",
"@tarojs/plugin-platform-swan": "3.5.12",
"@tarojs/plugin-platform-tt": "3.5.12",
"@tarojs/plugin-platform-weapp": "3.5.12",
"@tarojs/react": "3.5.12",
"@tarojs/router": "3.5.12",
"@tarojs/runtime": "3.5.12",
"@tarojs/shared": "3.5.12",
"@tarojs/taro": "3.5.12",
"@tarojs/taro-h5": "3.5.12",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-refresh": "^0.11.0"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@tarojs/cli": "3.5.12",
"@tarojs/webpack5-runner": "3.5.12",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-router-dom": "^5.1.7",
"@types/react-syntax-highlighter": "^13.5.2",
"@types/react-test-renderer": "^18.0.0",
"@types/react-transition-group": "^4.4.4",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-plugin-import": "^1.13.3",
"babel-preset-taro": "3.5.12",
"eslint": "^8.12.0",
"eslint-config-taro": "3.5.12",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^4.2.0",
"prettier": "^2.3.2",
"prettier-plugin-organize-imports": "^3.2.0",
"prettier-plugin-packagejson": "^2.3.0",
"style-loader": "1.3.0",
"stylelint": "^14.4.0",
"typescript": "^3.7.0",
"webpack": "^5.74.0"
},
"templateInfo": {
"name": "react-NutUI",
"typescript": true,
"css": "sass"
}
}
Loading

0 comments on commit 8f7f0f7

Please sign in to comment.