14.0.1-Stable.300 • Published 2 months ago

fa-toolkit v14.0.1-Stable.300

Weekly downloads
-
License
-
Repository
-
Last release
2 months ago

fa-toolkit

How to Use

  1. Install fa-toolkit
npm install fa-toolkit -D
  1. Build the quick app

Before the compilation, ensure that the signature file exists in the project.

1) 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

2) 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.

ParameterData TypeDefault ValueDescription
projectRootstringCurrent pathRoot directory, which must contain the src and sign directories and is the path where fa-toolkit is installed by default.
versionTypedebug | beta | releasedebugCompilation version. The code will be compressed and the signature file for release is needed except for the debug version.
showtimebooleanfalseIndicates whether to display the compilation duration.
norpkbooleanfalseIndicates whether to not generate an RPK file.
--env privateKeystringPrivate 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=***

OPEN SOURCE SOFTWARE NOTICE

  1. Convert WeChat project to QuickAPP project
node ./lib/bin/wx2qa.js input.json

1) 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": {
        
    }
}

2) Parameter description

ParameterData TypeDefault ValueRequiredDescription
methodstringconvertyescould be convert|check, which mean to convert or check if the input project is legal
sourceTypestringwxyesThe platform of the input project, only support wx now
pathstring-yesthe path of WeChat project
diststring-yesthe path of output QuickApp Project
packageNamestring-yespackage name
appNamestring-yesapp name
versionCodestring1yesversion code
versionNamestring1.0.0yesversion name
iconstring-yesthe path of icon file
  1. 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: '...'
}
ParameterData TypeDefault ValueRequiredDescription
commandstringcompleteTransformyescould be completeTransform|failedTransform|notifyConfig, each mean success|failed|notify of loss of config file
errorMessagestring-nodescribe the reason when failed
folderUrlstring-nothe path of output QuickApp Project

When the method is check, the output should be like below

{
    command: 'postInputPath',
    data: {
        returnCode: true,
        outPath: '...'
    }
}
ParameterData TypeDefault ValueRequiredDescription
commandstringpostInputPathyesonly support postInputPath now
returnCodebooleantrueyesthe result of check
outPathstring-nothe suggested path of output QuickApp Project