The installation
Global installation
Yarn add XWL -cli -g/NPM install XWL -cli -g The xw command can be used in any position
Local installation
Yarn add XWL -cli -d / -s/NPM install XWL -cli -d / -s The xw command can be used only in the current directory
NPM package address
Command to introduce
Xw -v Displays the version number
Xw-h View the help information
All functional commands for the scaffold are listed with detailed descriptionsCopy the code
Xw d <directory> [repository] download the repository template
<directory> The local directory name [repository] is the name of the repository to be downloaded -> consists of the user name/project nameCopy the code
Sudo xw d aa sudo
Xw r <viewPath> <routePath> [routeName] Automatic routing
<viewPath> vue file path the value is a character string with '/' split path level. <routePath> route file path the value is a character string with '/' split path level [routeName] routeNameCopy the code
Xw s connect to server (this command is not implemented yet, no server practice)
You can connect to the server through sSH2Copy the code
Xw B is packaged and released
Executing xw b in the project root directory will perform a series of operations as follows:Copy the code
- Select the branch and pull the remote service code
- Install dependencies
- packaging
npm run build
- Move the package file to the service static directory
implementation
Required tool classes
chalk
Output color textcommander
Defining interactive commandsdownload-git-repo
Git gitinquirer
Collect user operationsjavascript-stringify
String to objectlog-symbols
Warning messageora
Loaded tipshelljs
A shell scriptssh2
Connecting to the server
Initialize scaffolding
-
NPM init initializes the project
Bin Adds an executable file
! /usr/bin/node tells the operating system to call the node interpreter under /usr/bin when executing the script.
! /usr/bin/env node is used in case the operating system user does not install node in the default /usr/bin directory. When the system sees this line, it first looks up the node installation path in the env setting, and then calls the corresponding path interpreter to complete the operation.
! /usr/bin/node is equivalent to writing down the node path;
! /usr/bin/env node looks for the node directory in the environment Settings. This is recommended
npm link [path]
Used to establish a connection between a local project and a local NPM module. Module tests can be performed locally (global without parameters).
npm unlink [path]
Address associated
Function Command Implementation
Xw d <directory> [repository] download the repository template
The download-git-repo package is used to download resources to the local PC
[Note:] Please refer to the above usage for filling in the warehouse name
Core code:
Xw r <viewPath> <routePath> [routeName] Automatic routing
xw r default/page1 default/page page1
Generate the corresponding VUE template by parsing viewPath (split string, detect file/clip state, write file) Generate the corresponding VUE template by parsing routePath (split string, detect file/clip state, read and write file, conversion between object strings)
Xw B is packaged and released
Pull git server code, install dependencies, package, move package files
release
NPM adduser Registers an NPM account
NPM login Account for logging in to the NPM
NPM publish Publishes the NPM package
Reasons for unsuccessful release:
- The package name is in use
- The login account is not authenticated by email
Verify that publishing is successful
- Log in to the NPM account
- NPM install
Update package
1. Change the version in package.json to a larger version than the previous one
2, NPM publish
NPM unpublish deletes a packet
The project address
Code warehouse
Post to recommend
- Encapsulate a simple WebSocket library
- Note: Vue often meet questions summary and analysis
- Proxy is an alternative to Object. DefineProperty in Vue3.0
- Vue 3.0 – First experience 1
- Figure out a prototype, a prototype object, a prototype chain
- Promise Principles = Build a Promise from 0 to 1
[Notes are not easy, if it is helpful to you, please like, thank you]