commit | 0cc30cc0976ae84a71e3c4ab51ccdc1f91f5deb1 | [log] [tgz] |
---|---|---|
author | Mario <faterrole@gmail.com> | Fri Jan 04 17:01:11 2019 +0800 |
committer | GitHub <noreply@github.com> | Fri Jan 04 17:01:11 2019 +0800 |
tree | 8725332b9aed6ec469b7f1e660ac4fc61911996c | |
parent | bd96035d55782c6b9c568e592d8752b26947c229 [diff] |
Update README-zh.md style formate
weex-toolkit is the official command line tool for helping developers create, debug and build their Weex project.
$ npm install -g weex-toolkit
You can use the weex -v
command to confirm that the installation was successful.
If you have never installed node.js, you should go to nodejs.org to download and install it.
NOTE: The node version must be 6.0 or higher, you can try n to manage your node versions, and we recommend that you use
npm4
before fixing the konw issues onnpm5
. If an error occurs while installing, please go weex-toolkit issues or weex-toolkit faq to find solutions or have a discussion with us.
You can use weex create
to create an official weex project.
Warning: to create the project base on
weex-toolkit@1.0
, you should run commandweex create weex-templates/webpack#v1.0 [projectname]
.
# create a new project with an official template $ weex create my-project # create a new project straight from a github template $ weex create username/repo my-project
Create a new project with an official template or from other remote, also you can create your own weex template, more detail you can see How-to-create-your-own-template.
You can use weex compile
to preview your Weex file(.vue
) in a watch mode. You only need specify your file path.
$ weex preview src/foo.vue
The browser automatically opens the preview page and you can see the layout and effects of your weex page. If you have a Playground App in your mobile devices, you can scan the QR code at the opened page.
Try the command below, you’ll preview the whole directory files.
$ weex preview src --entry src/foo.vue
You need to specify the folder path to preview and the entry file (passed in via --entry
).
You can use weex compile
to compile a single weex file or a weex file in an entire folder.
$ weex compile [source] [dist] [options]
Option | Description |
---|---|
-w, --watch | watch we file changes auto build them and refresh debugger page! [default true ] |
-d,--devtool [devtool] | set webpack devtool mode |
-e,--ext [ext] | set enabled extname for compiler default is vue |
-m, --min | set jsbundle uglify or not. [default false ] |
You can use like this:
$ weex compile src dest --devtool source-map -m
You can use weex platform [add|remove|update] [ios|android]
to add, remove or update your ios / android project templates.
# add weex platform $ weex platform add [ios|android] # remove weex platform $ weex platform remove [ios|android] # update weex platform $ weex platform update [ios|android] # list weex platform $ weex platform list
Use weex platform list
to show what platforms your application supported.
You can use weex-toolkit
to run project on android/ios/web.
# run weex Android project $ weex run android # run weex iOS project $ weex run ios # run weex web $ weex run web
Weex Debugger is a custom devtools for Weex that implements Chrome Debugging Protocol, it is designed to help you quickly inspect your app and debug your JS bundle source in a Chrome web page, both android and iOS platform are supported. So you can use weex-devtools feature by weex-toolkit.
weex debug [we_file|bundles_dir] [options]
Option | Description |
---|---|
-V, --verbose | display logs of debugger server |
-v, --version | display version |
-p, --port [port] | set debugger server port |
-e, --entry [entry] | set the entry bundlejs path when you specific the bundle server root path |
-m, --mode [mode] | set build mode [transformer or loader] |
-w, --watch | watch we file changes auto build them and refresh debugger page [default true ] |
--ip [ip] | set the host ip of debugger server |
--loglevel [loglevel] | set log level |
--min | set jsbundle uglify or not. [default false ] |
--remotedebugport [remotedebugport] | set the remote debug port,default 9222 |
Please make sure that the node version is above 6.0 and npm version is above 5.0.
If you want to change the origin of the npm registry, do not use cnpm
. We recommend using the nrm
or npm config set registry https://registry.npm.taobao.org
command.
As of version 1.0.9, the weex init
command has been removed. To create a weex project, use the weex create
command.
First of all, please do not install with “sudo” If a permission denied
error occurs, please try sudo chmod 777 /usr/local/lib/node_modules
If the following error occurs:
Error: permission denied. Please apply the write permission to the directory: "/Users/yourUserName"
We suggest you run the command sudo chmod 777 ~
or mkdir ~/.xtoolkit && chmod 777 ~/.xtoolkit
.
Windows users may have fsevents installation problems, for example:
fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
To avoid this error, install weex-toolkit without the optional dependencies with the following command:
npm install --no-optional weex-toolkit -g
Try:
weex xbind repair toolkit-repair weex repair
If you encounter an error during the upgrade process, please check that the version of your npm is above 5.0.
Then reload it with the following commands:
rm -rf ~/.xtoolkit npm un weex-toolkit -g npm i weex-toolkit -g
If you want to run an Android project, you can use the Android Emulator from Android Studio or a real device.
If you install Android SDK from Android Studio, please ensure to install the Android 6.0 API.
This problem may occur when using the following commands weex create|init|run|platform
. Please update your weexpack to the latest version to resolve this issue.
$ weex update weexpack
If there are errors while updating the weexpack, please remove ~/.xtoolkit
and try to update again.
$ rm -rf ~/.xtoolkit $ weex update weexpack
Description: This is a typical Hoisting
issue. Please take a look at the MDN Hoisting documentation for the steps to resolve this issue:
In the file webpack.common.config.js
, located in the configs
directory, change:
contents += `\nimport App from '${relativeVuePath}';\n`;
to
contents += `\nconst App = require('${relativeVuePath}');\n`;
Upgrade your weexpack
to the latest version by using the command weex update weexpack@latest
, then re-create the project again. The latest version should above v1.0.13
.
If you have any unsolvable problems, try and check your system environment, your installed package version (weex -v
), and upgrading to the latest package (weex update weex-devtool@latest
) to see if the problems are resolved.