oneclickpush 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.js +10 -10
  2. package/package.json +2 -2
package/cli.js CHANGED
@@ -47,6 +47,12 @@ commands and full errors.`
47
47
 
48
48
  const LEVELS = ['silent', 'normal', 'verbose']
49
49
 
50
+ /** @param {string} msg @returns {never} */
51
+ const fail = (msg) => {
52
+ console.error(`${msg}\nTry "oneclickpush --help" for usage`)
53
+ process.exit(1)
54
+ }
55
+
50
56
  const { values: v, positionals } = (() => {
51
57
  try {
52
58
  return parseArgs({
@@ -67,9 +73,7 @@ const { values: v, positionals } = (() => {
67
73
  } catch (/** @type {any} */ e) {
68
74
  if (!e.code?.startsWith('ERR_PARSE_ARGS_')) throw e
69
75
  // Keep only the first sentence, Node appends a long "-- " hint to some messages
70
- const msg = e.message.split('. ')[0].replace(/\.$/, '')
71
- console.error(`${msg}, run "oneclickpush --help" for usage`)
72
- process.exit(1)
76
+ fail(e.message.split('. ')[0].replace(/\.$/, ''))
73
77
  }
74
78
  })()
75
79
 
@@ -85,19 +89,15 @@ if (v.version) {
85
89
  }
86
90
 
87
91
  if (positionals.length !== 1) {
88
- console.error(
89
- positionals.length === 0
90
- ? 'Missing required argument <dir>, run "oneclickpush --help" for usage'
91
- : 'Expected exactly one directory, run "oneclickpush --help" for usage'
92
+ fail(
93
+ positionals.length === 0 ? 'Missing required argument <dir>' : 'Expected exactly one directory'
92
94
  )
93
- process.exit(1)
94
95
  }
95
96
  const dir = positionals[0]
96
97
 
97
98
  const level = v['log-level']
98
99
  if (!LEVELS.includes(level)) {
99
- console.error(`Invalid --log-level "${level}", expected one of: ${LEVELS.join(', ')}`)
100
- process.exit(1)
100
+ fail(`Invalid --log-level "${level}", expected one of: ${LEVELS.join(', ')}`)
101
101
  }
102
102
 
103
103
  // Dead simple spinner (normal level, TTY only)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oneclickpush",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "One-click GitHub Pages deployer",
5
5
  "author": "Jason Lee <jason@zerodevx.com>",
6
6
  "scripts": {
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "devDependencies": {
13
13
  "@eslint/js": "^10.0.1",
14
- "eslint": "^10.12.0",
14
+ "eslint": "^10.13.0",
15
15
  "globals": "^17.13.0",
16
16
  "prettier": "^3.9.10",
17
17
  "typescript": "^7.0.2"