Browse Source

add mini code base

main
unknown 3 years ago
commit
63a95603f7
18 changed files with 15473 additions and 0 deletions
  1. +12
    -0
      .editorconfig
  2. +7
    -0
      .eslintrc.js
  3. +6
    -0
      .gitignore
  4. +10
    -0
      babel.config.js
  5. +11
    -0
      config/dev.js
  6. +70
    -0
      config/index.js
  7. +18
    -0
      config/prod.js
  8. +63
    -0
      package.json
  9. +23
    -0
      project.config.json
  10. +13
    -0
      project.tt.json
  11. +11
    -0
      src/app.config.js
  12. +20
    -0
      src/app.js
  13. +0
    -0
      src/app.scss
  14. +19
    -0
      src/index.html
  15. +3
    -0
      src/pages/index/index.config.js
  16. +32
    -0
      src/pages/index/index.jsx
  17. +0
    -0
      src/pages/index/index.scss
  18. +15155
    -0
      yarn.lock

+ 12
- 0
.editorconfig View File

@@ -0,0 +1,12 @@
# http://editorconfig.org
root = true

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

[*.md]
trim_trailing_whitespace = false

+ 7
- 0
.eslintrc.js View File

@@ -0,0 +1,7 @@
module.exports = {
"extends": ["taro/react"],
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off"
}
}

+ 6
- 0
.gitignore View File

@@ -0,0 +1,6 @@
dist/
deploy_versions/
.temp/
.rn_temp/
node_modules/
.DS_Store

+ 10
- 0
babel.config.js View File

@@ -0,0 +1,10 @@
// babel-preset-taro 更多选项和默认值:
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
module.exports = {
presets: [
['taro', {
framework: 'react',
ts: false
}]
]
}

+ 11
- 0
config/dev.js View File

@@ -0,0 +1,11 @@
module.exports = {
env: {
NODE_ENV: '"development"'
},
defineConstants: {
},
mini: {},
h5: {
esnextModules: ['taro-ui']
}
}

+ 70
- 0
config/index.js View File

@@ -0,0 +1,70 @@
const config = {
projectName: 'LOCKING-mini',
date: '2021-6-4',
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: [],
defineConstants: {
},
copy: {
patterns: [
],
options: {
}
},
framework: 'react',
mini: {
postcss: {
pxtransform: {
enable: true,
config: {

}
},
url: {
enable: true,
config: {
limit: 1024 // 设定转换尺寸上限
}
},
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
}
}
}
},
h5: {
publicPath: '/',
staticDirectory: 'static',
postcss: {
autoprefixer: {
enable: true,
config: {
}
},
cssModules: {
enable: false, // 默认为 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'))
}

+ 18
- 0
config/prod.js View File

@@ -0,0 +1,18 @@
module.exports = {
env: {
NODE_ENV: '"production"'
},
defineConstants: {
},
mini: {},
h5: {
/**
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
* 参考代码如下:
* webpackChain (chain) {
* chain.plugin('analyzer')
* .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
* }
*/
}
}

+ 63
- 0
package.json View File

@@ -0,0 +1,63 @@
{
"name": "LOCKING-mini",
"version": "1.0.0",
"private": true,
"description": "LOCKING 小程序端",
"templateInfo": {
"name": "taro-ui",
"typescript": false,
"css": "sass"
},
"scripts": {
"build:weapp": "taro build --type weapp",
"build:swan": "taro build --type swan",
"build:alipay": "taro build --type alipay",
"build:tt": "taro build --type tt",
"build:h5": "taro build --type h5",
"build:rn": "taro build --type rn",
"build:qq": "taro build --type qq",
"build:jd": "taro build --type jd",
"build:quickapp": "taro build --type quickapp",
"dev:weapp": "npm run build:weapp -- --watch",
"dev:swan": "npm run build:swan -- --watch",
"dev:alipay": "npm run build:alipay -- --watch",
"dev:tt": "npm run build:tt -- --watch",
"dev:h5": "npm run build:h5 -- --watch",
"dev:rn": "npm run build:rn -- --watch",
"dev:qq": "npm run build:qq -- --watch",
"dev:jd": "npm run build:jd -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch"
},
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"author": "",
"dependencies": {
"@babel/runtime": "^7.7.7",
"@tarojs/cli": "3.2.10",
"@tarojs/components": "3.2.10",
"@tarojs/runtime": "3.2.10",
"@tarojs/taro": "3.2.10",
"lodash": "4.17.15",
"@tarojs/react": "3.2.10",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"taro-ui": "^3.0.0-alpha.3"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@tarojs/mini-runner": "3.2.10",
"@tarojs/webpack-runner": "3.2.10",
"@types/webpack-env": "^1.13.6",
"babel-preset-taro": "3.2.10",
"eslint": "^6.8.0",
"eslint-config-taro": "3.2.10",
"stylelint": "9.3.0",
"@types/react": "^17.0.2",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react-hooks": "^4.2.0"
}
}

+ 23
- 0
project.config.json View File

@@ -0,0 +1,23 @@
{
"miniprogramRoot": "dist/",
"projectname": "LOCKING-mini",
"description": "LOCKING 小程序端",
"appid": "touristappid",
"setting": {
"urlCheck": true,
"es6": false,
"postcss": false,
"preloadBackgroundData": false,
"minified": false,
"newFeature": true,
"autoAudits": false,
"coverView": true,
"showShadowRootInWxmlPanel": false,
"scopeDataCheck": false,
"useCompilerModule": false
},
"compileType": "miniprogram",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {}
}

+ 13
- 0
project.tt.json View File

@@ -0,0 +1,13 @@
{
"miniprogramRoot": "./",
"projectname": "LOCKING-mini",
"description": "LOCKING 小程序端",
"appid": "touristappid",
"setting": {
"urlCheck": true,
"es6": false,
"postcss": false,
"minified": false
},
"compileType": "miniprogram"
}

+ 11
- 0
src/app.config.js View File

@@ -0,0 +1,11 @@
export default {
pages: [
'pages/index/index'
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
}
}

+ 20
- 0
src/app.js View File

@@ -0,0 +1,20 @@
import { Component } from 'react'
import './app.scss'

class App extends Component {

componentDidMount () {}

componentDidShow () {}

componentDidHide () {}

componentDidCatchError () {}

// this.props.children 是将要会渲染的页面
render () {
return this.props.children
}
}

export default App

+ 0
- 0
src/app.scss View File


+ 19
- 0
src/index.html View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="format-detection" content="telephone=no,address=no">
<meta name="apple-mobile-web-app-status-bar-style" content="white">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
<title></title>
<script>
!function(x){function w(){var v,u,t,tes,s=x.document,r=s.documentElement,a=r.getBoundingClientRect().width;if(!v&&!u){var n=!!x.navigator.appVersion.match(/AppleWebKit.*Mobile.*/);v=x.devicePixelRatio;tes=x.devicePixelRatio;v=n?v:1,u=1/v}if(a>=640){r.style.fontSize="40px"}else{if(a<=320){r.style.fontSize="20px"}else{r.style.fontSize=a/320*20+"px"}}}x.addEventListener("resize",function(){w()});w()}(window);
</script>
</head>
<body>
<div id="app"></div>
</body>
</html>

+ 3
- 0
src/pages/index/index.config.js View File

@@ -0,0 +1,3 @@
export default {
navigationBarTitleText: '首页'
}

+ 32
- 0
src/pages/index/index.jsx View File

@@ -0,0 +1,32 @@
import { Component } from 'react'
import { View, Text } from '@tarojs/components'
import { AtButton } from 'taro-ui'

import "taro-ui/dist/style/components/button.scss" // 按需引入
import './index.scss'

export default class Index extends Component {

componentWillMount () { }

componentDidMount () { }

componentWillUnmount () { }

componentDidShow () { }

componentDidHide () { }

render () {
return (
<View className='index'>
<Text>Hello world!</Text>
<AtButton type='primary'>I need Taro UI</AtButton>
<Text>Taro UI 支持 Vue 了吗?</Text>
<AtButton type='primary' circle={true}>支持</AtButton>
<Text>共建?</Text>
<AtButton type='secondary' circle={true}>来</AtButton>
</View>
)
}
}

+ 0
- 0
src/pages/index/index.scss View File


+ 15155
- 0
yarn.lock
File diff suppressed because it is too large
View File


Loading…
Cancel
Save