Publish package in the dist
directory for clean outputs
pnpm i -D soyo
We 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.md
Then manually run publish script:
cd ./dist && npm publish --registry https://registry.npmjs.com/
Note:
-
The fields in
package.json
are minimized, usepackage.json#soyo.fields
to add extra copies of fields. -
If
package.json#files
is 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 copy
then 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