2.18.0 • Published 1 year ago

clean-release v2.18.0

Weekly downloads
135
License
MIT
Repository
github
Last release
1 year ago

clean-release

Dependency Status devDependency Status Build Status: Windows Github CI npm version Downloads type-coverage

A CLI tool to copy files to be released into a tmp clean directory for npm publishing, electronjs packaging, docker image creation or deployment

install

yarn global add clean-release

usage

run clean-release or clean-release --config clean-release.config.js or clean-release --config clean-release.config.ts

options

keydescription
-configconfig file
-h,--helpPrint this message.
-v,--versionPrint the version
--only-changed-packagesOnly changed packages will bump.
--effected-packagesThe packages will be considered as effected packages.

config

keytypedescription
includestring[]the files included, support glob
excludestring[]?the files excluded, support glob
basestring?the base path, eg: dist, then dist/foo/bar.js will be copied into foo as foo/bar.js
postScriptpostScriptpost script
releaseRepositorystring?used to publish to a git release repository, eg: https://github.com/plantain-00/baogame-release.git
releaseBranchNamestring?the branch name of the release repository
notCleanboolean?if true, do not clean the tmp directory
askVersionboolean?if true, will ask promp version
changesGitStagedboolean?if true, will make sure all changes is git staged
execOptionschildProcess.ExecOptions?passed to childProcess.exec
onlyChangedPackagesboolean?if true, for monorepo, only bump changed packages

post script

postScript?: Script | Script[];

import type * as cleanScripts from 'clean-scripts'

type Script = string | ((context: Context) => cleanScripts.Script) | ((context: Context) => Promise<cleanScripts.Script>)

type Context = {
  dir: string
  version: string
  tag: string | undefined
  effectedWorkspacePaths?: string[][]
}

npm package demo

const { name, devDependencies: { electron: electronVersion } } = require('./package.json')

module.exports = {
  include: [
    'bin/*',
    'dist/**/*',
    'LICENSE',
    'package.json',
    'README.md'
  ],
  exclude: [
  ],
  askVersion: true,
  changesGitStaged: true,
  postScript: ({ dir, version }) => [
    'git add package.json',
    `git commit -m "${version}"`,
    `git tag v${version}`,
    'git push',
    `git push origin v${version}`,
    `cd "${dir}" && npm i --production`,
    `prune-node-modules "${dir}/node_modules"`,
    `electron-packager "${dir}" "${name}" --out=dist --arch=x64 --electron-version=${electronVersion} --platform=darwin --ignore="dist/"`,
    `electron-packager "${dir}" "${name}" --out=dist --arch=x64 --electron-version=${electronVersion} --platform=win32 --ignore="dist/"`,
    `7z a -r -tzip dist/${name}-darwin-x64-${version}.zip dist/${name}-darwin-x64/`,
    `7z a -r -tzip dist/${name}-win32-x64-$${version}.zip dist/${name}-win32-x64/`,
    `electron-installer-windows --src dist/${name}-win32-x64/ --dest dist/`,
    `cd dist && create-dmg ${name}-darwin-x64/${name}.app`
  ]
}

yarn workspaces demo

export default {
  include: [
    'packages/*/dist/*',
    'packages/*/package.json',
    'packages/*/README.md',
    'LICENSE',
    'package.json',
    'README.md'
  ],
  exclude: [
  ],
  askVersion: true,
  changesGitStaged: true,
  postScript: ({ dir, tag, version, effectedWorkspacePaths }) => [
    ...effectedWorkspacePaths.map((w) => w.map((e) => {
      return tag
        ? `npm publish "${dir}/${e}" --access public --tag ${tag}`
        : `npm publish "${dir}/${e}" --access public`
    })),
    `git commit -m "${version}"`,
    `git tag -a v${version} -m 'v${version}'`,
    'git push',
    `git push origin v${version}`
  ]
}

electronjs packaging demo

module.exports = {
  include: [
    'libs.js',
    'main.js',
    'config.js',
    'index.css',
    'scripts/index.js',
    'index.html',
    'LICENSE',
    'package.json',
    'README.md'
  ],
  exclude: [
  ],
  postScript: ({ dir }) => [
    `cd "${dir}" && npm i --production`,
    `electron-packager "${dir}" "news" --out=dist --arch=x64 --version=1.2.1 --app-version="1.0.8" --platform=darwin --ignore="dist/"`,
    `electron-packager "${dir}" "news" --out=dist --arch=x64 --version=1.2.1 --app-version="1.0.8" --platform=win32 --ignore="dist/"`
  ]
}

docker demo

module.exports = {
  include: [
    'dist/*.js',
    'static/protocol.proto',
    'static/scripts/*.bundle-*.js',
    'static/index.html',
    'LICENSE',
    'package.json',
    'README.md',
    'Dockerfile'
  ],
  exclude: [
  ],
  postScript: ({ dir }) => [
    `cd "${dir}" && docker build -t plantain/baogame . && docker push plantain/baogame`
  ]
}

change logs

# v2
cd "${dir}"

# v1
cd ${dir}
2.18.0

1 year ago

2.17.1

1 year ago

2.17.0

2 years ago

2.16.0

2 years ago

2.15.2

4 years ago

2.15.1

4 years ago

2.15.0

4 years ago

2.14.0

4 years ago

2.13.0

4 years ago

2.12.0

4 years ago

2.11.0

4 years ago

2.10.0

4 years ago

2.9.1

4 years ago

2.9.0

4 years ago

2.8.0

4 years ago

2.7.6

4 years ago

2.7.5

4 years ago

2.7.4

4 years ago

2.7.3

4 years ago

2.7.2

4 years ago

2.7.1

4 years ago

2.7.0

6 years ago

2.6.0

6 years ago

2.5.3-alpha.0

6 years ago

2.5.2

6 years ago

2.5.1

6 years ago

2.5.1-alpha.6

6 years ago

2.5.1-alpha.5

6 years ago

2.5.1-alpha.4

6 years ago

2.5.1-alpha.3

6 years ago

2.5.1-alpha.2

6 years ago

2.5.1-alpha.1

6 years ago

2.5.1-alpha.0

6 years ago

2.5.0

6 years ago

2.5.0-beta.0

6 years ago

2.4.0

6 years ago

2.3.3

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.1.0

6 years ago

2.0.0

6 years ago

1.4.0

6 years ago

1.3.5

7 years ago

1.3.4

7 years ago

1.3.3

7 years ago

1.3.2

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago