Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

同步harmony最新开发分支的代码 #15438

Closed
wants to merge 15 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
12 changes: 12 additions & 0 deletions examples/mini-program-example/.editorconfig
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions examples/mini-program-example/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"extends": ["taro/react"],
"rules": {
"react/jsx-uses-react": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/no-unused-expressions": "off",
"import/first": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-shadow": "off",
"react/forbid-elements": "off"
}
}
7 changes: 7 additions & 0 deletions examples/mini-program-example/.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
14 changes: 14 additions & 0 deletions examples/mini-program-example/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 120,
"singleQuote": true,
"useTabs": false,
"tabWidth": 2,
"semi": false,
"quoteProps": "as-needed",
"trailingComma": "es5",
"bracketSpacing": true,
"jsxSingleQuote": true,
"jsxBracketSameLine": false,
"arrowParens": "always",
"endOfLine": "auto"
}
10 changes: 10 additions & 0 deletions examples/mini-program-example/babel.config.js
Original file line number Diff line number Diff line change
@@ -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: true
}]
]
}
9 changes: 9 additions & 0 deletions examples/mini-program-example/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: {}
}
96 changes: 96 additions & 0 deletions examples/mini-program-example/config/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
const path = require('path')

const config = {
projectName: 'mini-program-example',
date: '2023-6-15',
designWidth: 750,
deviceRatio: {
640: 2.34 / 2,
750: 1,
828: 1.81 / 2
},
sourceRoot: 'src',
outputRoot: `dist/spa/main`,
plugins: [],
alias: {
'@/util': path.resolve(__dirname, '..', 'src/util'),
'@/styles': path.resolve(__dirname, '..', 'src/styles'),
'@/assets': path.resolve(__dirname, '..', 'src/assets'),
'@/components': path.resolve(__dirname, '..', 'src/components'),
},
defineConstants: {
},
copy: {
patterns: [
],
options: {
}
},
framework: 'react',
compiler: 'webpack5',
cache: {
enable: false // Webpack 持久化缓存配置,建议开启。默认配置请参考:https://docs.taro.zone/docs/config-detail#cache
},
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]'
}
}
},
imageUrlLoaderOption:{
limit:8192
}
},
h5: {
publicPath: '/spa/main/',
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]'
}
}
},
imageUrlLoaderOption:{
limit:8192
}
},
rn: {
appName: 'taroDemo',
postcss: {
cssModules: {
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
}
}
}
}

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 examples/mini-program-example/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') })
// }))
// }
}
}
86 changes: 86 additions & 0 deletions examples/mini-program-example/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"name": "mini-program-example",
"version": "1.0.0",
"private": true,
"description": "小程序demo",
"templateInfo": {
"name": "default",
"typescript": true,
"css": "sass"
},
"scripts": {
"lint": "eslint src --ext .js --ext .jsx --ext .ts --ext .tsx",
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx}\" && eslint src --ext .js --ext .jsx --ext .ts --ext .tsx --fix",
"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",
"build:harmony-hybrid": "taro build --type harmony-hybrid",
"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",
"dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch",
"clear:harmony-hybrid": "rm -rf node_modules/.taro/harmony-hybrid && npm run dev:harmony-hybrid",
"rebuild": "cd ../../packages/%npm_config_package% && pnpm build && cd ../../examples/mini-program-example && rimraf node_modules && pnpm install"
},
"browserslist": [
"last 3 versions",
"Android >= 4.1",
"ios >= 8"
],
"author": "",
"dependencies": {
"@babel/runtime": "^7.14.5",
"@tarojs/components": "workspace:*",
"@tarojs/helper": "workspace:*",
"@tarojs/plugin-platform-weapp": "workspace:*",
"@tarojs/plugin-platform-alipay": "workspace:*",
"@tarojs/plugin-platform-tt": "workspace:*",
"@tarojs/plugin-platform-swan": "workspace:*",
"@tarojs/plugin-platform-jd": "workspace:*",
"@tarojs/plugin-platform-qq": "workspace:*",
"@tarojs/plugin-platform-h5": "workspace:*",
"@tarojs/plugin-platform-harmony-hybrid": "workspace:*",
"@tarojs/runtime": "workspace:*",
"@tarojs/shared": "workspace:*",
"@tarojs/taro": "workspace:*",
"@tarojs/plugin-framework-react": "workspace:*",
"@tarojs/react": "workspace:*",
"react-dom": "^18.2.0",
"react": "^18.2.0"
},
"devDependencies": {
"@babel/core": "^7.8.0",
"@tarojs/cli": "workspace:*",
"@types/webpack-env": "^1.13.6",
"@types/react": "^18.2.0",
"webpack": "5.78.0",
"@tarojs/webpack5-runner": "workspace:*",
"babel-preset-taro": "workspace:*",
"eslint-config-taro": "workspace:*",
"eslint": "^8.12.0",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
"react-refresh": "^0.11.0",
"eslint-plugin-react": "^7.8.2",
"eslint-plugin-import": "^2.12.0",
"eslint-plugin-react-hooks": "^4.2.0",
"stylelint": "^14.4.0",
"@typescript-eslint/parser": "^5.20.0",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"typescript": "^4.1.0",
"postcss": "^8.4.18",
"ts-node": "^10.9.1",
"@types/node": "^18.15.11"
}
}
32 changes: 32 additions & 0 deletions examples/mini-program-example/project.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"miniprogramRoot": "dist/",
"projectname": "mini-program-example",
"description": "小程序demo",
"appid": "wx16ae4838cf116f8f",
"setting": {
"urlCheck": true,
"es6": false,
"enhance": false,
"compileHotReLoad": false,
"postcss": false,
"minified": false,
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"condition": false
},
"compileType": "miniprogram",
"libVersion": "3.0.0",
"srcMiniprogramRoot": "dist/",
"packOptions": {
"ignore": [],
"include": []
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 2
}
}
7 changes: 7 additions & 0 deletions examples/mini-program-example/project.private.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "mini-program-example",
"setting": {
"compileHotReLoad": true
}
}
9 changes: 9 additions & 0 deletions examples/mini-program-example/project.tt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"miniprogramRoot": "./",
"projectname": "mini-program-example",
"appid": "testAppId",
"setting": {
"es6": false,
"minified": false
}
}
Loading
Loading