fool-deploy
v0.1.0
Published
a fast deploy your web project in linux server
Downloads
23
Maintainers
Readme
fool-deploy
You can use fool-deploy
to quickly and easily deploy your blogs, demos, frontend pages, and more on the server.
demo
Deploy the application created by vite
and create-react-app
:
Precondition
- a linux server.
- in your server install docker engine.(notes:Choose the type of installation for your server os type)
- Through
git
or XFTP orLinux rz
command will your project source code pull or copied to the server - Install
node
andnpm
on your server.
How use
- install deps
$ npm i fool-deploy
or
$ yarn add fool-deploy
or
$ pnpm i fool-deploy
- modify your package.json, add the following command:
"scripts": {
"deploy":"fool"
}
- in your web project root dir run:
$ npm run deploy
or
$ yarn deploy
or
$ pnpm deploy
Configuration
if you want custom config, you need create .foolrc
in project root dir.
{
"cache": true,
"port": 2333,
"packageCommand": "npm",
"buildCommand": "npm run build",
"nodeVersion": "18.14-alpine",
"nginxVersion": "1.22.1",
"imageName": "fool-deploy:prod",
"output": "dist"
}
cache
cache
:Indicates whether to use caching; defaults to true
。If you settrue
,The .fool-cache
directory will be generated at the root of the project after the first build.Each subsequent build will run the configuration file in .foolrc
with the same .foolrc
configuration.
Using caching can shorten the time it takes to deploy your project later.
port
port
:Indicates the port on which the project will run after deployment; defaults to 2333
。If the port number is occupied, it will automatically +1
until an available port number is found.
packageCommand
packageCommand
:Indicates the package manager used to install dependencies and build the project. By default, this will read the package manager you used to execute the deployment command.
for example you running yarn deploy
,the option is specified as yarn
。The configurable options are npm
| yarn
| pnpm
。This option is very important,
Suppose the npm
manager used by the project is packaged, but specified to run as yarn
at deployment time. This could cause dependencies to fail to install or build during deployment.
buildCommand
buildCommand
:Indicates the project build command,defaults to specified packageCommand
field [packageCommand] build
.
nodeVersion
nodeVersion
:Indicates the version of the node
environment required to install dependencies and packages for the deployed project.Default is 18.14-alpine
。
When this version does not meet the project packaging needs, choose a runnable version. More version information can be found at dockerhub node.
nginxVersion
nginxVersion
:Indicates the version of nginx
environment to run for the deployed project.Default is 1.22.1
。When this version does not meet the project packaging needs, choose a runnable version. More version information can be found at dockerhub nginx.
imageName
imageName
:Indicates the name of the image that docker
is building, and by default it reads the name
field in package.json
.the format is name:prod
。
output
output
:Indicates the bundled output directory of the project, equivalent to the output directory specified by webpack
. The default is dist
。If the output directory in your project is build
,You must specify it in .foolrc
. Otherwise, it will cause an error that the resouce cannot be found.