Commit f114c4e7 authored by ChrisZhao 赵思思's avatar ChrisZhao 赵思思

Init Commit

parent ef007ebb
config
*.config.js
ios
android
\ No newline at end of file
{
"extends": ["taro/react"],
"rules": {
"semi": ["error", "always"],
"no-undef": 0,
"import/first": 0,
"space-infix-ops": 1,
"array-bracket-spacing": 0,
"object-curly-spacing": ["error","always"],
"spaced-comment": 2,
"no-unused-vars": 0,
"react/no-unused-state": 0,
"react/sort-comp": 0,
"react/self-closing-comp": 1,
"react/no-multi-comp": 0,
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx", ".tsx"] }],
"@typescript-eslint/no-unused-vars": [1, { "varsIgnorePattern": "React" }],
"@typescript-eslint/no-undef": 0,
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-empty-function": 0,
"@typescript-eslint/no-explicit-any": 0,
"jsx-quotes": [
"error",
"prefer-double"
],
"import/prefer-default-export": 0,
"@typescript-eslint/camelcase": 0,
"@typescript-eslint/ban-ts-ignore": 0,
"@typescript-eslint/no-inferrable-types": 0,
"@typescript-eslint/no-shadow": 0
}
}
registry=https://registry.npm.taobao.org
disturl=https://npm.taobao.org/dist
sass_binary_site=https://npm.taobao.org/mirrors/node-sass/
phantomjs_cdnurl=https://npm.taobao.org/mirrors/phantomjs/
electron_mirror=https://npm.taobao.org/mirrors/electron/
chromedriver_cdnurl=https://npm.taobao.org/mirrors/chromedriver
operadriver_cdnurl=https://npm.taobao.org/mirrors/operadriver
selenium_cdnurl=https://npm.taobao.org/mirrors/selenium
node_inspector_cdnurl=https://npm.taobao.org/mirrors/node-inspector
fsevents_binary_host_mirror=http://npm.taobao.org/mirrors/fsevents/
......@@ -4,6 +4,9 @@ module.exports = {
},
defineConstants: {
},
isWatch: true,
mini: {},
h5: {}
h5: {
esnextModules: ['taro-ui']
}
}
const path = require("path");
const config = {
projectName: 'taro-multi',
date: '2024-3-14',
projectName: "LogwireMobile",
date: "2020-11-7",
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: 'dist',
plugins: [],
defineConstants: {
compiler: {
type: 'webpack5',
prebundle: {
enable: false,
},
copy: {
patterns: [
],
options: {
}
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
sourceRoot: "src",
outputRoot: `dist/${process.env.TARO_ENV}`,
plugins: [],
defineConstants: {
IS_H5: process.env.TARO_ENV === "h5",
IS_RN: process.env.TARO_ENV === "rn",
IS_WEAPP: process.env.TARO_ENV === "weapp"
},
rn: {
output: {
ios: '../bundles/ios/index.jsbundle',
android: '../bundles/android/index.android.bundle'
alias: {
"@src": path.resolve(__dirname, "..", "src"),
"@components": path.resolve(__dirname, "..", "src/components"),
"@scss": path.resolve(__dirname, "..", "src/scss"),
"@utils": path.resolve(__dirname, "..", "src/utils"),
"@service": path.resolve(__dirname, "..", "src/service")
},
copy: {
patterns: [],
options: {}
},
framework: "react",
mini: {
postcss: {
pxtransform: {
enable: true,
config: {
}
config: {}
},
url: {
enable: true,
......@@ -46,35 +49,26 @@ const config = {
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
config: {
namingPattern: 'module', // 转换模式,取值为 global/module
generateScopedName: '[name]__[local]___[hash:base64:5]'
namingPattern: "module", // 转换模式,取值为 global/module
generateScopedName: "[name]__[local]___[hash:base64:5]"
}
}
}
},
h5: {
publicPath: '/',
staticDirectory: 'static',
postcss: {
autoprefixer: {
enable: true,
config: {
}
rn: {
appName: 'LogwireNativeApp',
output: {
ios: 'ios/main.jsbundle',
iosAssetsDest: 'ios',
android: 'android/index.android.bundle',
androidAssetsDest: 'android'
},
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'))
module.exports = function(merge) {
if (process.env.NODE_ENV === "development") {
return merge({}, config, require("./dev"));
}
return merge({}, config, require('./prod'))
}
return merge({}, config, require("./prod"));
};
module.exports = {
env: {
NODE_ENV: '"production"'
},
defineConstants: {
},
mini: {},
h5: {
/**
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
* 参考代码如下:
* webpackChain (chain) {
* chain.plugin('analyzer')
* .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
* }
*/
}
}
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') })
// }))
// }
}
}
declare module "*.png";
declare module "*.gif";
declare module "*.jpg";
declare module "*.jpeg";
declare module "*.svg";
declare module "*.css";
declare module "*.less";
declare module "*.scss";
declare module "*.sass";
declare module "*.styl";
declare module "*.mp4";
declare namespace NodeJS {
interface ProcessEnv {
TARO_ENV:
| "weapp"
| "swan"
| "alipay"
| "h5"
| "rn"
| "tt"
| "quickapp"
| "qq"
| "jd";
}
interface Global {
globalData: object;
}
}
declare const IS_H5: any;
declare const IS_WEAPP: any;
declare const IS_RN: any;
import '@tarojs/rn-supporter/entry-file.js'
\ No newline at end of file
const { mergeConfig } = require('metro-config')
const { getMetroConfig } = require('@tarojs/rn-supporter')
module.exports = (async function (){
return mergeConfig({
// custom your metro config here
// https://facebook.github.io/metro/docs/configuration
resolver: {}
}, await getMetroConfig())
})()
\ No newline at end of file
module.exports = {
server: {
rewriteRequestUrl: (url) => {
if (!url.endsWith('.bundle')) {
return url;
}
// https://github.com/facebook/react-native/issues/36794
// JavaScriptCore strips query strings, so try to re-add them with a best guess.
return url + '?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true';
}, // ...
}, // ...
}
This diff is collapsed.
{
"name": "taro-multi",
"name": "LogwireMobile",
"version": "1.0.0",
"private": true,
"description": "y",
"description": "Logwire 移动端代码,包括 APP、小程序",
"templateInfo": {
"name": "mobx",
"name": "default",
"typescript": true,
"css": "sass"
},
......@@ -15,74 +15,73 @@
"build:tt": "taro build --type tt",
"build:h5": "taro build --type h5",
"build:rn": "taro build --type rn",
"build:rn-ios": "taro build --type rn --platform ios",
"build:rn-android": "taro build --type rn --platform android",
"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:rn": "npm run build:rn -- --watch --qr",
"dev:qq": "npm run build:qq -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch"
"dev:jd": "npm run build:jd -- --watch",
"dev:quickapp": "npm run build:quickapp -- --watch",
"publish:pages": "yarn build:h5 && yarn gh-pages -d dist/h5 -t"
},
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"author": "",
"license": "MIT",
"author": "qiuz",
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix"
]
},
"dependencies": {
"@babel/runtime": "^7.7.7",
"@tarojs/components": "3.6.16",
"@tarojs/components-rn": "^3.6.24",
"@tarojs/helper": "3.6.16",
"@tarojs/plugin-framework-react": "3.6.16",
"@tarojs/plugin-platform-alipay": "3.6.16",
"@tarojs/plugin-platform-h5": "3.6.16",
"@tarojs/plugin-platform-jd": "3.6.16",
"@tarojs/plugin-platform-qq": "3.6.16",
"@tarojs/plugin-platform-swan": "3.6.16",
"@tarojs/plugin-platform-tt": "3.6.16",
"@tarojs/plugin-platform-weapp": "3.6.16",
"@tarojs/react": "3.6.16",
"@tarojs/rn-runner": "^3.6.24",
"@tarojs/rn-supporter": "^3.6.24",
"@tarojs/runtime": "3.6.16",
"@tarojs/runtime-rn": "^3.6.24",
"@tarojs/shared": "3.6.16",
"@tarojs/taro": "3.6.16",
"@tarojs/taro-rn": "^3.6.24",
"expo": "~47.0.3",
"mobx": "5.0.5",
"mobx-react": "6.1.4",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react-native": "0.72.0"
"@codler/react-native-keyboard-aware-scroll-view": "^2.0.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
"@tarojs/cli": "^3.5.7",
"@tarojs/components": "^3.5.7",
"@tarojs/plugin-framework-react": "^3.5.7",
"@tarojs/react": "^3.5.7",
"@tarojs/rn-runner": "^3.5.7",
"@tarojs/runtime": "^3.5.7",
"@tarojs/taro": "^3.5.7",
"@tarojs/taro-rn": "^3.5.7",
"lodash": "4.17.21",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-native": "^0.68.2",
"react-refresh": "^0.14.0",
"webpack": "5.69.0",
"taro-ui": "^3.0.0-alpha.3"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"@tarojs/cli": "3.6.16",
"@tarojs/taro-loader": "3.6.16",
"@tarojs/webpack5-runner": "3.6.16",
"@types/node": "^18.15.11",
"@types/react": "^18.0.0",
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@tarojs/webpack5-runner": "^3.5.7",
"@types/react": "^17.0.2",
"@types/webpack-env": "^1.13.6",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"babel-preset-taro": "3.6.16",
"eslint": "^8.12.0",
"eslint-config-taro": "3.6.16",
"@typescript-eslint/eslint-plugin": "^2.x",
"@typescript-eslint/parser": "^2.x",
"babel-preset-taro": "^3.5.7",
"eslint": "^6.8.0",
"eslint-config-taro": "^3.5.7",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-react-hooks": "^4.2.0",
"postcss": "^8.4.18",
"react-refresh": "^0.11.0",
"gh-pages": "^3.1.0",
"husky": "^4.3.5",
"lint-staged": "^10.5.3",
"react-native-linear-gradient": "^2.5.6",
"stylelint": "9.3.0",
"ts-node": "^10.9.1",
"typescript": "^4.1.0",
"webpack": "^5.78.0"
"typescript": "^4.1.0"
}
}
{
"miniprogramRoot": "./dist",
"projectname": "taro-multi",
"description": "y",
"appid": "touristappid",
"miniprogramRoot": ".dist",
"projectname": "Logwire Mobile",
"description": "",
"appid": "wxb604d548939868ce",
"setting": {
"urlCheck": true,
"es6": false,
"enhance": false,
"compileHotReLoad": false,
"postcss": false,
"minified": false
"preloadBackgroundData": false,
"minified": false,
"newFeature": true,
"autoAudits": false,
"coverView": true,
"showShadowRootInWxmlPanel": false,
"scopeDataCheck": false,
"useCompilerModule": false
},
"compileType": "miniprogram"
"compileType": "miniprogram",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"condition": {}
}
{
"miniprogramRoot": "./",
"projectname": "taro-multi",
"description": "y",
"appid": "touristappid",
"setting": {
"urlCheck": true,
"es6": false,
"postcss": false,
"minified": false
},
"compileType": "miniprogram"
}
export default defineAppConfig({
export default {
pages: [
'pages/index/index'
"pages/index",
],
window: {
backgroundTextStyle: 'light',
navigationBarBackgroundColor: '#fff',
navigationBarTitleText: 'WeChat',
navigationBarTextStyle: 'black'
backgroundTextStyle: "light",
navigationBarBackgroundColor: "#fff",
navigationBarTitleText: "WeChat",
navigationBarTextStyle: "black"
},
rn: {
screenOptions: {
// 设置页面的options,参考https://reactnavigation.org/docs/stack-navigator/#options
shadowOffset: { width: 0, height: 0 },
borderWidth: 0,
elevation: 0,
shadowOpacity: 1,
borderBottomWidth: 0
}
})
}
};
@import "~taro-ui/dist/style/index.scss";
/* #ifdef h5 */
* {
box-sizing: border-box;
}
taro-view-core,
taro-text-core,
div {
font-size: 32px;
}
/* #endif */
/* #ifdef weapp */
view,
text {
box-sizing: border-box;
}
/* #endif */
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;
import { Component, PropsWithChildren } from 'react'
import { Provider } from 'mobx-react'
import counterStore from './store/counter'
import './app.scss'
const store = {
counterStore
}
class App extends Component<PropsWithChildren> {
componentDidMount () {}
componentDidShow () {}
componentDidHide () {}
// this.props.children 就是要渲染的页面
render () {
return (
<Provider store={store}>
{this.props.children}
</Provider>
)
}
}
export default App
......@@ -8,7 +8,7 @@
<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>taro-multi</title>
<title>Logwire Mobile</title>
<script><%= htmlWebpackPlugin.options.script %></script>
</head>
<body>
......
import { View, Text } from '@tarojs/components'
import { useLoad } from '@tarojs/taro'
import './index.scss'
export default function Index() {
useLoad(() => {
console.log('Page loaded.')
})
return (
<View className='index'>
<Text>Hello world!</Text>
</View>
)
}
import { Component, PropsWithChildren } from 'react'
import { View, Button, Text } from '@tarojs/components'
import { observer, inject } from 'mobx-react'
import './index.scss'
type PageStateProps = {
store: {
counterStore: {
counter: number,
increment: Function,
decrement: Function,
incrementAsync: Function
}
}
}
interface Index {
props: PageStateProps;
}
@inject('store')
@observer
class Index extends Component<PropsWithChildren> {
componentDidMount () { }
componentWillUnmount () { }
componentDidShow () { }
componentDidHide () { }
increment = () => {
const { counterStore } = this.props.store
counterStore.increment()
}
decrement = () => {
const { counterStore } = this.props.store
counterStore.decrement()
}
incrementAsync = () => {
const { counterStore } = this.props.store
counterStore.incrementAsync()
}
render () {
const { counterStore: { counter } } = this.props.store
return (
<View className='index'>
<Button onClick={this.increment}>+</Button>
<Button onClick={this.decrement}>-</Button>
<Button onClick={this.incrementAsync}>Add Async</Button>
<Text>{counter}</Text>
</View>
)
}
}
export default Index
import { observable } from 'mobx'
const counterStore = observable({
counter: 0,
counterStore() {
this.counter++
},
increment() {
this.counter++
},
decrement() {
this.counter--
},
incrementAsync() {
setTimeout(() => {
this.counter++
}, 1000)
}
})
export default counterStore
\ No newline at end of file
......@@ -15,13 +15,38 @@
"sourceMap": true,
"baseUrl": ".",
"rootDir": ".",
"jsx": "react-jsx",
"jsx": "react",
"jsxFactory": "React.createElement",
"allowJs": true,
"resolveJsonModule": true,
"typeRoots": [
"node_modules/@types"
]
"node_modules/@types",
"global.d.ts"
],
"paths": {
"@components": [
"src/components/"
],
"@components/*": [
"src/components/*"
],
"@utils": [
"src/utils"
],
"@utils/*": [
"src/utils/*"
],
"@service": [
"src/service"
],
"@service/*": [
"src/service/*"
],
},
"include": ["./src", "./types"],
},
"exclude": [
"node_modules",
"dist"
],
"compileOnSave": false
}
/// <reference types="@tarojs/taro" />
declare module '*.png';
declare module '*.gif';
declare module '*.jpg';
declare module '*.jpeg';
declare module '*.svg';
declare module '*.css';
declare module '*.less';
declare module '*.scss';
declare module '*.sass';
declare module '*.styl';
declare namespace JSX {
interface IntrinsicElements {
'import': React.DetailedHTMLProps<React.EmbedHTMLAttributes<HTMLEmbedElement>, HTMLEmbedElement>
}
}
declare namespace NodeJS {
interface ProcessEnv {
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd'
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment