fa-toolkit
v14.0.1-Stable.300
Published
a devtool for fast app
Downloads
83
Maintainers
Readme
fa-toolkit
How to Use
- Install fa-toolkit
npm install fa-toolkit -D
- Build the quick app
Before the compilation, ensure that the signature file exists in the project.
- Compile the project in the current path where fa-toolkit is installed.
node node_modules/webpack/bin/webpack.js --config ./node_modules/fa-toolkit/webpack.config.js
View the compilation progress.
node node_modules/webpack/bin/webpack.js --progress --config ./node_modules/fa-toolkit/webpack.config.js
- Compile the project in the specified path.
Install the dependency.
npm install cross-env -D
Specify the project root directory using projectRoot.
node ./node_modules/cross-env/src/bin/cross-env.js projectRoot=D:\com.quick.app node_modules/webpack/bin/webpack.js --config ./node_modules/fa-toolkit/webpack.config.js
Parameter description.
| Parameter| Data Type| Default Value| Description|
| ------- | --------- | --------- | --------- |
| projectRoot | string | Current path| Root directory, which must contain the src and sign directories and is the path where fa-toolkit is installed by default.|
| versionType | debug
| beta
| release
| debug | Compilation version. The code will be compressed and the signature file for release is needed except for the debug version.|
| showtime | boolean | false | Indicates whether to display the compilation duration.|
| norpk | boolean | false | Indicates whether to not generate an RPK file.|
| --env privateKey | string | | Private key, which is a webpack compilation parameter. The private.pem file under the same directory of the certificate file is used by default if the certificate file matches the private key. However, if the private.pem is deleted, you can use this parameter to specify the private key. The private key is the string left after you delete the start line, end line, and line breaks. The characters contained in the private key string should match the regular expression of /[a-zA-Z0-9+/=]/.|
Example:
Compile the release version.
node ./node_modules/cross-env/src/bin/cross-env.js projectRoot=D:\com.quick.app versionType=release node_modules/webpack/bin/webpack.js --config ./node_modules/fa-toolkit/webpack.config.js
Use the specified private key.
node ./node_modules/cross-env/src/bin/cross-env.js projectRoot=D:\com.quick.app versionType=release node_modules/webpack/bin/webpack.js --config ./node_modules/fa-toolkit/webpack.config.js --env privateKey=***
- Convert WeChat project to QuickAPP project
node ./lib/bin/wx2qa.js input.json
- Please replace the input.json with the real file path, and the file's content should be like below
{
"method": "convert",
"projectConfig": {
"sourceType": "wx",
"path": "",
"dist": ""
},
"appConfig":{
"packageName": "",
"appName": "",
"versionCode": "1",
"versionName": "1.0.0",
"icon": ""
},
"resConfig": {
}
}
- Parameter description
| Parameter| Data Type| Default Value| Required | Description| | ------- | --------- | --------- | --------- | --------- | | method | string | convert| yes | could be [convert|check], which mean to convert or check if the input project is legal | | sourceType | string | wx | yes | The platform of the input project, only support [wx] now | | path | string | - | yes | the path of WeChat project | | dist | string | - | yes | the path of output QuickApp Project | | packageName | string | - | yes | package name | | appName | string | - | yes | app name | | versionCode | string | 1 | yes | version code | | versionName | string | 1.0.0 | yes | version name | | icon | string | - | yes | the path of icon file |
- Output
The result is output at console, there are two kinds of output based on method [convert|check].
When method is convert, the ouput is as below
{
command: 'completeTransform',
errorMessage: '...',
folderUrl: '...'
}
| Parameter| Data Type| Default Value| Required | Description| | ------- | --------- | --------- | --------- | --------- | | command | string | completeTransform| yes | could be [completeTransform|failedTransform|notifyConfig], each mean success|failed|notify of loss of config file | | errorMessage | string | - | no | describe the reason when failed | | folderUrl | string | - | no | the path of output QuickApp Project |
When the method is check, the output should be like below
{
command: 'postInputPath',
data: {
returnCode: true,
outPath: '...'
}
}
| Parameter| Data Type| Default Value| Required | Description| | ------- | --------- | --------- | --------- | --------- | | command | string | postInputPath| yes | only support postInputPath now | | returnCode | boolean | true | yes | the result of check | | outPath | string | - | no | the suggested path of output QuickApp Project |