@tarojs/cli 4.0.0-canary.9 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +8 -8
- package/dist/cli.js +33 -24
- package/dist/cli.js.map +1 -1
- package/dist/commands/customCommand.js.map +1 -1
- package/dist/create/creator.js +1 -1
- package/dist/create/creator.js.map +1 -1
- package/dist/create/fetchTemplate.d.ts +1 -0
- package/dist/create/fetchTemplate.js +33 -27
- package/dist/create/fetchTemplate.js.map +1 -1
- package/dist/create/page.d.ts +7 -0
- package/dist/create/page.js +15 -10
- package/dist/create/page.js.map +1 -1
- package/dist/create/plugin.js +1 -1
- package/dist/create/plugin.js.map +1 -1
- package/dist/create/project.js +33 -31
- package/dist/create/project.js.map +1 -1
- package/dist/presets/commands/build.js +53 -35
- package/dist/presets/commands/build.js.map +1 -1
- package/dist/presets/commands/config.js +1 -1
- package/dist/presets/commands/config.js.map +1 -1
- package/dist/presets/commands/create.js +6 -0
- package/dist/presets/commands/create.js.map +1 -1
- package/dist/presets/commands/global-config.js +9 -3
- package/dist/presets/commands/global-config.js.map +1 -1
- package/dist/presets/commands/help.js +2 -2
- package/dist/presets/commands/help.js.map +1 -1
- package/dist/presets/commands/info.js +3 -3
- package/dist/presets/commands/info.js.map +1 -1
- package/dist/presets/commands/init.js +2 -1
- package/dist/presets/commands/init.js.map +1 -1
- package/dist/presets/commands/inspect.js +6 -6
- package/dist/presets/commands/inspect.js.map +1 -1
- package/dist/presets/commands/update.js +3 -3
- package/dist/presets/commands/update.js.map +1 -1
- package/dist/presets/constant/hooks.d.ts +1 -0
- package/dist/presets/constant/hooks.js +2 -1
- package/dist/presets/constant/hooks.js.map +1 -1
- package/dist/presets/files/generateFrameworkInfo.js.map +1 -1
- package/dist/presets/files/generateProjectConfig.js +1 -1
- package/dist/presets/files/generateProjectConfig.js.map +1 -1
- package/dist/presets/files/writeFileToDist.js +1 -1
- package/dist/presets/files/writeFileToDist.js.map +1 -1
- package/dist/presets/hooks/build.js +1 -0
- package/dist/presets/hooks/build.js.map +1 -1
- package/dist/presets/index.js +1 -1
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/platforms/plugin.js +14 -4
- package/dist/presets/platforms/plugin.js.map +1 -1
- package/dist/presets/platforms/rn.js +8 -9
- package/dist/presets/platforms/rn.js.map +1 -1
- package/dist/util/createPage.js +1 -1
- package/dist/util/createPage.js.map +1 -1
- package/dist/util/defineConfig.d.ts +1 -1
- package/dist/util/index.d.ts +1 -0
- package/dist/util/index.js +7 -3
- package/dist/util/index.js.map +1 -1
- package/package.json +27 -34
- package/src/__tests__/__mocks__/presets.ts +1 -1
- package/src/__tests__/build-config.spec.ts +2 -1
- package/src/__tests__/cli.spec.ts +12 -1
- package/src/__tests__/config.spec.ts +2 -1
- package/src/__tests__/doctor-config.spec.ts +2 -2
- package/src/__tests__/doctor-eslint.spec.ts +2 -28
- package/src/__tests__/doctor-recommand.spec.ts +2 -1
- package/src/__tests__/dotenv-parse.spec.ts +2 -2
- package/src/__tests__/fixtures/default/config/index.js +6 -0
- package/src/__tests__/info.spec.ts +2 -2
- package/src/__tests__/inspect.spec.ts +8 -3
- package/src/__tests__/update.spec.ts +3 -4
- package/src/__tests__/utils/index.ts +2 -1
- package/src/cli.ts +26 -17
- package/src/create/creator.ts +2 -1
- package/src/create/fetchTemplate.ts +39 -31
- package/src/create/page.ts +31 -16
- package/src/create/plugin.ts +2 -1
- package/src/create/project.ts +40 -40
- package/src/index.ts +2 -1
- package/src/presets/commands/build.ts +49 -33
- package/src/presets/commands/config.ts +1 -1
- package/src/presets/commands/create.ts +6 -0
- package/src/presets/commands/global-config.ts +17 -14
- package/src/presets/commands/info.ts +2 -1
- package/src/presets/commands/init.ts +2 -1
- package/src/presets/commands/inspect.ts +3 -2
- package/src/presets/commands/update.ts +3 -2
- package/src/presets/constant/hooks.ts +1 -0
- package/src/presets/files/generateProjectConfig.ts +1 -1
- package/src/presets/files/writeFileToDist.ts +1 -1
- package/src/presets/hooks/build.ts +1 -0
- package/src/presets/index.ts +1 -1
- package/src/presets/platforms/plugin.ts +13 -2
- package/src/presets/platforms/rn.ts +17 -6
- package/src/util/createPage.ts +1 -2
- package/src/util/defineConfig.ts +1 -1
- package/src/util/index.ts +6 -1
- package/templates/default/{_env.dev → _env.development} +1 -1
- package/templates/default/_env.production +1 -0
- package/templates/default/_env.test +1 -1
- package/templates/default/_eslintrc +1 -1
- package/templates/default/package.json.tmpl +63 -73
- package/templates/default/src/app.js +14 -12
- package/templates/default/src/pages/index/index.jsx +1 -2
- package/templates/default/src/pages/index/index.vue +0 -7
- package/templates/default/template_creator.js +22 -17
- package/templates/default/tsconfig.json +3 -2
- package/templates/default/types/global.d.ts +2 -2
- package/templates/plugin-compile/README.md +1 -1
- package/templates/plugin-compile/package.json.tmpl +3 -4
- package/templates/plugin-compile/src/index.ts +1 -1
- package/dist/config/babylon.d.ts +0 -3
- package/dist/config/babylon.js +0 -16
- package/dist/config/babylon.js.map +0 -1
- package/src/__tests__/fixtures/nerv/babel.config.js +0 -10
- package/src/__tests__/fixtures/nerv/config/dev.js +0 -9
- package/src/__tests__/fixtures/nerv/config/index.js +0 -70
- package/src/__tests__/fixtures/nerv/config/prod.js +0 -18
- package/src/__tests__/fixtures/nerv/package.json +0 -59
- package/src/__tests__/fixtures/nerv/src/app.config.ts +0 -11
- package/src/__tests__/fixtures/nerv/src/app.tsx +0 -10
- package/src/__tests__/fixtures/nerv/src/index.html +0 -19
- package/src/__tests__/fixtures/nerv/src/pages/index/index.config.ts +0 -3
- package/src/__tests__/fixtures/nerv/src/pages/index/index.tsx +0 -25
- package/src/__tests__/fixtures/vue/babel.config.js +0 -10
- package/src/__tests__/fixtures/vue/config/dev.js +0 -9
- package/src/__tests__/fixtures/vue/config/index.js +0 -70
- package/src/__tests__/fixtures/vue/config/prod.js +0 -18
- package/src/__tests__/fixtures/vue/package.json +0 -54
- package/src/__tests__/fixtures/vue/src/app.config.js +0 -11
- package/src/__tests__/fixtures/vue/src/app.js +0 -12
- package/src/__tests__/fixtures/vue/src/index.html +0 -19
- package/src/__tests__/fixtures/vue/src/pages/index/index.config.js +0 -3
- package/src/__tests__/fixtures/vue/src/pages/index/index.vue +0 -15
- package/src/config/babylon.ts +0 -16
- package/templates/default/__tests__/index.test.js.tmpl +0 -12
- package/templates/default/_env.prod +0 -1
- package/templates/default/jest.config.js +0 -6
- package/templates/default/project.tt.json +0 -9
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
5
|
-
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
|
|
6
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
-
<meta name="apple-touch-fullscreen" content="yes">
|
|
8
|
-
<meta name="format-detection" content="telephone=no,address=no">
|
|
9
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="white">
|
|
10
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
|
|
11
|
-
<title></title>
|
|
12
|
-
<script>
|
|
13
|
-
!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);
|
|
14
|
-
</script>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div id="app"></div>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import Nerv, { Component } from 'nervjs'
|
|
2
|
-
import { View, Text } from '@tarojs/components'
|
|
3
|
-
|
|
4
|
-
const a = 1
|
|
5
|
-
|
|
6
|
-
export default class Index extends Component {
|
|
7
|
-
|
|
8
|
-
componentWillMount () { }
|
|
9
|
-
|
|
10
|
-
componentDidMount () { }
|
|
11
|
-
|
|
12
|
-
componentWillUnmount () { }
|
|
13
|
-
|
|
14
|
-
componentDidShow () { }
|
|
15
|
-
|
|
16
|
-
componentDidHide () { }
|
|
17
|
-
|
|
18
|
-
render () {
|
|
19
|
-
return (
|
|
20
|
-
<View className='index'>
|
|
21
|
-
<Text>Hello world!</Text>
|
|
22
|
-
</View>
|
|
23
|
-
)
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
projectName: 't4',
|
|
3
|
-
date: '2020-5-28',
|
|
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: [],
|
|
13
|
-
defineConstants: {
|
|
14
|
-
},
|
|
15
|
-
copy: {
|
|
16
|
-
patterns: [
|
|
17
|
-
],
|
|
18
|
-
options: {
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
framework: 'vue',
|
|
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
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "t4",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "",
|
|
6
|
-
"templateInfo": {
|
|
7
|
-
"name": "default",
|
|
8
|
-
"typescript": false,
|
|
9
|
-
"css": "none"
|
|
10
|
-
},
|
|
11
|
-
"scripts": {
|
|
12
|
-
"build:weapp": "taro build --type weapp",
|
|
13
|
-
"build:swan": "taro build --type swan",
|
|
14
|
-
"build:alipay": "taro build --type alipay",
|
|
15
|
-
"build:tt": "taro build --type tt",
|
|
16
|
-
"build:h5": "taro build --type h5",
|
|
17
|
-
"build:rn": "taro build --type rn",
|
|
18
|
-
"build:qq": "taro build --type qq",
|
|
19
|
-
"build:quickapp": "taro build --type quickapp",
|
|
20
|
-
"dev:weapp": "npm run build:weapp -- --watch",
|
|
21
|
-
"dev:swan": "npm run build:swan -- --watch",
|
|
22
|
-
"dev:alipay": "npm run build:alipay -- --watch",
|
|
23
|
-
"dev:tt": "npm run build:tt -- --watch",
|
|
24
|
-
"dev:h5": "npm run build:h5 -- --watch",
|
|
25
|
-
"dev:rn": "npm run build:rn -- --watch",
|
|
26
|
-
"dev:qq": "npm run build:qq -- --watch",
|
|
27
|
-
"dev:quickapp": "npm run build:quickapp -- --watch"
|
|
28
|
-
},
|
|
29
|
-
"browserslist": [
|
|
30
|
-
"last 3 versions",
|
|
31
|
-
"Android >= 4.1",
|
|
32
|
-
"ios >= 8"
|
|
33
|
-
],
|
|
34
|
-
"author": "",
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@babel/runtime": "^7.7.7",
|
|
37
|
-
"@tarojs/components": "3.0.0-rc.0",
|
|
38
|
-
"@tarojs/runtime": "3.0.0-rc.0",
|
|
39
|
-
"@tarojs/taro": "3.0.0-rc.0",
|
|
40
|
-
"vue-template-compiler": "^2.5.0",
|
|
41
|
-
"vue": "^2.5.0"
|
|
42
|
-
},
|
|
43
|
-
"devDependencies": {
|
|
44
|
-
"@types/webpack-env": "^1.13.6",
|
|
45
|
-
"@tarojs/mini-runner": "3.0.0-rc.0",
|
|
46
|
-
"@babel/core": "^7.8.0",
|
|
47
|
-
"@tarojs/webpack-runner": "3.0.0-rc.0",
|
|
48
|
-
"babel-preset-taro": "3.0.0-rc.0",
|
|
49
|
-
"eslint": "^8.12.0",
|
|
50
|
-
"eslint-config-taro": "3.0.0-rc.0",
|
|
51
|
-
"eslint-plugin-vue": "^9.x",
|
|
52
|
-
"stylelint": "9.3.0"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
|
|
5
|
-
<meta content="width=device-width,initial-scale=1,user-scalable=no" name="viewport">
|
|
6
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
-
<meta name="apple-touch-fullscreen" content="yes">
|
|
8
|
-
<meta name="format-detection" content="telephone=no,address=no">
|
|
9
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="white">
|
|
10
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" >
|
|
11
|
-
<title></title>
|
|
12
|
-
<script>
|
|
13
|
-
!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);
|
|
14
|
-
</script>
|
|
15
|
-
</head>
|
|
16
|
-
<body>
|
|
17
|
-
<div id="app"></div>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
package/src/config/babylon.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ParserOptions } from '@babel/parser'
|
|
2
|
-
|
|
3
|
-
const config: ParserOptions = {
|
|
4
|
-
sourceType: 'module',
|
|
5
|
-
plugins: [
|
|
6
|
-
'typescript',
|
|
7
|
-
'classProperties',
|
|
8
|
-
'jsx',
|
|
9
|
-
'asyncGenerators',
|
|
10
|
-
'objectRestSpread',
|
|
11
|
-
'decorators',
|
|
12
|
-
'dynamicImport'
|
|
13
|
-
]
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default config
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{{#if (includes "React" "Preact" s=framework)}}import TestUtils from '@tarojs/test-utils-react'{{/if}}{{#if (eq framework "Vue3") }}import TestUtils from '@tarojs/test-utils-vue3'{{/if}}{{#if (eq framework "Vue") }}import TestUtils from '@tarojs/test-utils-vue'{{/if}}
|
|
2
|
-
|
|
3
|
-
describe('Testing', () => {
|
|
4
|
-
|
|
5
|
-
test('Test', async () => {
|
|
6
|
-
const testUtils = new TestUtils()
|
|
7
|
-
await testUtils.createApp()
|
|
8
|
-
await testUtils.PageLifecycle.onShow('pages/index/index')
|
|
9
|
-
expect(testUtils.html()).toMatchSnapshot()
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
# TARO_APP_ID="生产环境下的小程序appid"
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
{{#if (includes "React" "Preact" s=framework)}}const defineJestConfig = require('@tarojs/test-utils-react/dist/jest.js').default{{/if}}{{#if (eq framework "Vue3") }}const defineJestConfig = require('@tarojs/test-utils-vue3/dist/jest.js').default{{/if}}{{#if (eq framework "Vue") }}const defineJestConfig = require('@tarojs/test-utils-vue/dist/jest.js').default{{/if}}
|
|
2
|
-
|
|
3
|
-
module.exports = defineJestConfig({
|
|
4
|
-
testEnvironment: 'jsdom',
|
|
5
|
-
testMatch: ['<rootDir>/__tests__/?(*.)+(spec|test).[jt]s?(x)']
|
|
6
|
-
})
|