Publish package in the dist directory for clean outputs
pnpm i -D soyoWe will use dist as the root directory for publish.
Copy dist files to dist/dist to prepare the publish directory:
# before
- dist
- output.js
- package.json
- README.md# after
- dist
# publish root directory
- dist
- output.js
- package.json
- README.md
- package.json
- README.mdThen manually run publish script:
cd ./dist && npm publish --registry https://registry.npmjs.com/Note:
-
The fields in
package.jsonare minimized, usepackage.json#soyo.fieldsto add extra copies of fields. -
If
package.json#filesis set, these files will be copied; otherwise, no files from the root directory will be copied.
Example:
// package.json
// will copy the following files to `dist/*`:
"files": [
"compiled",
"index.js",
"react.js"
],
// additional reserved fields:
"soyo": {
"fields": ["custom_field"]
},
"custom_field": "..."Run build script and copy files to dist to prepare the publish directory.
This will:
rm -rf ./dist
pnpm build
pnpm soyo copythen you can manually publish.
recommended set this to publish scripts:
// package.json
"scripts": {
"push": "soyo build && cd ./dist && npm publish --registry https://registry.npmjs.com/"
}MIT