Skip to content

Commit 5482e78

Browse files
committed
updated
1 parent cb94e02 commit 5482e78

13 files changed

+41
-5
lines changed

bin/dev.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ myPublisher({
1515
path: CURRENT_DIR,
1616
message: 'my message',
1717
access: ACCESS || 'public',
18-
release: RELEASE || 'auto'
18+
release: RELEASE || 'auto',
19+
'publish-only': 'enabled',
1920
})
2021

2122

bin/index.js

+5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ const cli = meow(`
2121
$ publish -p . -m "release new version" --access private --release minor
2222
`, {
2323
flags: {
24+
'publish-only': {
25+
type: "string",
26+
alias: 'po',
27+
default: 'disabled'
28+
},
2429
message: {
2530
type: 'string',
2631
alias: 'm',

src/core/_validateArgs.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = (args = {}) => {
2-
const {message, path, access, release} = args
2+
const {message, path, access, release, 'publish-only': publishOnly} = args
33
const currentPath = process.cwd()
44
const vPath = path || currentPath
55

@@ -8,6 +8,7 @@ module.exports = (args = {}) => {
88
message: message || 'upgraded',
99
currentDir: vPath,
1010
release,
11+
publishOnly,
1112
}
1213
}
1314

src/scripts/back-to-develop.js

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const SimpleGit = require('simple-git/promise')
22

33

44
module.exports = async (args, context) => {
5+
const {publishOnly} = args
6+
if (publishOnly === 'enabled') return context
7+
58
const {currentDir} = args
69
const git = SimpleGit(currentDir)
710

src/scripts/commit-new-version.js

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const ora = require('ora')
44

55

66
module.exports = async (args, context) => {
7+
const {publishOnly} = args
8+
if (publishOnly === 'enabled') return context
9+
710
const spinner = ora(`Committing...`).start()
811

912
try {

src/scripts/create-tag.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ module.exports = async (args, context) => {
88
try {
99
const {currentDir, message} = args
1010
const git = SimpleGit(currentDir)
11+
const {version: _version} = context.getValue('packageJSON')
1112

12-
const currentVersion = context.getValue('newVersion')
13+
const currentVersion = context.getValue('newVersion') || _version
1314
const version = `release/v${currentVersion}`
1415
const rMessage = `Release: ${message}`
1516

src/scripts/hide-npmrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const _hideNPMrc = require('../core/_hideNPMrc')
22

33

44
module.exports = async (args, context) => {
5+
const {publishOnly} = args
6+
if (publishOnly === 'enabled') return context
7+
58
const {currentDir} = args
69
await _hideNPMrc(currentDir)
710

src/scripts/increase-version.js

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ const ora = require('ora')
44

55

66
module.exports = async (args, context) => {
7+
const {publishOnly} = args
8+
if (publishOnly === 'enabled') return context
9+
710
const spinner = ora('Check package version').start()
811

912
try {

src/scripts/make-sure-develop-branch.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ const SimpleGit = require('simple-git/promise')
22

33

44
module.exports = async (args, context) => {
5-
const {currentDir} = args
5+
const {currentDir, publishOnly} = args
6+
if (publishOnly === 'enabled') return context
7+
68
const git = SimpleGit(currentDir)
79

810
const {current: currentBranch, all: allBranches} = await git.branch()

src/scripts/mergeIntoMaster.js

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const ora = require('ora')
33

44

55
module.exports = async (args, context) => {
6+
const {publishOnly} = args
7+
if (publishOnly === 'enabled') return context
8+
69
const spinner = ora('Merging develop into master...').start()
710

811
try {

src/scripts/npm-publish.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const ora = require('ora')
55

66

77
module.exports = async (args, context) => {
8+
const {publishOnly} = args
9+
810
const spinner = ora('Publishing...').start()
911

1012
try {
@@ -15,7 +17,10 @@ module.exports = async (args, context) => {
1517
options.push('--access', 'public')
1618
}
1719

18-
await _copyGlobalNPMrc(currentDir)
20+
if (publishOnly !== 'enabled') {
21+
await _copyGlobalNPMrc(currentDir)
22+
}
23+
1924
const {stdout} = await execa('npm', options)
2025
spinner.succeed('NPM publish output:')
2126
spinner.succeed(stdout).stop()

src/scripts/restore-npmrc.js

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ const _showNPMrc = require('../core/_showNPMrc')
22

33

44
module.exports = async (args, context) => {
5+
const {publishOnly} = args
6+
if (publishOnly === 'enabled') return context
7+
58
const {currentDir} = args
69
await _showNPMrc(currentDir)
710

src/scripts/up-to-date.js

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ const ora = require('ora')
33

44

55
module.exports = async (args, context) => {
6+
const {publishOnly} = args
7+
if (publishOnly === 'enabled') return context
8+
69
const spinner = ora(`Check develop up-to-date...`).start()
710

811
try {

0 commit comments

Comments
 (0)