Getting Start
Environmental Preparation
The smallfish runtime environment needs to:
- node@v8.10 or above
- It is recommended to use yarn to do the package manager.
- It is recommended to use nvm for node environment management
Tips: smallfish has a lot of built-in tools for building web services, compiling code, testing, etc. on the node platform.
Installation node
nvm (recommended, skippable)
1. InstallationVisit the official website to download according to the guidelines.
node
2. InstallationVisit the official website to download according to the guidelines.
3. Check if the installation is correct.
$ node -v # output version and indicates successful installation
Starting with scaffolding
# clone Scaffolding code to project directory
$ git clone https://github.com/smallfishjs/smallfish-boilerplate-management-system.git my-project
#Enter project directory
$ cd my-project
#Installation dependency
$ npm install // or yarn
#Start service
$ npm start // or yarn start
# Open a browser to access http://127.0.0.1:8000 (the port number may change according to the situation)
Build a deployment
# can see the generated file under ./dist
$ npm build // or yarn build
Transformation of the original project
From bigfish
Changing from bigfish to smallfish is arguably the least costly, and it only takes the following steps:
- Open
package.json
and replace the bigfish command with smallfish - Globally replace all
@alipay/bigfish
dependencies with smallfish: - replace sdk with dva - All routers are related to 'smallfish/router' - smallfish package comparison table that may be needed during the replacement process - Modify
config/config.js
to switch configuration mode, see smallfish scaffolding - Compare smallfish scaffolding and remove redundant files and folders
From umi
Changing from umi to smallfish can be said to be the least costly, and only needs to be done in the following steps:
- Open
package.jso
n and replace the umi command with smallfish - Global replacement umi and other dependencies are smallfish; - smallfish package comparison table that may be needed during the replacement process
- Modify
config/config.js
to switch configuration mode, see smallfish scaffolding - Compare smallfish scaffolding and remove redundant files and folders
- The plural folder is changed to singular
From other projects
The transformation from other projects may be a bit more complicated. The corresponding module needs to be placed according to the standardized structure of smallfish. It is also necessary to understand the configuration related to smallfish. It is recommended to read the guidance document and then do the operation.