@mnci/cli 4.3.1 → 4.3.2
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/dist/cli.js +47 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -861,7 +861,7 @@ var AFFECTED_OR_ALL_GUARD = `node -e "const cp=require('node:child_process');con
|
|
|
861
861
|
var PACK_APPS_GUARD = `node -e "const fs=require('node:fs');fs.mkdirSync('dist/drop',{recursive:true});const hasProjectJson=fs.globSync('apps/*/project.json').length>0;const hasInlineNx=fs.globSync('apps/*/package.json').some((f)=>{try{return Boolean(JSON.parse(fs.readFileSync(f,'utf8')).nx)}catch{return false}});const hasCsproj=fs.globSync('apps/*/*.csproj').length>0;if(!hasProjectJson&&!hasInlineNx&&!hasCsproj){console.log('No apps to pack - skipping.');process.exit(0)}process.exit(require('node:child_process').spawnSync('npx nx run-many -t package',{stdio:'inherit',shell:true}).status ?? 1)"`;
|
|
862
862
|
var SHALLOW_CLONE_GUARD = `node -e "const r=require('node:child_process').spawnSync('git',['rev-parse','--is-shallow-repository'],{encoding:'utf8'});if(r.status!==0){console.error('Could not determine whether this checkout has full history (git rev-parse --is-shallow-repository failed) - refusing to release. '+(r.stderr||'').trim());process.exit(1)}if(r.stdout.trim()==='true'){console.error('This checkout is a shallow clone. nx release resolves the current version of each package from its git tag, and silently falls back to the permanently-stale on-disk version when a tag cannot be found - which can propose, and publish, a version DOWNGRADE. Fetch full history before releasing - set fetchDepth (Azure) or fetch-depth (GitHub) to 0.');process.exit(1)}"`;
|
|
863
863
|
function releaseGuard(pythonPublishEnv, nugetPublishEnv) {
|
|
864
|
-
return String.raw`node -e "const fs=require('node:fs'),cp=require('node:child_process');const npmCount=fs.globSync('packages/*/package.json').length;const csharpCount=fs.globSync('packages/*/*.csproj').length;const pythonCount=fs.globSync('python-packages/*/pyproject.toml').length;const hasNpm=npmCount>0;const hasPython=pythonCount>0;const hasCsharp=csharpCount>0;if(!hasNpm&&!hasPython&&!hasCsharp){console.log('Nothing to release - skipping.');process.exit(0)}const specifier=process.env.RELEASE_SPECIFIER||'';let releaseCmd='npx nx release --yes';if(specifier){if(!/^(major|minor|patch|\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?)$/.test(specifier)){console.error('RELEASE_SPECIFIER value \''+specifier+'\' is invalid - use major, minor, patch, or an exact version like 1.2.3.');process.exit(1)}const releaseProjectCount=npmCount+csharpCount+pythonCount;if(/^(major|minor|patch)$/.test(specifier)&&releaseProjectCount>1){console.error('RELEASE_SPECIFIER is a keyword (\''+specifier+'\') but this workspace has '+releaseProjectCount+' releasable packages - a keyword under-bumps interdependent packages, because nx computes the dependency-bump pass from a stale cached version. Set RELEASE_SPECIFIER to an exact version instead, or clear it.');process.exit(1)}releaseCmd='npx nx release '+specifier+' --yes'}const env={...process.env};${pythonPublishEnv}${nugetPublishEnv}process.exit(cp.spawnSync(releaseCmd,{stdio:'inherit',shell:true,env}).status ?? 1)"`;
|
|
864
|
+
return String.raw`node -e "const fs=require('node:fs'),cp=require('node:child_process');const npmCount=fs.globSync('packages/*/package.json').length;const csharpCount=fs.globSync('packages/*/*.csproj').length;const pythonCount=fs.globSync('python-packages/*/pyproject.toml').length;const dartCount=fs.globSync('packages/*/pubspec.yaml').length;const hasNpm=npmCount>0;const hasPython=pythonCount>0;const hasCsharp=csharpCount>0;const hasDart=dartCount>0;if(!hasNpm&&!hasPython&&!hasCsharp&&!hasDart){console.log('Nothing to release - skipping.');process.exit(0)}const specifier=process.env.RELEASE_SPECIFIER||'';let releaseCmd='npx nx release --yes';if(specifier){if(!/^(major|minor|patch|\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?)$/.test(specifier)){console.error('RELEASE_SPECIFIER value \''+specifier+'\' is invalid - use major, minor, patch, or an exact version like 1.2.3.');process.exit(1)}const releaseProjectCount=npmCount+csharpCount+pythonCount+dartCount;if(/^(major|minor|patch)$/.test(specifier)&&releaseProjectCount>1){console.error('RELEASE_SPECIFIER is a keyword (\''+specifier+'\') but this workspace has '+releaseProjectCount+' releasable packages - a keyword under-bumps interdependent packages, because nx computes the dependency-bump pass from a stale cached version. Set RELEASE_SPECIFIER to an exact version instead, or clear it.');process.exit(1)}releaseCmd='npx nx release '+specifier+' --yes'}const env={...process.env};${pythonPublishEnv}${nugetPublishEnv}process.exit(cp.spawnSync(releaseCmd,{stdio:'inherit',shell:true,env}).status ?? 1)"`;
|
|
865
865
|
}
|
|
866
866
|
function pythonPublishEnvFragment(pythonPublishUrl2) {
|
|
867
867
|
return pythonPublishUrl2 ? `if(hasPython){env.TWINE_REPOSITORY_URL='${pythonPublishUrl2}';env.TWINE_USERNAME='AzureArtifacts';env.TWINE_PASSWORD=Buffer.from(process.env.PAT,'base64').toString()}` : "";
|
|
@@ -1742,6 +1742,12 @@ var SOURCEMAP_PATH_TRANSFORM = [
|
|
|
1742
1742
|
var DECLARATION_SPECIFIER_PLUGIN_MARKER = "name: 'mnci-normalise-declaration-specifiers'";
|
|
1743
1743
|
var DECLARATION_SPECIFIER_EXTENSION_MARKER = "bareRelativeSpecifier";
|
|
1744
1744
|
var DECLARATION_SPECIFIER_DIRECTORY_MARKER = "resolveSpecifierSuffix";
|
|
1745
|
+
function hasDeclarationSpecifierPlugin(config) {
|
|
1746
|
+
return config.includes(DECLARATION_SPECIFIER_PLUGIN_MARKER);
|
|
1747
|
+
}
|
|
1748
|
+
function hasDirectoryAwareDeclarationSpecifiers(config) {
|
|
1749
|
+
return config.includes(DECLARATION_SPECIFIER_DIRECTORY_MARKER);
|
|
1750
|
+
}
|
|
1745
1751
|
var DECLARATION_SPECIFIER_PLUGIN = [
|
|
1746
1752
|
" {",
|
|
1747
1753
|
" name: 'mnci-normalise-declaration-specifiers',",
|
|
@@ -4098,6 +4104,7 @@ function checkNpmrc(workspaceRoot, registry, scope) {
|
|
|
4098
4104
|
function checkVersionActions(workspaceRoot) {
|
|
4099
4105
|
const candidates = [
|
|
4100
4106
|
...(0, import_node_fs9.globSync)("packages/*/pubspec.yaml", { cwd: workspaceRoot }),
|
|
4107
|
+
...(0, import_node_fs9.globSync)("packages/*/*.csproj", { cwd: workspaceRoot }),
|
|
4101
4108
|
...(0, import_node_fs9.globSync)("python-packages/*/pyproject.toml", { cwd: workspaceRoot })
|
|
4102
4109
|
].map((manifest) => toPosix2(manifest));
|
|
4103
4110
|
return candidates.flatMap((manifest) => {
|
|
@@ -4226,6 +4233,44 @@ function checkRollupSourceMaps(workspaceRoot) {
|
|
|
4226
4233
|
];
|
|
4227
4234
|
});
|
|
4228
4235
|
}
|
|
4236
|
+
function checkDeclarationSpecifiers(workspaceRoot) {
|
|
4237
|
+
const configs = (0, import_node_fs9.globSync)(["packages/*/rollup.config.cjs", "libs/*/rollup.config.cjs"], {
|
|
4238
|
+
cwd: workspaceRoot
|
|
4239
|
+
}).map((config) => toPosix2(config));
|
|
4240
|
+
return configs.flatMap((relativePath) => {
|
|
4241
|
+
const configPath = (0, import_node_path15.join)(workspaceRoot, relativePath);
|
|
4242
|
+
if (!fileExists(configPath)) {
|
|
4243
|
+
return [];
|
|
4244
|
+
}
|
|
4245
|
+
const resolved = resolveRollupConfigText(configPath);
|
|
4246
|
+
if (!hasDeclarationSpecifierPlugin(resolved)) {
|
|
4247
|
+
return [
|
|
4248
|
+
{
|
|
4249
|
+
check: `${relativePath} normalises declaration specifiers`,
|
|
4250
|
+
ok: false,
|
|
4251
|
+
detail: "no mnci-normalise-declaration-specifiers plugin \u2014 the emitted .d.ts files keep the extensionless imports tsconfig.lib.json allows, which a nodenext consumer cannot resolve",
|
|
4252
|
+
// Deliberately NOT `mnci upgrade`, which would send the user in a
|
|
4253
|
+
// circle: `upgradeDeclarationSpecifierPlugins` only rewrites a
|
|
4254
|
+
// plugin that is already there, and `repairDeclarationSpecifiers`
|
|
4255
|
+
// is anchored on the generator's own placeholder comment, which a
|
|
4256
|
+
// config in this state no longer has. Verified by running the
|
|
4257
|
+
// command against exactly this shape — it no-ops. Naming a command
|
|
4258
|
+
// that silently does nothing is the failure mode this file's own
|
|
4259
|
+
// source-map check already goes out of its way to avoid.
|
|
4260
|
+
remedy: "add the plugin to withNx's second argument by hand (copy it from a freshly `mnci add npm-lib`'d project) \u2014 `mnci upgrade` only updates a plugin that is already present, it cannot restore a missing one"
|
|
4261
|
+
}
|
|
4262
|
+
];
|
|
4263
|
+
}
|
|
4264
|
+
return [
|
|
4265
|
+
{
|
|
4266
|
+
check: `${relativePath} resolves directory barrels in declarations`,
|
|
4267
|
+
ok: hasDirectoryAwareDeclarationSpecifiers(resolved),
|
|
4268
|
+
detail: "the plugin appends .js to every bare specifier, including ones naming a directory barrel, which needs /index.js \u2014 the named file is never emitted, so every export behind it publishes as `any` with nothing reporting it",
|
|
4269
|
+
remedy: "run `mnci upgrade`, which replaces the plugin body with the current one"
|
|
4270
|
+
}
|
|
4271
|
+
];
|
|
4272
|
+
});
|
|
4273
|
+
}
|
|
4229
4274
|
function collectFindings(workspaceRoot) {
|
|
4230
4275
|
const nxJsonPath = (0, import_node_path15.join)(workspaceRoot, "nx.json");
|
|
4231
4276
|
if (!fileExists(nxJsonPath)) {
|
|
@@ -4242,6 +4287,7 @@ function collectFindings(workspaceRoot) {
|
|
|
4242
4287
|
checkNpmrc(workspaceRoot, nxJson.mnci?.registry, nxJson.mnci?.scope),
|
|
4243
4288
|
checkNoRootRuntimeDependencies(workspaceRoot),
|
|
4244
4289
|
...checkRollupSourceMaps(workspaceRoot),
|
|
4290
|
+
...checkDeclarationSpecifiers(workspaceRoot),
|
|
4245
4291
|
...checkVersionActions(workspaceRoot),
|
|
4246
4292
|
...checkTargetFilesExist(workspaceRoot),
|
|
4247
4293
|
checkSync(workspaceRoot)
|