squared 0.4.36 → 0.5.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +64 -529
- data/README.md +1283 -663
- data/README.ruby.md +722 -0
- data/lib/squared/common/base.rb +8 -9
- data/lib/squared/common/format.rb +26 -39
- data/lib/squared/common/prompt.rb +46 -51
- data/lib/squared/common/shell.rb +50 -70
- data/lib/squared/common/system.rb +34 -37
- data/lib/squared/common/utils.rb +3 -28
- data/lib/squared/common.rb +2 -1
- data/lib/squared/config.rb +30 -33
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/application.rb +82 -122
- data/lib/squared/workspace/project/base.rb +432 -578
- data/lib/squared/workspace/project/docker.rb +186 -214
- data/lib/squared/workspace/project/git.rb +368 -512
- data/lib/squared/workspace/project/node.rb +195 -315
- data/lib/squared/workspace/project/python.rb +125 -355
- data/lib/squared/workspace/project/ruby.rb +258 -340
- data/lib/squared/workspace/project/support/class.rb +92 -313
- data/lib/squared/workspace/project.rb +0 -10
- data/lib/squared/workspace/repo.rb +58 -99
- data/lib/squared/workspace/series.rb +41 -47
- data/lib/squared/workspace/support/data.rb +3 -2
- data/lib/squared/workspace/support.rb +0 -1
- data/lib/squared/workspace.rb +3 -5
- data/squared.gemspec +5 -5
- metadata +7 -8
- data/lib/squared/common/class.rb +0 -186
- data/lib/squared/workspace/support/base.rb +0 -32
|
@@ -5,37 +5,33 @@ module Squared
|
|
|
5
5
|
module Project
|
|
6
6
|
class Node < Git
|
|
7
7
|
OPT_NPM = {
|
|
8
|
-
common: %w[dry-run
|
|
9
|
-
install: %w[package-lock-only
|
|
10
|
-
install_base: %w[
|
|
11
|
-
package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
|
8
|
+
common: %w[dry-run include-workspace-root workspaces=b? w|workspace=v].freeze,
|
|
9
|
+
install: %w[prefer-dedupe package-lock-only cpu=b libc=b os=b].freeze,
|
|
10
|
+
install_base: %w[ignore-scripts install-links strict-peer-deps include=b omit=b install-strategy=b].freeze,
|
|
12
11
|
install_no: %w[audit bin-links fund package-lock].freeze,
|
|
13
|
-
install_as: %w[no-save
|
|
14
|
-
S|save
|
|
15
|
-
run: %w[foreground-scripts
|
|
12
|
+
install_as: %w[foreground-scripts g|global no-save save save-bundle save-dev E|save-exact save-optional
|
|
13
|
+
save-peer S|save-prod].freeze,
|
|
14
|
+
run: %w[foreground-scripts if-present ignore-scripts script-shell=p].freeze,
|
|
16
15
|
exec: %w[c|call=q package=b].freeze,
|
|
17
|
-
pack: %w[ignore-scripts
|
|
16
|
+
pack: %w[json ignore-scripts pack-destination=p].freeze
|
|
18
17
|
}.freeze
|
|
19
18
|
OPT_PNPM = {
|
|
20
|
-
common: %w[aggregate-output color
|
|
21
|
-
r|recursive w|workspace-root].freeze,
|
|
22
|
-
cpu: %w[cpu=b libc=b os=b].freeze,
|
|
19
|
+
common: %w[aggregate-output color no-color stream use-stderr C|dir=p loglevel=b w|workspace-root].freeze,
|
|
23
20
|
filter: %w[fail-if-no-match changed-files-ignore-pattern=q filter=q filter-prod=q test-pattern=q].freeze,
|
|
24
21
|
install: %w[fix-lockfile force ignore-pnpmfile ignore-workspace lockfile-only merge-git-branch-lockfiles
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
no-hoist no-lockfile no-optional prefer-frozen-lockfile resolution-only shamefully-hoist
|
|
23
|
+
side-effects-cache side-effects-cache-readonly s|silent strict-peer-dependencies
|
|
27
24
|
use-running-store-server use-store-server child-concurrency=i hoist-pattern=q lockfile-dir=p
|
|
28
25
|
modules-dir=p network-concurrency=i package-import-method=b public-hoist-pattern=q
|
|
29
26
|
reporter=b].freeze,
|
|
30
|
-
install_base: %w[
|
|
31
|
-
virtual-store-dir=p].freeze,
|
|
27
|
+
install_base: %w[global-dir ignore-scripts offline prefer-offline store-dir=p virtual-store-dir=p].freeze,
|
|
32
28
|
install_no: %w[frozen-lockfile verify-store-integrity].freeze,
|
|
33
|
-
install_as: %w[D|dev no-optional P|prod].freeze,
|
|
34
|
-
update: %w[
|
|
29
|
+
install_as: %w[D|dev global-dir no-optional P|prod r|recursive].freeze,
|
|
30
|
+
update: %w[global interactive latest depth=i].freeze,
|
|
35
31
|
dedupe: %w[check].freeze,
|
|
36
|
-
run: %w[if-present no-bail parallel report-summary reporter-hide-prefix resume-from
|
|
37
|
-
|
|
38
|
-
exec: %w[no-reporter-hide-prefix parallel report-summary resume-from c|shell-mode].freeze,
|
|
32
|
+
run: %w[if-present no-bail parallel r|recursive report-summary reporter-hide-prefix resume-from sequential
|
|
33
|
+
stream use-stderr].freeze,
|
|
34
|
+
exec: %w[no-reporter-hide-prefix parallel r|recursive report-summary resume-from c|shell-mode].freeze,
|
|
39
35
|
pack: %w[json pack-destination=p pack-gzip-level=i].freeze
|
|
40
36
|
}.freeze
|
|
41
37
|
OPT_YARN = {
|
|
@@ -98,10 +94,11 @@ module Squared
|
|
|
98
94
|
'add' => nil,
|
|
99
95
|
'run' => nil,
|
|
100
96
|
'exec' => nil,
|
|
97
|
+
'nvm' => nil,
|
|
101
98
|
'pack' => nil
|
|
102
99
|
})
|
|
103
100
|
|
|
104
|
-
def initialize(*,
|
|
101
|
+
def initialize(*, **kwargs)
|
|
105
102
|
super
|
|
106
103
|
if @pass.include?(Node.ref)
|
|
107
104
|
initialize_ref Node.ref
|
|
@@ -110,8 +107,8 @@ module Squared
|
|
|
110
107
|
initialize_build(Node.ref, prod: prod?, **kwargs)
|
|
111
108
|
initialize_env(**kwargs)
|
|
112
109
|
end
|
|
113
|
-
@dependfile =
|
|
114
|
-
@pm = {
|
|
110
|
+
@dependfile = @path + 'package.json'
|
|
111
|
+
@pm = {}
|
|
115
112
|
end
|
|
116
113
|
|
|
117
114
|
def ref
|
|
@@ -120,35 +117,39 @@ module Squared
|
|
|
120
117
|
|
|
121
118
|
def populate(*, **)
|
|
122
119
|
super
|
|
123
|
-
return unless
|
|
120
|
+
return unless outdated? && ref?(Node.ref)
|
|
124
121
|
|
|
125
122
|
namespace name do
|
|
126
123
|
Node.subtasks do |action, flags|
|
|
127
|
-
next if
|
|
124
|
+
next if @pass.include?(action)
|
|
128
125
|
|
|
129
126
|
if flags.nil?
|
|
130
127
|
case action
|
|
131
128
|
when 'add'
|
|
132
129
|
format_desc action, nil, 'save?=prod|dev|optional|peer,name+'
|
|
133
130
|
task action, [:save] do |_, args|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
131
|
+
save = param_guard(action, 'save', args: args, key: :save)
|
|
132
|
+
if save.start_with?('=')
|
|
133
|
+
exact = true
|
|
134
|
+
save = save[1..-1]
|
|
135
|
+
end
|
|
136
|
+
case save
|
|
137
|
+
when 'prod', 'dev', 'optional', 'peer'
|
|
138
|
+
packages = args.to_a.drop(1)
|
|
139
|
+
else
|
|
140
|
+
save = 'prod'
|
|
141
|
+
packages = args.to_a
|
|
142
|
+
end
|
|
142
143
|
param_guard(action, 'name', args: packages)
|
|
143
144
|
depend(:add, packages: packages, save: save, exact: exact)
|
|
144
145
|
end
|
|
145
146
|
when 'run'
|
|
146
147
|
next if (list = read_scripts).empty?
|
|
147
148
|
|
|
148
|
-
format_desc action, nil,
|
|
149
|
+
format_desc action, nil, 'script,opts*|^index+|#,pattern*'
|
|
149
150
|
task action, [:script] do |_, args|
|
|
150
151
|
if args.script == '#'
|
|
151
|
-
format_list(list,
|
|
152
|
+
format_list(list, 'run[^N]', 'scripts', grep: args.extras, from: dependfile.to_s)
|
|
152
153
|
else
|
|
153
154
|
args = param_guard(action, 'script', args: args.to_a)
|
|
154
155
|
opts = []
|
|
@@ -159,8 +160,7 @@ module Squared
|
|
|
159
160
|
elsif exception
|
|
160
161
|
indexerror n, list
|
|
161
162
|
else
|
|
162
|
-
log.warn "run script #{n} of #{list.size} (out of range)"
|
|
163
|
-
next
|
|
163
|
+
next log.warn "run script #{n} of #{list.size} (out of range)"
|
|
164
164
|
end
|
|
165
165
|
run compose(val, script: true)
|
|
166
166
|
else
|
|
@@ -186,7 +186,7 @@ module Squared
|
|
|
186
186
|
format_desc action, nil, 'pkg/cmd,opts*,args*'
|
|
187
187
|
task action, [:package] do |_, args|
|
|
188
188
|
if (package = args.package)
|
|
189
|
-
args = args.
|
|
189
|
+
args = args.to_a.drop(1)
|
|
190
190
|
if pnpm?
|
|
191
191
|
pre = ->(ch) { "-#{ch}" if (ch = args.delete(ch)) }
|
|
192
192
|
cmd = session 'pnpm', pre.call('r'), pre.call('c'), 'exec'
|
|
@@ -211,6 +211,17 @@ module Squared
|
|
|
211
211
|
end
|
|
212
212
|
run(from: :exec)
|
|
213
213
|
end
|
|
214
|
+
when 'nvm'
|
|
215
|
+
next unless ENV['NVM_DIR']
|
|
216
|
+
|
|
217
|
+
format_desc action, nil, 'version,args*'
|
|
218
|
+
task action, [:version] do |_, args|
|
|
219
|
+
version = param_guard(action, 'version', args: args, key: :version)
|
|
220
|
+
args = args.to_a.drop(1)
|
|
221
|
+
args << readline('Enter command', force: true) if args.empty?
|
|
222
|
+
args.prepend(File.join(ENV['NVM_DIR'], 'nvm-exec'))
|
|
223
|
+
run(args.join(' '), { 'NODE_VERSION' => version }, banner: false, from: :nvm)
|
|
224
|
+
end
|
|
214
225
|
when 'pack'
|
|
215
226
|
format_desc action, nil, 'opts*'
|
|
216
227
|
task action do |_, args|
|
|
@@ -222,12 +233,12 @@ module Squared
|
|
|
222
233
|
flags.each do |flag|
|
|
223
234
|
case action
|
|
224
235
|
when 'outdated'
|
|
225
|
-
format_desc(action, flag, %w[
|
|
236
|
+
format_desc(action, flag, %w[prune interactive dry-run].freeze, arg: 'opts?')
|
|
226
237
|
task flag do |_, args|
|
|
227
238
|
outdated flag, args.to_a
|
|
228
239
|
end
|
|
229
240
|
when 'package'
|
|
230
|
-
format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : '
|
|
241
|
+
format_desc(action, flag, 'opts*', after: flag == :dedupe ? nil : 'names*')
|
|
231
242
|
task flag do |_, args|
|
|
232
243
|
package flag, args.to_a
|
|
233
244
|
end
|
|
@@ -248,7 +259,7 @@ module Squared
|
|
|
248
259
|
format_desc(action, flag, 'otp?,dry-run?,public|restricted?', before: flag == :tag ? 'tag' : nil)
|
|
249
260
|
task flag do |_, args|
|
|
250
261
|
args = args.to_a
|
|
251
|
-
dryrun = true if args.delete('dry-run') || args.delete('
|
|
262
|
+
dryrun = true if args.delete('dry-run') || args.delete('d')
|
|
252
263
|
if args.delete('public') || args.delete('p')
|
|
253
264
|
access = 'public'
|
|
254
265
|
elsif args.delete('restricted') || args.delete('r')
|
|
@@ -269,10 +280,8 @@ module Squared
|
|
|
269
280
|
end
|
|
270
281
|
end
|
|
271
282
|
|
|
272
|
-
def copy(from: 'build', into: 'node_modules', scope: nil, also: nil, create: nil,
|
|
283
|
+
def copy(from: 'build', into: 'node_modules', scope: nil, also: nil, create: nil, workspace: false,
|
|
273
284
|
link: false, force: false, override: false, sync: invoked_sync?('copy'), **kwargs)
|
|
274
|
-
return if @copy == false
|
|
275
|
-
|
|
276
285
|
glob = kwargs[:include]
|
|
277
286
|
pass = kwargs[:exclude]
|
|
278
287
|
if @copy && !override
|
|
@@ -280,7 +289,6 @@ module Squared
|
|
|
280
289
|
|
|
281
290
|
from = @copy[:from] if @copy.key?(:from)
|
|
282
291
|
into = @copy[:into] if @copy.key?(:into)
|
|
283
|
-
files = @copy[:files] if @copy.key?(:files)
|
|
284
292
|
workspace = @copy[:workspace] if @copy.key?(:workspace)
|
|
285
293
|
link = @copy[:link] if @copy.key?(:link)
|
|
286
294
|
force = @copy[:force] if @copy.key?(:force)
|
|
@@ -289,6 +297,8 @@ module Squared
|
|
|
289
297
|
create = @copy[:create] if @copy.key?(:create)
|
|
290
298
|
glob = @copy[:include] if @copy.key?(:include)
|
|
291
299
|
pass = @copy[:exclude] if @copy.key?(:exclude)
|
|
300
|
+
elsif @copy == false
|
|
301
|
+
return
|
|
292
302
|
end
|
|
293
303
|
items = []
|
|
294
304
|
if build? && path != @workspace.home && @workspace.home?
|
|
@@ -300,7 +310,6 @@ module Squared
|
|
|
300
310
|
|
|
301
311
|
on :first, :copy
|
|
302
312
|
print_item unless @output[0] || !verbose || task_invoked?(/^copy(?::#{Node.ref}|$)/)
|
|
303
|
-
packed = false
|
|
304
313
|
items.each do |dir|
|
|
305
314
|
case dir
|
|
306
315
|
when Pathname
|
|
@@ -338,56 +347,16 @@ module Squared
|
|
|
338
347
|
end
|
|
339
348
|
next unless from && dest&.directory?
|
|
340
349
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
unless packed
|
|
344
|
-
require 'open3'
|
|
345
|
-
files = pwd_set do
|
|
346
|
-
Open3.capture2e(session_output('npm', 'pack --dry-run --no-color', npmname).to_s)
|
|
347
|
-
.first
|
|
348
|
-
.scan(/^npm notice \d+(?:\.\d+)?[a-z]+ (.+)$/i)
|
|
349
|
-
.map { |item| Pathname.new(item.first) }
|
|
350
|
-
.select(&:exist?)
|
|
351
|
-
end
|
|
352
|
-
.concat(Array(files))
|
|
353
|
-
packed = true
|
|
354
|
-
end
|
|
355
|
-
to = dest.join(into, npmname)
|
|
356
|
-
to.mkpath
|
|
357
|
-
log.info "cp npm:#{npmname} #{to}"
|
|
358
|
-
subdir = []
|
|
359
|
-
errors = 0
|
|
360
|
-
files.each do |file|
|
|
361
|
-
s, d = file.is_a?(Array) ? file : [file, file]
|
|
362
|
-
dest = to + d
|
|
363
|
-
unless subdir.include?((target = dest.dirname).to_s)
|
|
364
|
-
target.mkpath
|
|
365
|
-
subdir << target.to_s
|
|
366
|
-
end
|
|
367
|
-
begin
|
|
368
|
-
FileUtils.cp(basepath(s), dest, verbose: verbosetype > 0)
|
|
369
|
-
rescue StandardError => e
|
|
370
|
-
print_error e
|
|
371
|
-
errors += 1
|
|
372
|
-
end
|
|
373
|
-
end
|
|
374
|
-
rescue StandardError => e
|
|
375
|
-
on_error e, :copy
|
|
376
|
-
else
|
|
377
|
-
puts message(to, subdir.size, files.size - errors) if verbose
|
|
378
|
-
end
|
|
379
|
-
next
|
|
380
|
-
end
|
|
381
|
-
glob = Array(glob || '**/*')
|
|
350
|
+
from = path + from
|
|
351
|
+
glob = as_a(glob || '**/*')
|
|
382
352
|
target = []
|
|
383
|
-
from = basepath from
|
|
384
353
|
if workspace
|
|
385
|
-
|
|
386
|
-
next unless
|
|
354
|
+
from.glob('*').each do |entry|
|
|
355
|
+
next unless entry.directory?
|
|
387
356
|
|
|
388
|
-
sub = if (proj = @workspace.find(
|
|
357
|
+
sub = if (proj = @workspace.find(entry))
|
|
389
358
|
proj.packagename
|
|
390
|
-
elsif (file =
|
|
359
|
+
elsif (file = entry + 'package.json').exist?
|
|
391
360
|
begin
|
|
392
361
|
doc = JSON.parse(file.read)
|
|
393
362
|
rescue StandardError => e
|
|
@@ -398,20 +367,22 @@ module Squared
|
|
|
398
367
|
end
|
|
399
368
|
end
|
|
400
369
|
if sub
|
|
401
|
-
target << [
|
|
370
|
+
target << [entry, dest.join(into, sub)]
|
|
402
371
|
else
|
|
403
|
-
log.debug message("package.json in \"#{
|
|
372
|
+
log.debug message("package.json in \"#{entry}\"", hint: 'not found')
|
|
404
373
|
end
|
|
405
374
|
end
|
|
406
375
|
else
|
|
407
|
-
target << [from, dest.join(into, scope ||
|
|
376
|
+
target << [from, dest.join(into, scope || project)]
|
|
408
377
|
end
|
|
409
378
|
target.each do |src, to|
|
|
410
379
|
glob.each { |val| log.info "cp #{from + val} #{to}" }
|
|
411
380
|
begin
|
|
412
|
-
copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose:
|
|
381
|
+
copy_dir(src, to, glob, create: create, link: link, force: force, pass: pass, verbose: verbose)
|
|
413
382
|
rescue StandardError => e
|
|
414
|
-
|
|
383
|
+
log.error e
|
|
384
|
+
ret = on(:error, :copy, e)
|
|
385
|
+
raise if exception && ret != true
|
|
415
386
|
end
|
|
416
387
|
end
|
|
417
388
|
end
|
|
@@ -427,58 +398,46 @@ module Squared
|
|
|
427
398
|
|
|
428
399
|
if (yarn = dependtype(:yarn)) > 0
|
|
429
400
|
cmd = session 'yarn'
|
|
430
|
-
if
|
|
431
|
-
cmd << 'workspaces focus --all --production'
|
|
432
|
-
elsif flag == :add
|
|
401
|
+
if flag == :add
|
|
433
402
|
cmd << 'add'
|
|
434
403
|
cmd << "--#{save}" unless save == 'prod'
|
|
435
404
|
cmd << '--exact' if exact
|
|
436
405
|
else
|
|
437
406
|
cmd << 'install'
|
|
438
|
-
if yarn == 1
|
|
439
|
-
cmd << '--production' if prod?
|
|
440
|
-
cmd << '--ignore-engines' unless option('ignore-engines', equals: '0')
|
|
441
|
-
end
|
|
407
|
+
cmd << '--ignore-engines' if yarn == 1 && !option('ignore-engines', equals: '0')
|
|
442
408
|
end
|
|
443
409
|
elsif pnpm?
|
|
444
410
|
cmd = session 'pnpm'
|
|
445
411
|
if flag == :add
|
|
446
412
|
cmd << 'add' << "--save-#{save}"
|
|
447
413
|
cmd << '--save-exact' if exact
|
|
448
|
-
option('allow-build') { |val| cmd << quote_option('allow-build', val) }
|
|
449
414
|
else
|
|
450
415
|
cmd << 'install'
|
|
451
|
-
cmd << '--prod' if prod?
|
|
452
|
-
append_platform
|
|
453
416
|
end
|
|
454
|
-
|
|
417
|
+
option('public-hoist-pattern', ignore: false) do |val|
|
|
455
418
|
split_escape(val).each { |opt| cmd << shell_option('public-hoist-pattern', opt) }
|
|
456
419
|
end
|
|
457
420
|
cmd << '--ignore-workspace' if env('NODE_WORKSPACES', equals: '0')
|
|
458
|
-
cmd << '--dangerously-allow-all-builds' if option('approve-builds')
|
|
459
421
|
append_nocolor
|
|
460
422
|
else
|
|
461
423
|
cmd = session 'npm', 'install'
|
|
462
424
|
if flag == :add
|
|
463
425
|
cmd << "--save-#{save}"
|
|
464
426
|
cmd << '--save-exact' if exact
|
|
465
|
-
|
|
466
|
-
cmd << '--include=prod' if prod?
|
|
467
|
-
append_platform
|
|
427
|
+
cmd.merge(packages.map { |pkg| shell_escape(pkg) })
|
|
468
428
|
end
|
|
469
429
|
cmd << '--workspaces=false' if env('NODE_WORKSPACES', equals: '0')
|
|
470
430
|
cmd << '--package-lock=false' if option('package-lock', equals: '0')
|
|
471
431
|
append_nocolor
|
|
472
432
|
end
|
|
473
433
|
append_loglevel
|
|
474
|
-
|
|
475
|
-
run(from: flag || :depend, sync: sync)
|
|
434
|
+
run(from: :depend, sync: sync)
|
|
476
435
|
end
|
|
477
436
|
end
|
|
478
437
|
|
|
479
438
|
def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
|
|
480
439
|
dryrun = opts.include?('dry-run') || opts.include?('d')
|
|
481
|
-
if pnpm?
|
|
440
|
+
if pnpm? && read_packagemanager(version: '7.15', update: true)
|
|
482
441
|
cmd = session 'pnpm', 'outdated'
|
|
483
442
|
dryrun ||= dryrun?('pnpm')
|
|
484
443
|
else
|
|
@@ -489,14 +448,19 @@ module Squared
|
|
|
489
448
|
log.info cmd.to_s
|
|
490
449
|
on :first, :outdated
|
|
491
450
|
end
|
|
492
|
-
banner = format_banner(cmd.temp(dryrun ? '--dry-run' : nil))
|
|
451
|
+
banner = format_banner(cmd.temp(dryrun ? ' --dry-run' : nil))
|
|
493
452
|
print_item banner if sync
|
|
494
453
|
begin
|
|
495
454
|
data = pwd_set { `#{cmd.temp('--json', '--loglevel=error')}` }
|
|
496
455
|
doc = dependfile.read
|
|
497
456
|
json = JSON.parse(doc)
|
|
498
457
|
rescue StandardError => e
|
|
499
|
-
|
|
458
|
+
log.error e
|
|
459
|
+
unless dryrun
|
|
460
|
+
ret = on(:error, :outdated, e)
|
|
461
|
+
raise if exception && ret != true
|
|
462
|
+
end
|
|
463
|
+
warn log_message(Logger::WARN, e, pass: true) if warning?
|
|
500
464
|
return
|
|
501
465
|
else
|
|
502
466
|
dep1 = json['dependencies'] || {}
|
|
@@ -523,19 +487,7 @@ module Squared
|
|
|
523
487
|
next
|
|
524
488
|
end
|
|
525
489
|
current = val['current'] || file
|
|
526
|
-
want = val['wanted']
|
|
527
|
-
unless latest[SEM_VER, 6]
|
|
528
|
-
case rev
|
|
529
|
-
when :major
|
|
530
|
-
want = latest
|
|
531
|
-
when :minor
|
|
532
|
-
want = latest if latest[SEM_VER, 1] == want[SEM_VER, 1]
|
|
533
|
-
when :patch
|
|
534
|
-
if (g = latest.match(SEM_VER)) && (h = want.match(SEM_VER)) && g[1] == h[1] && g[3] == h[3]
|
|
535
|
-
want = latest
|
|
536
|
-
end
|
|
537
|
-
end
|
|
538
|
-
end
|
|
490
|
+
want = rev == :major && !latest[SEM_VER, 6] ? latest : val['wanted']
|
|
539
491
|
next unless (current != want || file != want) && (want.match?(SEM_VER) || !file.match?(SEM_VER))
|
|
540
492
|
|
|
541
493
|
f = semscan file
|
|
@@ -592,7 +544,7 @@ module Squared
|
|
|
592
544
|
found.each_with_index do |item, i|
|
|
593
545
|
a, b, c, d, e = item
|
|
594
546
|
f = inter && (rev != :major || e || semmajor?(item[5], item[6]))
|
|
595
|
-
if f && !confirm_outdated(a, c, (d / 2.0).ceil, lock: e)
|
|
547
|
+
if f && !confirm_outdated(a, c, (d / 2.0).ceil, b, lock: e, col1: col1)
|
|
596
548
|
cur = -1
|
|
597
549
|
else
|
|
598
550
|
cur = modified
|
|
@@ -627,14 +579,10 @@ module Squared
|
|
|
627
579
|
footer.call(modified, found.size)
|
|
628
580
|
elsif modified > 0
|
|
629
581
|
modified = -1
|
|
582
|
+
footer.call(0, found.size)
|
|
630
583
|
File.write(dependfile, doc)
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
else
|
|
634
|
-
footer.call(0, found.size)
|
|
635
|
-
end
|
|
636
|
-
printsucc
|
|
637
|
-
commit(:add, ['package.json'], pass: true)
|
|
584
|
+
commit(:add, refs: ['package.json'], pass: true)
|
|
585
|
+
install if opts.include?('prune') || opts.include?('p')
|
|
638
586
|
end
|
|
639
587
|
elsif !avail.empty?
|
|
640
588
|
col1 = size_col.call(avail, 0) + 4
|
|
@@ -660,61 +608,61 @@ module Squared
|
|
|
660
608
|
end
|
|
661
609
|
|
|
662
610
|
def update(*)
|
|
663
|
-
package
|
|
611
|
+
package 'update'
|
|
664
612
|
end
|
|
665
613
|
|
|
666
|
-
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil,
|
|
667
|
-
|
|
668
|
-
|
|
614
|
+
def publish(flag = nil, *, sync: invoked_sync?('publish', flag), otp: nil, tag: nil, dryrun: nil, access: nil)
|
|
615
|
+
if read_packagemanager(:private)
|
|
616
|
+
if warning?
|
|
617
|
+
warn log_message(Logger::WARN, 'invalid task "publish"', subject: name, hint: 'private', pass: true)
|
|
618
|
+
end
|
|
669
619
|
return
|
|
670
620
|
end
|
|
621
|
+
return unless version
|
|
622
|
+
|
|
671
623
|
cmd = session 'npm', 'publish'
|
|
624
|
+
dryrun = dryrun?('npm') if dryrun.nil?
|
|
672
625
|
cmd << basic_option('otp', otp) if otp ||= option('otp')
|
|
673
|
-
cmd << basic_option('tag', tag
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
require 'open3'
|
|
691
|
-
on :first, from
|
|
692
|
-
pwd_set(from: from, dryrun: dryrun) do
|
|
693
|
-
cmd = session_done cmd
|
|
694
|
-
Open3.popen2e(cmd) do |_, out|
|
|
695
|
-
write_lines(out,
|
|
696
|
-
banner: format_banner(cmd),
|
|
697
|
-
sub: npmnotice + [{ pat: /^(.+)(Tarball .+)$/, styles: color(:bright_blue), index: 2 }])
|
|
626
|
+
cmd << basic_option('tag', tag) if tag ||= option('tag')
|
|
627
|
+
cmd << basic_option('access', access) if access ||= option('access')
|
|
628
|
+
if verbose
|
|
629
|
+
if dryrun
|
|
630
|
+
cmd << '--dry-run'
|
|
631
|
+
else
|
|
632
|
+
log.info cmd.to_s
|
|
633
|
+
end
|
|
634
|
+
unless sync
|
|
635
|
+
on :first, :publish unless dryrun
|
|
636
|
+
pwd_set(from: :publish) do
|
|
637
|
+
require 'open3'
|
|
638
|
+
banner = format_banner cmd.to_s
|
|
639
|
+
Open3.popen2e(cmd.done) do |_, out|
|
|
640
|
+
write_lines(out, sub: npmnotice + [pat: /^(.+)(Tarball .+)$/, styles: color(:blue), index: 2],
|
|
641
|
+
banner: banner)
|
|
642
|
+
end
|
|
698
643
|
end
|
|
644
|
+
on :last, :publish unless dryrun
|
|
645
|
+
return
|
|
699
646
|
end
|
|
700
|
-
|
|
647
|
+
elsif dryrun
|
|
648
|
+
return
|
|
701
649
|
end
|
|
650
|
+
run(from: :publish, sync: sync)
|
|
702
651
|
end
|
|
703
652
|
|
|
704
|
-
def package(flag, opts = []
|
|
653
|
+
def package(flag, opts = [])
|
|
705
654
|
workspace.rev_clear(name)
|
|
706
655
|
if (yarn = dependtype(:yarn)) > 0
|
|
707
656
|
cmd = session 'yarn', if flag == :update
|
|
708
|
-
yarn == 1 ? 'upgrade' : 'up'
|
|
657
|
+
flag = yarn == 1 ? 'upgrade' : 'up'
|
|
709
658
|
else
|
|
710
|
-
|
|
659
|
+
flag
|
|
711
660
|
end
|
|
712
661
|
op = OptionPartition.new(opts, if yarn == 1
|
|
713
|
-
OPT_YARN.fetch(flag
|
|
662
|
+
OPT_YARN.fetch(flag, []) + OPT_YARN[:common]
|
|
714
663
|
else
|
|
715
664
|
OPT_BERRY[flag]
|
|
716
665
|
end, cmd, project: self)
|
|
717
|
-
op << '--ignore-engines' if yarn == 1 && !option('ignore-engines', equals: '0')
|
|
718
666
|
op.clear
|
|
719
667
|
append_loglevel
|
|
720
668
|
else
|
|
@@ -722,12 +670,11 @@ module Squared
|
|
|
722
670
|
cmd = session 'pnpm', flag
|
|
723
671
|
list = OPT_PNPM[:install_base] + OPT_PNPM.fetch(flag, []) + OPT_PNPM[:common]
|
|
724
672
|
list.concat(OPT_PNPM[:install_as] + OPT_PNPM[:filter]) unless flag == :dedupe
|
|
725
|
-
list.concat(OPT_PNPM[:cpu]) unless flag == :update
|
|
726
673
|
no = OPT_PNPM[:"#{flag}_no"]
|
|
727
674
|
else
|
|
728
675
|
cmd = session 'npm', flag
|
|
729
676
|
list = OPT_NPM[:install_base] + OPT_NPM.fetch(flag, []) + OPT_NPM[:common]
|
|
730
|
-
list.concat(OPT_NPM[:install_as])
|
|
677
|
+
list.concat(OPT_NPM[:install_as]) unless flag == :dedupe
|
|
731
678
|
no = OPT_NPM[:install_no]
|
|
732
679
|
end
|
|
733
680
|
op = OptionPartition.new(opts, list, cmd, no: no, project: self)
|
|
@@ -735,7 +682,7 @@ module Squared
|
|
|
735
682
|
if opt =~ op.values
|
|
736
683
|
case $1
|
|
737
684
|
when 'w', 'workspace'
|
|
738
|
-
op << ($2.match?(%r{[\\/]}) ? quote_option($1,
|
|
685
|
+
op << ($2.match?(%r{[\\/]}) ? quote_option($1, path + $2) : shell_option($1, $2))
|
|
739
686
|
end
|
|
740
687
|
elsif opt.include?('=')
|
|
741
688
|
op.errors << opt
|
|
@@ -744,17 +691,16 @@ module Squared
|
|
|
744
691
|
end
|
|
745
692
|
end
|
|
746
693
|
op.swap
|
|
747
|
-
append_platform if flag == :install
|
|
748
694
|
append_nocolor
|
|
749
695
|
append_loglevel
|
|
750
|
-
if flag == :dedupe
|
|
696
|
+
if flag == :dedupe
|
|
751
697
|
op.clear
|
|
752
698
|
else
|
|
753
|
-
op.append(
|
|
699
|
+
op.append(escape: true)
|
|
754
700
|
end
|
|
701
|
+
op.clear(errors: true)
|
|
755
702
|
end
|
|
756
|
-
|
|
757
|
-
run(from: from || :"package:#{flag}")
|
|
703
|
+
run(from: :"package:#{flag}")
|
|
758
704
|
end
|
|
759
705
|
|
|
760
706
|
def bump(flag, val = nil)
|
|
@@ -768,17 +714,14 @@ module Squared
|
|
|
768
714
|
when :major
|
|
769
715
|
if seg[0] != '0' || seg[2].nil?
|
|
770
716
|
seg[0] = seg[0].succ
|
|
771
|
-
seg[2] = '0'
|
|
772
717
|
else
|
|
773
718
|
seg[2] = seg[2].succ
|
|
774
719
|
end
|
|
775
|
-
seg[4] = '0'
|
|
776
720
|
when :minor
|
|
777
721
|
if seg[0] == '0'
|
|
778
722
|
seg[4] &&= seg[4].succ
|
|
779
723
|
else
|
|
780
724
|
seg[2] = seg[2].succ
|
|
781
|
-
seg[4] &&= '0'
|
|
782
725
|
end
|
|
783
726
|
when :patch
|
|
784
727
|
seg[4] &&= seg[4].succ
|
|
@@ -794,22 +737,24 @@ module Squared
|
|
|
794
737
|
log.info "bump version #{cur} to #{val} (#{flag})"
|
|
795
738
|
on :first, :bump
|
|
796
739
|
end
|
|
797
|
-
if
|
|
798
|
-
puts val
|
|
799
|
-
elsif verbose
|
|
740
|
+
if verbose
|
|
800
741
|
major = flag == :major
|
|
801
742
|
emphasize("version: #{val}", title: name, border: borderstyle, sub: [
|
|
802
743
|
headerstyle,
|
|
803
744
|
{ pat: /\A(version:)( )(\S+)(.*)\z/, styles: color(major ? :green : :yellow), index: 3 },
|
|
804
745
|
{ pat: /\A(version:)(.*)\z/, styles: theme[major ? :major : :active] }
|
|
805
746
|
])
|
|
747
|
+
elsif stdin?
|
|
748
|
+
puts val
|
|
806
749
|
end
|
|
807
750
|
on :last, :bump unless dryrun?
|
|
808
751
|
else
|
|
809
752
|
raise_error('version not found', hint: dependfile)
|
|
810
753
|
end
|
|
811
754
|
rescue StandardError => e
|
|
812
|
-
|
|
755
|
+
log.debug e
|
|
756
|
+
ret = on(:error, :bump, e)
|
|
757
|
+
raise if exception && ret != true
|
|
813
758
|
end
|
|
814
759
|
end
|
|
815
760
|
|
|
@@ -819,7 +764,7 @@ module Squared
|
|
|
819
764
|
cmd = session dependbin, 'pack'
|
|
820
765
|
if dependtype(:yarn) > 1
|
|
821
766
|
op = OptionPartition.new(opts, OPT_BERRY[:pack], cmd, project: self)
|
|
822
|
-
op
|
|
767
|
+
op << quote_option('out', Pathname.pwd + "#{project}-#{version}.tgz") unless op.arg?('out')
|
|
823
768
|
else
|
|
824
769
|
op = OptionPartition.new(opts, pnpm? ? OPT_PNPM[:pack] : OPT_NPM[:pack] + OPT_NPM[:common], cmd,
|
|
825
770
|
project: self)
|
|
@@ -829,12 +774,12 @@ module Squared
|
|
|
829
774
|
|
|
830
775
|
case $1
|
|
831
776
|
when 'w', 'workspace'
|
|
832
|
-
op << ($2.match?(%r{[\\/]}) ? quote_option($1,
|
|
777
|
+
op << ($2.match?(%r{[\\/]}) ? quote_option($1, path + $2) : shell_option($1, $2))
|
|
833
778
|
op.found << opt
|
|
834
779
|
end
|
|
835
780
|
end
|
|
836
781
|
end
|
|
837
|
-
op
|
|
782
|
+
op << quote_option('pack-destination', Dir.pwd) unless op.arg?('pack-destination')
|
|
838
783
|
end
|
|
839
784
|
op.clear
|
|
840
785
|
run(from: :pack)
|
|
@@ -846,16 +791,16 @@ module Squared
|
|
|
846
791
|
if script
|
|
847
792
|
ret = session dependbin, 'run'
|
|
848
793
|
raise_error("#{dependbin} run: given #{target}", hint: from) unless append_any(target, build: true)
|
|
849
|
-
append_any opts
|
|
794
|
+
append_any opts
|
|
850
795
|
append_loglevel
|
|
851
|
-
append_any(args, delim: true)
|
|
796
|
+
append_any(args, delim: true)
|
|
852
797
|
ret
|
|
853
798
|
else
|
|
854
799
|
case target
|
|
855
800
|
when String
|
|
856
801
|
target
|
|
857
802
|
when Hash
|
|
858
|
-
append_hash(target
|
|
803
|
+
append_hash(target).join(' ')
|
|
859
804
|
when Enumerable
|
|
860
805
|
target.to_a.join(' ')
|
|
861
806
|
else
|
|
@@ -869,7 +814,7 @@ module Squared
|
|
|
869
814
|
end
|
|
870
815
|
|
|
871
816
|
def outdated?
|
|
872
|
-
dependfile.exist?
|
|
817
|
+
dependfile.exist?
|
|
873
818
|
end
|
|
874
819
|
|
|
875
820
|
def update?
|
|
@@ -882,32 +827,45 @@ module Squared
|
|
|
882
827
|
|
|
883
828
|
def yarn?
|
|
884
829
|
(@pm[:yarn] ||= if rootpath('yarn.lock', ascend: dependext).exist?
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
830
|
+
if (rc = rootpath('.yarnrc.yml', ascend: dependext)).exist?
|
|
831
|
+
begin
|
|
832
|
+
require 'yaml'
|
|
833
|
+
doc = YAML.load_file(rc)
|
|
834
|
+
doc.nodeLinker == 'node-modules' ? 2 : 3
|
|
835
|
+
rescue StandardError => e
|
|
836
|
+
log.debug e
|
|
837
|
+
3
|
|
838
|
+
end
|
|
889
839
|
else
|
|
890
|
-
0
|
|
891
|
-
end
|
|
892
|
-
else
|
|
893
|
-
case @pm[:__]
|
|
894
|
-
when 'yarn'
|
|
895
840
|
1
|
|
896
|
-
when 'berry'
|
|
897
|
-
yarntype
|
|
898
|
-
else
|
|
899
|
-
0
|
|
900
841
|
end
|
|
842
|
+
elsif (ver = read_packagemanager || read_install)&.start_with?('yarn')
|
|
843
|
+
ver == 'yarn' || ver.include?('@1') ? 1 : 3
|
|
844
|
+
else
|
|
845
|
+
0
|
|
901
846
|
end) > 0
|
|
902
847
|
end
|
|
903
848
|
|
|
904
849
|
def pnpm?
|
|
905
850
|
(@pm[:pnpm] ||= if rootpath('pnpm-lock.yaml', ascend: dependext).exist?
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
851
|
+
begin
|
|
852
|
+
require 'yaml'
|
|
853
|
+
doc = YAML.load_file(basepath('node_modules/.modules.yaml', ascend: dependext))
|
|
854
|
+
@pm[:_] = doc['packageManager']
|
|
855
|
+
case doc['nodeLinker']
|
|
856
|
+
when 'hoisted'
|
|
857
|
+
1
|
|
858
|
+
when 'pnp'
|
|
859
|
+
3
|
|
860
|
+
else
|
|
861
|
+
4
|
|
862
|
+
end
|
|
863
|
+
rescue StandardError => e
|
|
864
|
+
log.debug e
|
|
865
|
+
4
|
|
866
|
+
end
|
|
909
867
|
else
|
|
910
|
-
|
|
868
|
+
(read_packagemanager || read_install)&.start_with?('pnpm') ? 4 : 0
|
|
911
869
|
end) > 0
|
|
912
870
|
end
|
|
913
871
|
|
|
@@ -934,125 +892,51 @@ module Squared
|
|
|
934
892
|
respond_to?(meth) && __send__(meth) ? @pm[prog] : 0
|
|
935
893
|
end
|
|
936
894
|
|
|
937
|
-
def dependbin
|
|
938
|
-
if yarn?
|
|
939
|
-
'yarn'
|
|
940
|
-
else
|
|
941
|
-
pnpm? ? 'pnpm' : 'npm'
|
|
942
|
-
end
|
|
943
|
-
end
|
|
944
|
-
|
|
945
895
|
def version
|
|
946
|
-
@version
|
|
896
|
+
super || (@version = read_packagemanager(:version))
|
|
947
897
|
end
|
|
948
898
|
|
|
949
899
|
def packagename
|
|
950
900
|
read_packagemanager :name
|
|
951
901
|
end
|
|
952
902
|
|
|
953
|
-
def scripts
|
|
954
|
-
@scripts ||= read_scripts.to_h
|
|
955
|
-
end
|
|
956
|
-
|
|
957
903
|
private
|
|
958
904
|
|
|
959
905
|
def read_packagemanager(key = nil, version: nil, update: false)
|
|
960
|
-
if
|
|
906
|
+
if @pm[:_].nil? || update
|
|
961
907
|
doc = JSON.parse(dependfile.read)
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
@pm[:workspaces] = doc['workspaces']
|
|
969
|
-
end
|
|
970
|
-
@pm[key] = doc[key.to_s] if key
|
|
908
|
+
@pm[:_] = (val = doc['packageManager']) ? val[0, val.index('+') || val.size] : false
|
|
909
|
+
@pm[:name] = doc['name']
|
|
910
|
+
@pm[:scripts] = doc['scripts']
|
|
911
|
+
@pm[:version] = doc['version']
|
|
912
|
+
@pm[:private] = doc['private']
|
|
913
|
+
@pm[:workspaces] = doc['workspaces']
|
|
971
914
|
end
|
|
972
915
|
rescue StandardError => e
|
|
973
916
|
log.debug e
|
|
974
917
|
@pm[:_] = false
|
|
975
918
|
nil
|
|
976
919
|
else
|
|
977
|
-
if key
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
ret
|
|
981
|
-
end
|
|
920
|
+
return @pm[key] if key
|
|
921
|
+
|
|
922
|
+
!(ret = @pm[:_]) || (version && ret[ret.index('@') + 1..-1] < version) ? nil : ret
|
|
982
923
|
end
|
|
983
924
|
|
|
984
925
|
def read_install
|
|
985
926
|
return unless (ret = env('NODE_INSTALL'))
|
|
986
927
|
|
|
987
|
-
if ret.include?('
|
|
988
|
-
catch :found do
|
|
989
|
-
split_escape(ret).each do |val|
|
|
990
|
-
case val
|
|
991
|
-
when /^yarn/
|
|
992
|
-
next if yarntype(exist: true) == 0
|
|
993
|
-
when /^pnpm/
|
|
994
|
-
next if pnpmtype(exist: true) == 0
|
|
995
|
-
when /^npm/
|
|
996
|
-
nil
|
|
997
|
-
else
|
|
998
|
-
next
|
|
999
|
-
end
|
|
1000
|
-
ret = val
|
|
1001
|
-
throw :found
|
|
1002
|
-
end
|
|
1003
|
-
return
|
|
1004
|
-
end
|
|
1005
|
-
end
|
|
1006
|
-
@pm[:_] ||= ret
|
|
928
|
+
@pm[:_] ||= ret if ret.include?('@')
|
|
1007
929
|
ret
|
|
1008
930
|
end
|
|
1009
931
|
|
|
1010
|
-
def yarntype(exist: false)
|
|
1011
|
-
if (rc = rootpath('.yarnrc.yml', ascend: dependext)).exist?
|
|
1012
|
-
require 'yaml'
|
|
1013
|
-
doc = YAML.load_file(rc)
|
|
1014
|
-
doc.nodeLinker == 'node-modules' ? 2 : 3
|
|
1015
|
-
elsif exist && !basepath('yarn.lock').exist?
|
|
1016
|
-
0
|
|
1017
|
-
else
|
|
1018
|
-
1
|
|
1019
|
-
end
|
|
1020
|
-
rescue StandardError => e
|
|
1021
|
-
return 0 if exist
|
|
1022
|
-
|
|
1023
|
-
log.debug e
|
|
1024
|
-
3
|
|
1025
|
-
end
|
|
1026
|
-
|
|
1027
|
-
def pnpmtype(exist: false)
|
|
1028
|
-
require 'yaml'
|
|
1029
|
-
doc = YAML.load_file(basepath('node_modules/.modules.yaml', ascend: dependext))
|
|
1030
|
-
@pm['packageManager'] = doc['packageManager']
|
|
1031
|
-
case doc['nodeLinker']
|
|
1032
|
-
when 'hoisted'
|
|
1033
|
-
1
|
|
1034
|
-
when 'pnp'
|
|
1035
|
-
3
|
|
1036
|
-
else
|
|
1037
|
-
4
|
|
1038
|
-
end
|
|
1039
|
-
rescue StandardError => e
|
|
1040
|
-
if exist
|
|
1041
|
-
%w[pnpm-lock.yaml pnpm-workspace.yaml].any? { |val| basepath(val).exist? } ? 4 : 0
|
|
1042
|
-
else
|
|
1043
|
-
log.debug e
|
|
1044
|
-
4
|
|
1045
|
-
end
|
|
1046
|
-
end
|
|
1047
|
-
|
|
1048
932
|
def read_scripts
|
|
1049
933
|
ret = read_packagemanager(:scripts)
|
|
1050
934
|
ret.is_a?(Hash) ? ret.to_a : []
|
|
1051
935
|
end
|
|
1052
936
|
|
|
1053
937
|
def append_loglevel(target: @session)
|
|
1054
|
-
level = env
|
|
1055
|
-
silent =
|
|
938
|
+
level = env 'NODE_LOGLEVEL'
|
|
939
|
+
silent = !verbose || level == 'silent'
|
|
1056
940
|
return unless silent || level
|
|
1057
941
|
|
|
1058
942
|
if yarn?
|
|
@@ -1082,11 +966,15 @@ module Squared
|
|
|
1082
966
|
end
|
|
1083
967
|
end
|
|
1084
968
|
|
|
1085
|
-
def
|
|
1086
|
-
|
|
1087
|
-
|
|
969
|
+
def dryrun?(prefix = dependbin, **)
|
|
970
|
+
super || !option('dry-run', prefix: prefix).nil?
|
|
971
|
+
end
|
|
1088
972
|
|
|
1089
|
-
|
|
973
|
+
def dependbin
|
|
974
|
+
if yarn?
|
|
975
|
+
'yarn'
|
|
976
|
+
else
|
|
977
|
+
pnpm? ? 'pnpm' : 'npm'
|
|
1090
978
|
end
|
|
1091
979
|
end
|
|
1092
980
|
|
|
@@ -1094,22 +982,14 @@ module Squared
|
|
|
1094
982
|
'package.json' if parent&.has?('outdated', Node.ref)
|
|
1095
983
|
end
|
|
1096
984
|
|
|
1097
|
-
def npmname
|
|
1098
|
-
packagename || project
|
|
1099
|
-
end
|
|
1100
|
-
|
|
1101
985
|
def npmnotice
|
|
1102
986
|
[
|
|
1103
|
-
{ pat: /^(npm error )(code|\d+)(.+)$/, styles: color(:
|
|
1104
|
-
{ pat: /^(npm )(error)(.*)$/, styles: color(:
|
|
1105
|
-
{ pat: /^(npm )(notice)(.*)$/, styles: color(:
|
|
987
|
+
{ pat: /^(npm error )(code|\d+)(.+)$/, styles: color(:cyan), index: 2 },
|
|
988
|
+
{ pat: /^(npm )(error)(.*)$/, styles: color(:red), index: 2 },
|
|
989
|
+
{ pat: /^(npm )(notice)(.*)$/, styles: color(:cyan), index: 2 },
|
|
1106
990
|
{ pat: /^(npm )(.+)$/, styles: :bold }
|
|
1107
991
|
]
|
|
1108
992
|
end
|
|
1109
|
-
|
|
1110
|
-
def dryrun?(prefix = dependbin, **)
|
|
1111
|
-
super || !option('dry-run', prefix: prefix).nil?
|
|
1112
|
-
end
|
|
1113
993
|
end
|
|
1114
994
|
|
|
1115
995
|
Application.implement Node
|