@plaoc/cli
This is the plaoc command line tool, responsible for the development, packaging and publishing of plaoc apps.
This cli tool also has the functions of publishing tools and verifying apps. It can also use plaoc run
to cooperate with the server for quick packaging and publishing of applications.
Installation
- First you need to install the plaoc command line tool.
pnpm add -g @plaoc/cli
yarn global add @plaoc/cli
npm i -g @plaoc/cli
You can also use npx plaoc to execute commands
Assuming the project directory is as follows:
plaoc-app
├── ......other project files
├── manifest.json
└── plaoc.json
Development mode
Development mode mainly cooperates with dweb_browser
desktop version for dynamic development. The command is as follows:
plaoc serve http://localhost:5173
The above command will print as follows:
metadata: http://127.0.0.1:8096/metadata.json
metadata: http://172.30.93.43:8096/metadata.json
This is a pure forwarding mode. Plaoc will proxy the http://localhost:5173
development service you started.
Specify startup port
Generally used when starting multiple apps. You can use --port
to specify the port to open. The default port is 8096.
plaoc serve http://localhost:5173 --port 8097
manifest.json
directory
Specify If you are not currently in the project root directory, you need to use --dir
to specify the address of manifest.json
to identify the app configuration information.
plaoc serve http://localhost:5173 --dir ./plaoc-app1
Package project
Normal packaging command is as follows:
plaoc bundle ./dist
The ./dist
directory is the source code directory for your packaging. And you need to make sure that the folder where you run the plaoc command is at the same level as your manifest.json
folder.
If not in the same directory, you can refer to the --dir
directory below for specification.
Note
Note that plaoc bundle http://localhost:5173 cannot be used to package a dynamic service.
manifest.json
directory
Specify If your manifest.json
is not in the same folder as the packaging directory, you can use --dir
to specify the manifest.json
folder.
Assuming the project directory is as follows:
plaoc-main
├── ......other project files
├── plaoc-app1
├── ./dist //Project packaged source code files
├── manifest.json
├── plaoc-app2
├── ./dist //Project packaged source code files
└── manifest.json
If you have multiple projects under your directory, you can specify the directory to package them like below.
plaoc bundle ./plaoc-app1/dist --dir ./plaoc-app1
ps: You can also use
plaoc bundle --help
to check.
Specify output package output file location
Use --out
to specify output directory name. The default is bundle
.
plaoc bundle ./dist --out ./bundleDir
Specify output appId
Use --id
to specify the app id.
plaoc bundle ./dist --id new.plaoc.org.dweb
Note that the specified id must end with .dweb
and have the same domain name as the configured home
.
Specify output app version
Use --version
to specify the app version.
plaoc bundle ./dist --version 0.2.3