publish-latest

2018-09-15 admin

publish-latest是什么

什么是publish-latest,Script to publish generated files to a latest branch

publish-latest使用教程帮助文档

publish-latest (UNMAINTAINED)

See the beginning edit of this blogpost for an explination of why this package is no longer necessary.

Status: npm version npm downloads Build Status Code Coverage

A script to allow you to publish the generated built files of your project to a specific branch in your repository.

I use this as part of my travis build with semantic-release. I run the build as a prepublish script, then as a postpublish script, I run this script which commits the built files and pushes them to my latest branch. Then semantic-release post will create a release on github with that commit.

Usage

{
  "scripts": {
    "build": "echo 'building project'",
    "prepublish": "npm run build",
    "postpublish": "publish-latest",
    "semantic-release": "semantic-release pre && npm publish && semantic-release post"
  }
}

CLI Options

You can pass several options to publish-latest to override the defaults. Here’s the output of --help

$ publish-latest --help

  Usage: publish-latest [options]

  Options:

    -h, --help                       output usage information
    -V, --version                    output the version number
    -e, --user-email [email]         User email to use for the release commit (defaults to author/first contributor email)
    -n, --user-name [name]           User name to use for the release commit (defaults to author/first contributor name)
    -b, --branch [name]              The branch to push the latest to (defaults to `latest`)
    -u, --url [url]                  The git URL to publish to (defaults to project git url)
    -r, --release-version [version]  Version to release (defaults to package.json version)
    -a, --add "[file1 dir1 file2]"   Files to add (defaults to `package.json dist`)
    -t, --temp-branch [name]         Temp branch used for preparing the release (defaults to tmp/travis)

ENV variables

If you do not specify a url then the script will derive one from your package.json and then the script will add a token to the GitHub URL so the commit can be pushed. This token comes from either BOT_GH_TOKEN or GH_TOKEN.

UNMAINTAINED

I created this tool to solve issues mentioned in my blogpost Why I don’t commit generated files to master, however there is a service called unpkg.com which mostly solves the problems I’ve mentioned in that blogpost. So I no longer need this tool and will not plan on maintaining it. If you’re personally seriously interested in taking it on, please let me know!

LICENSE

MIT

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-40316.html

文章标题:publish-latest

回到顶部