Skip to content

Commit 65324bf

Browse files
committed
feat: initialize
0 parents  commit 65324bf

22 files changed

Lines changed: 12711 additions & 0 deletions

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["taro/react"],
3+
"rules": {
4+
"react/jsx-uses-react": "off",
5+
"react/react-in-jsx-scope": "off"
6+
}
7+
}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
dist/
2+
deploy_versions/
3+
.temp/
4+
.rn_temp/
5+
node_modules/
6+
.DS_Store

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# @visactor/taro-vchart 使用示例
2+
3+
## 如何使用
4+
5+
1. 安装依赖
6+
7+
```bash
8+
$ yarn
9+
```
10+
11+
2. 启动编译,根据你想要体验的环境运行对应的命令
12+
13+
```bash
14+
# h5 环境,启动后浏览器会自动打开
15+
$ yarn dev:h5
16+
17+
# 飞书小程序,启动后通过飞书开发者工具导入编译后的 dist 目录即可
18+
$ yarn dev:tt
19+
20+
# 微信小程序,启动后通过微信开发者工具导入编译后的 dist 目录即可
21+
$ yarn dev:weapp
22+
```
23+
24+
## 问题反馈
25+
26+
如果在使用过程中发现问题,欢迎在 [GitHub issues](https://github.com/VisActor/VChart/issues/new/choose) 中向我们反馈,非常感谢!

babel.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// babel-preset-taro 更多选项和默认值:
2+
// https://github.com/NervJS/taro/blob/next/packages/babel-preset-taro/README.md
3+
module.exports = {
4+
presets: [
5+
['taro', {
6+
framework: 'react',
7+
ts: true
8+
}]
9+
]
10+
}

config/dev.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = {
2+
env: {
3+
NODE_ENV: '"development"'
4+
},
5+
defineConstants: {
6+
},
7+
mini: {},
8+
h5: {}
9+
}

config/index.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
const config = {
2+
projectName: 'taro-demo',
3+
date: '2023-6-30',
4+
designWidth: 750,
5+
deviceRatio: {
6+
640: 2.34 / 2,
7+
750: 1,
8+
828: 1.81 / 2
9+
},
10+
sourceRoot: 'src',
11+
outputRoot: 'dist',
12+
plugins: ['@tarojs/plugin-platform-lark'],
13+
defineConstants: {
14+
},
15+
copy: {
16+
patterns: [
17+
],
18+
options: {
19+
}
20+
},
21+
framework: 'react',
22+
mini: {
23+
postcss: {
24+
pxtransform: {
25+
enable: true,
26+
config: {
27+
28+
}
29+
},
30+
url: {
31+
enable: true,
32+
config: {
33+
limit: 1024 // 设定转换尺寸上限
34+
}
35+
},
36+
cssModules: {
37+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
38+
config: {
39+
namingPattern: 'module', // 转换模式,取值为 global/module
40+
generateScopedName: '[name]__[local]___[hash:base64:5]'
41+
}
42+
}
43+
}
44+
},
45+
h5: {
46+
publicPath: '/',
47+
staticDirectory: 'static',
48+
postcss: {
49+
autoprefixer: {
50+
enable: true,
51+
config: {
52+
}
53+
},
54+
cssModules: {
55+
enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
56+
config: {
57+
namingPattern: 'module', // 转换模式,取值为 global/module
58+
generateScopedName: '[name]__[local]___[hash:base64:5]'
59+
}
60+
}
61+
}
62+
}
63+
}
64+
65+
module.exports = function (merge) {
66+
if (process.env.NODE_ENV === 'development') {
67+
return merge({}, config, require('./dev'))
68+
}
69+
return merge({}, config, require('./prod'))
70+
}

config/prod.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
module.exports = {
2+
env: {
3+
NODE_ENV: '"production"'
4+
},
5+
defineConstants: {
6+
},
7+
mini: {},
8+
h5: {
9+
/**
10+
* 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
11+
* 参考代码如下:
12+
* webpackChain (chain) {
13+
* chain.plugin('analyzer')
14+
* .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
15+
* }
16+
*/
17+
}
18+
}

global.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path="node_modules/@tarojs/plugin-platform-weapp/types/shims-weapp.d.ts" />
2+
3+
declare module '*.png';
4+
declare module '*.gif';
5+
declare module '*.jpg';
6+
declare module '*.jpeg';
7+
declare module '*.svg';
8+
declare module '*.css';
9+
declare module '*.less';
10+
declare module '*.scss';
11+
declare module '*.sass';
12+
declare module '*.styl';
13+
14+
declare namespace NodeJS {
15+
interface ProcessEnv {
16+
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd'
17+
}
18+
}

package.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "taro-demo",
3+
"version": "1.0.0",
4+
"private": true,
5+
"description": "",
6+
"templateInfo": {
7+
"name": "default",
8+
"typescript": true,
9+
"css": "less"
10+
},
11+
"scripts": {
12+
"build:weapp": "taro build --type weapp",
13+
"build:tt": "taro build --type tt",
14+
"build:h5": "taro build --type h5",
15+
"dev:weapp": "npm run build:weapp -- --watch",
16+
"dev:tt": "npm run build:tt -- --watch",
17+
"dev:h5": "npm run build:h5 -- --watch"
18+
},
19+
"browserslist": [
20+
"last 3 versions",
21+
"Android >= 4.1",
22+
"ios >= 8"
23+
],
24+
"author": "",
25+
"dependencies": {
26+
"@babel/runtime": "^7.7.7",
27+
"@visactor/taro-vchart": "~1.5.4",
28+
"@tarojs/components": "3.3.17",
29+
"@tarojs/react": "3.3.17",
30+
"@tarojs/runtime": "3.3.17",
31+
"@tarojs/taro": "3.3.17",
32+
"@tarojs/plugin-framework-react": "3.6.18",
33+
"@tarojs/plugin-platform-weapp": "3.3.17",
34+
"@tarojs/plugin-platform-lark": "^1.0.4",
35+
"react": "^17.0.0",
36+
"react-dom": "^17.0.0"
37+
},
38+
"devDependencies": {
39+
"@babel/core": "^7.8.0",
40+
"@tarojs/mini-runner": "3.3.17",
41+
"@tarojs/webpack-runner": "3.3.17",
42+
"@types/react": "^17.0.2",
43+
"@types/webpack-env": "^1.13.6",
44+
"@typescript-eslint/eslint-plugin": "^4.15.1",
45+
"@typescript-eslint/parser": "^4.15.1",
46+
"babel-preset-taro": "3.3.17",
47+
"eslint": "^6.8.0",
48+
"eslint-config-taro": "3.3.17",
49+
"eslint-plugin-import": "^2.12.0",
50+
"eslint-plugin-react": "^7.8.2",
51+
"eslint-plugin-react-hooks": "^4.2.0",
52+
"stylelint": "9.3.0",
53+
"typescript": "^4.1.0"
54+
}
55+
}

0 commit comments

Comments
 (0)