@mnci/cli 4.10.7 → 4.10.8
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.
- package/README.md +7 -4
- package/dist/cli.js +9 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1420,9 +1420,12 @@ build` links statically, so the binary in the drop already contains
|
|
|
1420
1420
|
- **CI** runs Go through the same `nx run-many -t lint,test,build` as
|
|
1421
1421
|
everything else. Two guarded steps precede it: `go mod download` (so a
|
|
1422
1422
|
network failure reads as a dependency failure rather than a confusing
|
|
1423
|
-
build error), and a `golangci-lint` install
|
|
1424
|
-
|
|
1425
|
-
|
|
1423
|
+
build error), and a `golangci-lint` install whose `GOPATH/bin` is then added
|
|
1424
|
+
to `PATH` for later steps. The linter is **pinned** (`GOLANGCI_LINT_VERSION`)
|
|
1425
|
+
and installed from its prebuilt release, verified against the release's
|
|
1426
|
+
SHA-256 checksums, in about a second; compiling it with `go install` took
|
|
1427
|
+
over a minute per run. Any download or verification failure falls back to
|
|
1428
|
+
`go install` at the same pinned version. All three skip cleanly when the
|
|
1426
1429
|
workspace has no root `go.mod`, and the linter install also skips when the
|
|
1427
1430
|
agent already provides it.
|
|
1428
1431
|
|
|
@@ -1486,7 +1489,7 @@ build agents, so the generated pipeline installs it itself (see below).
|
|
|
1486
1489
|
under the agent's home directory: the SDK ships dozens of its own
|
|
1487
1490
|
`pubspec.yaml` files, which inside the tree would pollute pub's resolution and
|
|
1488
1491
|
give Nx thousands of extra files to glob. The SDK version is **pinned**
|
|
1489
|
-
(
|
|
1492
|
+
(as is `golangci-lint`'s) because it determines the Dart version,
|
|
1490
1493
|
and pub workspaces need Dart 3.6+. Three guarded steps precede the build —
|
|
1491
1494
|
install, add to `PATH`, and one root `flutter pub get` — and all three skip
|
|
1492
1495
|
cleanly when the workspace has no root `pubspec.yaml`; the install also skips
|
package/dist/cli.js
CHANGED
|
@@ -1003,7 +1003,8 @@ var PYTHON_INSTALL_GUARD = `node -e "if(!require('node:fs').existsSync('requirem
|
|
|
1003
1003
|
var PYTHON_WORKSPACE_INSTALL_GUARD = `node -e "const fs=require('node:fs'),path=require('node:path');const editableDirs=[...fs.globSync('apps/*/pyproject.toml'),...fs.globSync('python-packages/*/pyproject.toml'),...fs.globSync('libs/*/pyproject.toml')].map((p)=>path.dirname(p));const requirementsFiles=fs.globSync('apps/*/requirements.txt');if(editableDirs.length===0&&requirementsFiles.length===0){console.log('No Python projects - skipping.');process.exit(0)}const args=['-m','pip','install','--quiet',...editableDirs.flatMap((d)=>['-e',d]),...requirementsFiles.flatMap((f)=>['-r',f])];const py=process.platform==='win32'?'python':'python3';process.exit(require('node:child_process').spawnSync(py,args,{stdio:'inherit'}).status ?? 1)"`;
|
|
1004
1004
|
var PIP_AUDIT_GUARD = `node -e "if(!require('node:fs').existsSync('requirements-dev.txt')){console.log('No Python projects - skipping.');process.exit(0)}const py=process.platform==='win32'?'python':'python3';require('node:child_process').spawnSync(py,['-m','pip_audit'],{stdio:'inherit'});process.exit(0)"`;
|
|
1005
1005
|
var GO_MODULE_DOWNLOAD_GUARD = `node -e "if(!require('node:fs').existsSync('go.mod')){console.log('No Go projects - skipping.');process.exit(0)}process.exit(require('node:child_process').spawnSync('go',['mod','download'],{stdio:'inherit'}).status ?? 1)"`;
|
|
1006
|
-
var
|
|
1006
|
+
var GOLANGCI_LINT_VERSION = "2.14.0";
|
|
1007
|
+
var GOLANGCI_LINT_INSTALL_GUARD = `node -e "const fs=require('node:fs'),cp=require('node:child_process'),path=require('node:path'),os=require('node:os'),crypto=require('node:crypto');if(!fs.existsSync('go.mod')){console.log('No Go projects - skipping.');process.exit(0)}if(cp.spawnSync('golangci-lint',['--version'],{stdio:'ignore'}).status===0){console.log('golangci-lint already installed - skipping.');process.exit(0)}const v='${GOLANGCI_LINT_VERSION}';const fallback=reason=>{console.log('Prebuilt golangci-lint '+v+' unavailable ('+reason+') - building it with go install instead.');process.exit(cp.spawnSync('go',['install','github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v'+v],{stdio:'inherit'}).status ?? 1)};const plat={linux:'linux',darwin:'darwin',win32:'windows'}[process.platform],arch={x64:'amd64',arm64:'arm64'}[process.arch];if(!plat||!arch)fallback('no prebuilt release for '+process.platform+'/'+process.arch);const gopath=cp.spawnSync('go',['env','GOPATH'],{encoding:'utf8'});if(gopath.status!==0)fallback('go env GOPATH failed');const name='golangci-lint-'+v+'-'+plat+'-'+arch,file=name+(plat==='windows'?'.zip':'.tar.gz'),base='https://github.com/golangci/golangci-lint/releases/download/v'+v+'/';const get=async u=>{const r=await fetch(u,{signal:AbortSignal.timeout(60000)});if(!r.ok)throw new Error('HTTP '+r.status+' for '+u);return Buffer.from(await r.arrayBuffer())};(async()=>{` + String.raw`const sums=(await get(base+'golangci-lint-'+v+'-checksums.txt')).toString('utf8').split('\n').map(l=>l.trim().split(' ').filter(Boolean));` + `const entry=sums.find(p=>p[1]===file);if(!entry)throw new Error(file+' is not in the release checksums');const archive=await get(base+file);if(crypto.createHash('sha256').update(archive).digest('hex')!==entry[0])throw new Error('checksum mismatch for '+file);const tmp=fs.mkdtempSync(path.join(os.tmpdir(),'golangci-lint-')),archivePath=path.join(tmp,file);fs.writeFileSync(archivePath,archive);const tar=plat==='windows'?path.join(process.env.SystemRoot||'','System32','tar.exe'):'tar';const x=cp.spawnSync(tar,['-xf',archivePath,'-C',tmp],{stdio:'inherit'});if(x.status!==0)throw new Error('could not extract '+file);const exe='golangci-lint'+(plat==='windows'?'.exe':''),bin=path.join(gopath.stdout.trim(),'bin');fs.mkdirSync(bin,{recursive:true});fs.copyFileSync(path.join(tmp,name,exe),path.join(bin,exe));fs.chmodSync(path.join(bin,exe),0o755);fs.rmSync(tmp,{recursive:true,force:true});console.log('golangci-lint '+v+' installed from its checksum-verified prebuilt release into '+bin)})().catch(error=>fallback(error.message))"`;
|
|
1007
1008
|
var GO_TOOL_PATH_PRELUDE = "const fs=require('node:fs'),cp=require('node:child_process');if(!fs.existsSync('go.mod')){console.log('No Go projects - skipping.');process.exit(0)}const r=cp.spawnSync('go',['env','GOPATH'],{encoding:'utf8'});if(r.status!==0){console.log('Could not resolve GOPATH - skipping.');process.exit(0)}const bin=require('node:path').join(r.stdout.trim(),'bin');";
|
|
1008
1009
|
var GO_TOOL_PATH_AZURE = `node -e "${GO_TOOL_PATH_PRELUDE}console.log('##vso[task.prependpath]'+bin)"`;
|
|
1009
1010
|
var GO_TOOL_PATH_GITHUB = `node -e "${GO_TOOL_PATH_PRELUDE}if(!process.env.GITHUB_PATH){console.log('Not running in GitHub Actions - skipping.');process.exit(0)}fs.appendFileSync(process.env.GITHUB_PATH,bin+${String.raw`'\n'`})"`;
|
|
@@ -1238,8 +1239,9 @@ ${npmAuthenticateStep} - script: npm ci
|
|
|
1238
1239
|
displayName: Download Go module dependencies
|
|
1239
1240
|
|
|
1240
1241
|
# golangci-lint is what the generated Go lint target actually runs (the
|
|
1241
|
-
# plugin's own default is 'go fmt', which only reformats).
|
|
1242
|
-
#
|
|
1242
|
+
# plugin's own default is 'go fmt', which only reformats). The pinned,
|
|
1243
|
+
# checksum-verified prebuilt release lands in GOPATH/bin (go install at the
|
|
1244
|
+
# same version is the fallback), which is not on PATH by default on a hosted
|
|
1243
1245
|
# agent \u2014 so prepend it for every later step in the job.
|
|
1244
1246
|
- script: ${GOLANGCI_LINT_INSTALL_GUARD}
|
|
1245
1247
|
displayName: Install golangci-lint
|
|
@@ -1493,9 +1495,10 @@ jobs:
|
|
|
1493
1495
|
name: Download Go module dependencies
|
|
1494
1496
|
|
|
1495
1497
|
# golangci-lint is what the generated Go lint target actually runs (the
|
|
1496
|
-
# plugin's own default is 'go fmt', which only reformats).
|
|
1497
|
-
#
|
|
1498
|
-
#
|
|
1498
|
+
# plugin's own default is 'go fmt', which only reformats). The pinned,
|
|
1499
|
+
# checksum-verified prebuilt release lands in GOPATH/bin (go install at the
|
|
1500
|
+
# same version is the fallback), which is not on PATH by default on a
|
|
1501
|
+
# hosted runner \u2014 so publish it for every later step in the job.
|
|
1499
1502
|
- run: ${GOLANGCI_LINT_INSTALL_GUARD}
|
|
1500
1503
|
name: Install golangci-lint
|
|
1501
1504
|
|