Skip to content
/ soyo Public

Publish npm package in the dist directory for clean outputs

License

Notifications You must be signed in to change notification settings

xn-sakina/soyo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

soyo

Publish package in the dist directory for clean outputs

Install

  pnpm i -D soyo

Usage

We will use dist as the root directory for publish.

soyo copy

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:

  1. The fields in package.json are minimized, use package.json#soyo.fields to add extra copies of fields.

  2. 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": "..."

soyo build

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/"
  }

License

MIT