squared 0.7.2 → 0.7.4
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 +83 -2
- data/README.md +5 -4
- data/lib/squared/common/shell.rb +3 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/project/base.rb +28 -21
- data/lib/squared/workspace/project/docker.rb +33 -18
- data/lib/squared/workspace/project/git.rb +29 -21
- data/lib/squared/workspace/project/node.rb +48 -37
- data/lib/squared/workspace/project/python.rb +46 -21
- data/lib/squared/workspace/project/ruby.rb +278 -148
- data/lib/squared/workspace/project/support/class.rb +1 -1
- data/lib/squared/workspace/project/support/optionpartition.rb +17 -15
- data/lib/squared/workspace/repo.rb +2 -2
- metadata +1 -1
|
@@ -5,7 +5,7 @@ module Squared
|
|
|
5
5
|
module Project
|
|
6
6
|
class Node < Git
|
|
7
7
|
OPT_NPM = {
|
|
8
|
-
common: %w[dry-run=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
|
|
8
|
+
common: %w[dry-run=!? force=!? loglevel=b include-workspace-root=!? workspaces=!? w|workspace=v].freeze,
|
|
9
9
|
install: %w[package-lock-only=!? prefer-dedupe=!? E|save-exact=!? before=q cpu=b libc=b os=b].freeze,
|
|
10
10
|
install_a: %w[audit=! bin-links=! foreground-scripts=!? fund=! ignore-scripts=!? install-links=!?
|
|
11
11
|
package-lock=! strict-peer-deps=!? include=b install-strategy=b omit=b].freeze,
|
|
@@ -72,16 +72,14 @@ module Squared
|
|
|
72
72
|
}.freeze
|
|
73
73
|
OPT_TSC = {
|
|
74
74
|
base: %w[all b|build init listFilesOnly locale=b p|project=p showConfig w|watch].freeze,
|
|
75
|
-
compiler: %w[allowArbitraryExtensions=!? allowImportingTsExtensions=!? allowJs=!?
|
|
76
|
-
|
|
77
|
-
allowUnusedLabels=!? alwaysStrict=!? assumeChangesOnlyAffectDirectDependencies=!? baseUrl=p
|
|
75
|
+
compiler: %w[allowArbitraryExtensions=!? allowImportingTsExtensions=!? allowJs=!? allowUmdGlobalAccess=!?
|
|
76
|
+
allowUnreachableCode=!? allowUnusedLabels=!? assumeChangesOnlyAffectDirectDependencies=!?
|
|
78
77
|
charset=b checkJs=!? composite=!? customConditions=q d|declaration=!? declarationDir=p
|
|
79
78
|
declarationMap=!? diagnostics=!? disableReferencedProjectLoad=!? disableSizeLimit=!?
|
|
80
|
-
disableSolutionSearching=!?
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
importsNotUsedAsValues=b incremental=!? inlineSourceMap=!? inlineSources=!?
|
|
79
|
+
disableSolutionSearching=!? emitBOM=!? emitDeclarationOnly=!? emitDecoratorMetadata=!?
|
|
80
|
+
erasableSyntaxOnly=!? exactOptionalPropertyTypes=!? experimentalDecorators=!? explainFiles=!?
|
|
81
|
+
extendedDiagnostics=!? forceConsistentCasingInFileNames=!? generateCpuProfile=b ignoreConfig=!?
|
|
82
|
+
importHelpers=!? importsNotUsedAsValues=b incremental=!? inlineSourceMap=!? inlineSources=!?
|
|
85
83
|
isolatedDeclarations=!? isolatedModules=!? jsx=b jsxFactory=q jsxFragmentFactory=q
|
|
86
84
|
jsxImportSource=q keyofStringsOnly=!? lib=q libReplacement=!? listEmittedFiles=!? listFiles=!?
|
|
87
85
|
mapRoot=p maxNodeModuleJsDepth=i m|module=b moduleDetection=b moduleResolution=b moduleSuffixes=b
|
|
@@ -89,18 +87,22 @@ module Squared
|
|
|
89
87
|
noFallthroughCasesInSwitch=!? noImplicitAny=!? noImplicitOverride=!? noImplicitReturns=!?
|
|
90
88
|
noImplicitThis=!? noImplicitUseStrict=!? noLib=!? noPropertyAccessFromIndexSignature=!?
|
|
91
89
|
noResolve=!? noStrictGenericChecks=!? noUncheckedIndexedAccess=!? noUncheckedSideEffectImports=!?
|
|
92
|
-
noUnusedLocals=!? noUnusedParameters=!? outDir=p
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
noUnusedLocals=!? noUnusedParameters=!? outDir=p paths=q plugins=b preserveConstEnums=!?
|
|
91
|
+
preserveSymlinks=!? preserveValueImports=!? preserveWatchOutput=!? pretty=!? reactNamespace=b
|
|
92
|
+
removeComments=!? resolveJsonModule=!? resolvePackageJsonExports=!? resolvePackageJsonImports=!?
|
|
93
|
+
rewriteRelativeImportExtensions=!? rootDir=p rootDirs=p skipDefaultLibCheck=!? skipLibCheck=!?
|
|
94
|
+
sourceMap=!? sourceRoot=p stableTypeOrdering=!? stopBuildOnErrors=!? strict=!?
|
|
97
95
|
strictBindCallApply=!? strictBuiltinIteratorReturn=!? strictFunctionTypes=!? strictNullChecks=!?
|
|
98
96
|
strictPropertyInitialization=!? stripInternal=!? suppressExcessPropertyErrors=!?
|
|
99
97
|
suppressImplicitAnyIndexErrors=!? t|target=b traceResolution=!? tsBuildInfoFile=p typeRoots=p
|
|
100
98
|
types=b useDefineForClassFields=!? useUnknownInCatchVariables=!? verbatimModuleSyntax=!?].freeze,
|
|
101
99
|
build: %w[clean=!? dry=!? force=!? v|verbose=!?].freeze,
|
|
102
100
|
watch: %w[excludeDirectories=p excludeFiles=p fallbackPolling=b synchronousWatchDirectory=!? watchDirectory=b
|
|
103
|
-
watchFile=b].freeze
|
|
101
|
+
watchFile=b].freeze,
|
|
102
|
+
v5: {
|
|
103
|
+
compiler: %w[allowSyntheticDefaultImports=!? alwaysStrict=!? baseUrl=p downlevelIteration=!?
|
|
104
|
+
esModuleInterop=!? outFile=p].freeze
|
|
105
|
+
}.freeze
|
|
104
106
|
}.freeze
|
|
105
107
|
PASS_NODE = {
|
|
106
108
|
tsc: %w[excludeDirectories excludeFiles customConditions lib moduleSuffixes plugins rootDirs typeRoots
|
|
@@ -552,31 +554,36 @@ module Squared
|
|
|
552
554
|
end
|
|
553
555
|
yarn = dependtype(:yarn)
|
|
554
556
|
if yarn > 0
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
if yarn == 1
|
|
558
|
-
cmd << '--ignore-engines' if option('ignore-engines')
|
|
559
|
-
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
560
|
-
cmd << '--force' if option('force')
|
|
557
|
+
if !flag && yarn > 1 && prod?
|
|
558
|
+
cmd = session 'yarn', 'workspaces focus --all --production'
|
|
561
559
|
else
|
|
562
|
-
cmd
|
|
563
|
-
cmd << '--check-cache' if !flag && option('force')
|
|
564
|
-
end
|
|
565
|
-
if nolockfile?('yarn')
|
|
566
|
-
cmd << '--no-lockfile'
|
|
567
|
-
elsif option('ci')
|
|
560
|
+
cmd = session('yarn', flag || 'install')
|
|
568
561
|
if yarn == 1
|
|
569
|
-
cmd << '--
|
|
570
|
-
|
|
571
|
-
cmd << '--
|
|
562
|
+
cmd << '--production' if prod?
|
|
563
|
+
cmd << '--ignore-engines' if option('ignore-engines')
|
|
564
|
+
cmd << '--ignore-scripts' if option('ignore-scripts')
|
|
565
|
+
cmd << '--force' if option('force')
|
|
566
|
+
else
|
|
567
|
+
cmd << '--mode=skip-build' if option('ignore-scripts')
|
|
568
|
+
cmd << '--check-cache' if !flag && option('force')
|
|
569
|
+
end
|
|
570
|
+
if nolockfile?('yarn')
|
|
571
|
+
cmd << '--no-lockfile'
|
|
572
|
+
elsif option('ci')
|
|
573
|
+
if yarn == 1
|
|
574
|
+
cmd << '--frozen-lockfile'
|
|
575
|
+
elsif !flag
|
|
576
|
+
cmd << '--immutable' << '--refresh-lockfile'
|
|
577
|
+
end
|
|
578
|
+
end
|
|
579
|
+
if add
|
|
580
|
+
cmd << '-W' if yarn == 1 && option('w', 'ignore-workspace-root-check', notequals: '0')
|
|
581
|
+
rm.call(cmd)
|
|
582
|
+
om.call(cmd)
|
|
583
|
+
cmd << '--exact' if exact
|
|
572
584
|
end
|
|
573
585
|
end
|
|
574
|
-
|
|
575
|
-
cmd << '-W' if yarn == 1 && option('w', 'ignore-workspace-root-check', notequals: '0')
|
|
576
|
-
rm.call(cmd)
|
|
577
|
-
om.call(cmd)
|
|
578
|
-
cmd << '--exact' if exact
|
|
579
|
-
end
|
|
586
|
+
append_loglevel
|
|
580
587
|
elsif pnpm?
|
|
581
588
|
cmd = session('pnpm', flag || 'install')
|
|
582
589
|
append_nocolor
|
|
@@ -587,6 +594,7 @@ module Squared
|
|
|
587
594
|
cmd << '--save-exact' if exact
|
|
588
595
|
option('allow-build') { |val| cmd << quote_option('allow-build', val) }
|
|
589
596
|
else
|
|
597
|
+
cmd << '--prod' if prod?
|
|
590
598
|
append_platform
|
|
591
599
|
end
|
|
592
600
|
option('public-hoist-pattern') do |val|
|
|
@@ -611,6 +619,8 @@ module Squared
|
|
|
611
619
|
if omit
|
|
612
620
|
cmd << "--omit=#{save || omit}"
|
|
613
621
|
save = nil
|
|
622
|
+
elsif !add && prod?
|
|
623
|
+
cmd << '--include=prod'
|
|
614
624
|
end
|
|
615
625
|
unless ci
|
|
616
626
|
if add
|
|
@@ -634,7 +644,7 @@ module Squared
|
|
|
634
644
|
end
|
|
635
645
|
|
|
636
646
|
def outdated(flag = nil, opts = [], sync: invoked_sync?('outdated', flag))
|
|
637
|
-
cmd = session(pnpm? ? 'pnpm' : 'npm', 'outdated')
|
|
647
|
+
cmd = session(pnpm? && exist?('pnpm-lock.yaml') ? 'pnpm' : 'npm', 'outdated')
|
|
638
648
|
dryrun = has_value?(opts, 'd', 'dry-run') || dryrun?
|
|
639
649
|
unless dryrun
|
|
640
650
|
log.info cmd.to_s
|
|
@@ -1109,6 +1119,7 @@ module Squared
|
|
|
1109
1119
|
b = kwargs[:build]
|
|
1110
1120
|
w = kwargs[:watch]
|
|
1111
1121
|
list = OPT_TSC[:base] + OPT_TSC[:compiler]
|
|
1122
|
+
list.concat(Array(kwargs.fetch(:legacy, 5)).flat_map { |n| OPT_TSC.fetch(:"v#{n}", {}).fetch(:compiler, []) })
|
|
1112
1123
|
cmd = session 'tsc', if p
|
|
1113
1124
|
quote_option 'p', basepath(p)
|
|
1114
1125
|
elsif b
|
|
@@ -12,8 +12,8 @@ module Squared
|
|
|
12
12
|
installer=b o|outdir=p].freeze,
|
|
13
13
|
venv: %w[clear copies symlinks system-site-packages upgrade upgrade-deps without-scm-ignore-files without-pip
|
|
14
14
|
prompt=q].freeze,
|
|
15
|
-
virtualenv: %w[always-copy clear copies download
|
|
16
|
-
no-
|
|
15
|
+
virtualenv: %w[always-copy clear copies download never-download no-download no-periodic-update no-pip no-seed
|
|
16
|
+
no-setuptools no-vcs-ignore q|quiet read-only-app-data reset-app-data symlink-app-data symlinks
|
|
17
17
|
system-site-packages with-traceback without-pip upgrade-embed-wheels v|verbose=+ activators=q
|
|
18
18
|
app-data=p creator=b discovery=b extra-search-dir=p pip=b prompt=q p|python=q seeder=b
|
|
19
19
|
setuptools=b try-first-with=q].freeze
|
|
@@ -34,14 +34,16 @@ module Squared
|
|
|
34
34
|
install: %w[break-system-packages compile dry-run force-reinstall I|ignore-installed no-compile
|
|
35
35
|
no-warn-conflicts no-warn-script-location U|upgrade user prefix=p report=p root=p
|
|
36
36
|
root-user-action=b t|target=p upgrade-strategy=b].freeze,
|
|
37
|
-
install_a: %w[
|
|
38
|
-
only-binary=q].freeze,
|
|
39
|
-
install_b: %w[build-constraint check-build-dependencies no-build-isolation no-clean no-deps
|
|
40
|
-
|
|
37
|
+
install_a: %w[no-index pre prefer-binary all-releases=b extra-index-url=q f|find-links=q i|index-url=q
|
|
38
|
+
no-binary=q only-binary=q only-final=b].freeze,
|
|
39
|
+
install_b: %w[build-constraint check-build-dependencies no-build-isolation no-clean no-deps require-hashes
|
|
40
|
+
use-pep517 c|constraint=p group=q progress-bar=b r|requirement=p requirements-from-script=p
|
|
41
|
+
src=p].freeze,
|
|
41
42
|
install_c: %w[C|config-settings=q e|editable=v].freeze,
|
|
43
|
+
install_d: %w[ignore-requires-python uploaded-prior-to=q].freeze,
|
|
42
44
|
hash: %w[a|algorithm].freeze,
|
|
43
|
-
list: %w[e|editable exclude-editable include-editable l|local
|
|
44
|
-
|
|
45
|
+
list: %w[e|editable exclude-editable include-editable l|local not-required o|outdated u|uptodate user
|
|
46
|
+
exclude=b format=b path=p].freeze,
|
|
45
47
|
lock: %w[o|output=p].freeze,
|
|
46
48
|
show: %w[f|files].freeze,
|
|
47
49
|
uninstall: %w[break-system-packages y|yes r|requirement=p root-user-action=b].freeze,
|
|
@@ -91,7 +93,7 @@ module Squared
|
|
|
91
93
|
debug: %w[platform].freeze,
|
|
92
94
|
install: %w[C config-settings c constraint extra-index-url no-binary only-binary platform
|
|
93
95
|
r requirement].freeze,
|
|
94
|
-
list: %w[exclude extra-index-url].freeze
|
|
96
|
+
list: %w[exclude extra-index-url no-binary only-binary].freeze
|
|
95
97
|
}.freeze
|
|
96
98
|
}.freeze
|
|
97
99
|
private_constant :DEP_PYTHON, :DIR_PYTHON, :OPT_PYTHON, :OPT_PIP, :OPT_POETRY, :OPT_PDM, :OPT_HATCH, :OPT_TWINE,
|
|
@@ -117,7 +119,8 @@ module Squared
|
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
|
|
120
|
-
attr_reader :venv
|
|
122
|
+
attr_reader :venv
|
|
123
|
+
attr_accessor :editable
|
|
121
124
|
|
|
122
125
|
def initialize(*, editable: '.', asdf: 'python', **kwargs)
|
|
123
126
|
super
|
|
@@ -128,7 +131,7 @@ module Squared
|
|
|
128
131
|
initialize_build(Python.ref, **kwargs)
|
|
129
132
|
initialize_env(**kwargs)
|
|
130
133
|
end
|
|
131
|
-
dependfile_set
|
|
134
|
+
dependfile_set(DEP_PYTHON, default: 2)
|
|
132
135
|
serve_set kwargs[:serve]
|
|
133
136
|
editable_set editable
|
|
134
137
|
venv_set kwargs[:venv]
|
|
@@ -137,10 +140,10 @@ module Squared
|
|
|
137
140
|
subtasks({
|
|
138
141
|
'venv' => %i[exec create remove show].freeze,
|
|
139
142
|
'pip' => %i[upgrade uninstall wheel reinstall freeze].freeze,
|
|
140
|
-
'install' => %i[requirement target
|
|
143
|
+
'install' => %i[upgrade requirement target editable user poetry].freeze,
|
|
141
144
|
'outdated' => %i[major minor patch].freeze,
|
|
142
145
|
'build' => %i[poetry pdm hatch meson python].freeze,
|
|
143
|
-
'publish' => %i[poetry pdm hatch
|
|
146
|
+
'publish' => %i[twine poetry pdm hatch].freeze,
|
|
144
147
|
'run' => nil,
|
|
145
148
|
'exec' => nil
|
|
146
149
|
})
|
|
@@ -348,8 +351,12 @@ module Squared
|
|
|
348
351
|
depend(flag, args.extras, target: path)
|
|
349
352
|
end
|
|
350
353
|
else
|
|
351
|
-
|
|
352
|
-
|
|
354
|
+
case flag
|
|
355
|
+
when :user
|
|
356
|
+
next if venv
|
|
357
|
+
when :poetry
|
|
358
|
+
next unless poetry?
|
|
359
|
+
end
|
|
353
360
|
task flag do |_, args|
|
|
354
361
|
install flag, args.to_a
|
|
355
362
|
end
|
|
@@ -374,8 +381,11 @@ module Squared
|
|
|
374
381
|
end
|
|
375
382
|
break if be
|
|
376
383
|
when 'publish'
|
|
377
|
-
|
|
378
|
-
|
|
384
|
+
if flag == :twine
|
|
385
|
+
next unless twine?
|
|
386
|
+
elsif (be = backend?(flag)) == false
|
|
387
|
+
next
|
|
388
|
+
end
|
|
379
389
|
format_desc(action, flag, 'test?,opts*', after: case flag
|
|
380
390
|
when :hatch then 'artifacts?'
|
|
381
391
|
when :twine then 'dist?'
|
|
@@ -588,10 +598,10 @@ module Squared
|
|
|
588
598
|
when :editable
|
|
589
599
|
op << quote_option('e', op.pop || editable || '.')
|
|
590
600
|
op.clear
|
|
591
|
-
when :upgrade
|
|
601
|
+
when :user, :upgrade
|
|
592
602
|
op.concat(packages)
|
|
593
603
|
raise_error 'no packages listed', hint: flag if op.empty?
|
|
594
|
-
op <<
|
|
604
|
+
op << "--#{flag}"
|
|
595
605
|
op.append
|
|
596
606
|
python_session('-m pip', *op.to_a.drop(1)) if workspace.windows?
|
|
597
607
|
end
|
|
@@ -987,7 +997,7 @@ module Squared
|
|
|
987
997
|
|
|
988
998
|
if found
|
|
989
999
|
line.chomp!($1) if line =~ /(?<=[\d"'{}\[\]]|true|false)(\s*#.*)$/
|
|
990
|
-
break if line.match?(/^\s*\[(?:[\w.\-" ]+|".+"|'.+')\]\s*$/)
|
|
1000
|
+
break if line.match?(/^\s*\[(?:[\w.\-"' ]+|".+"|'.+')\]\s*$/)
|
|
991
1001
|
|
|
992
1002
|
if ch
|
|
993
1003
|
val = line.rstrip
|
|
@@ -1075,6 +1085,7 @@ module Squared
|
|
|
1075
1085
|
if pip_install?(flag)
|
|
1076
1086
|
ret.concat(OPT_PIP[:install_a])
|
|
1077
1087
|
ret.concat(OPT_PIP[:install_b]) unless flag == :index
|
|
1088
|
+
ret.concat(OPT_PIP[:install_d])
|
|
1078
1089
|
case flag
|
|
1079
1090
|
when :install
|
|
1080
1091
|
ret.concat(OPT_PIP[:install_c] + OPT_PIP[:debug])
|
|
@@ -1083,6 +1094,8 @@ module Squared
|
|
|
1083
1094
|
when :download, :index
|
|
1084
1095
|
ret.concat(OPT_PIP[:debug])
|
|
1085
1096
|
end
|
|
1097
|
+
elsif flag == :list
|
|
1098
|
+
ret.concat(OPT_PIP[:install_a])
|
|
1086
1099
|
end
|
|
1087
1100
|
ret
|
|
1088
1101
|
end
|
|
@@ -1170,9 +1183,17 @@ module Squared
|
|
|
1170
1183
|
if poetry?
|
|
1171
1184
|
requires = read_pyproject 'tool.poetry', 'requires-poetry'
|
|
1172
1185
|
args << "poetry#{requires}"
|
|
1186
|
+
elsif setuptools? && !virtualenv?
|
|
1187
|
+
args << 'setuptools' << 'wheel'
|
|
1173
1188
|
end
|
|
1174
1189
|
pip(:install, *args, banner: false) unless args.empty?
|
|
1175
|
-
success?(ret, banner, !status) { |
|
|
1190
|
+
success?(ret, banner, !status) { |out| puts(out && dir.directory? ? "Success: #{dir}" : 'Failed') }
|
|
1191
|
+
end
|
|
1192
|
+
|
|
1193
|
+
def venv_package?(val)
|
|
1194
|
+
return false unless venv
|
|
1195
|
+
|
|
1196
|
+
!Dir.glob("lib/**/site-packages/#{val}", base: venv).empty?
|
|
1176
1197
|
end
|
|
1177
1198
|
|
|
1178
1199
|
def pip_install?(flag)
|
|
@@ -1206,6 +1227,10 @@ module Squared
|
|
|
1206
1227
|
dependtype == 1
|
|
1207
1228
|
end
|
|
1208
1229
|
|
|
1230
|
+
def twine?
|
|
1231
|
+
venv_package?('twine')
|
|
1232
|
+
end
|
|
1233
|
+
|
|
1209
1234
|
def virtualenv?
|
|
1210
1235
|
@virtualenv ||= exist?('virtualenv.ini') || !ENV['VIRTUALENV_PYTHON'].nil?
|
|
1211
1236
|
end
|