mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-22 08:38:08 +02:00
refactor(workspace): rename @ktx/cli to @kaelio/ktx and pack it directly
Promote the CLI workspace package to the public name `@kaelio/ktx` and drop the separate `scripts/build-public-npm-package.mjs` wrapper. The CLI package is now publishable in place (`publishConfig.access: public`, `provenance: true`), so artifact packing uses `pnpm pack` against `packages/cli/` instead of assembling a parallel package tree. Updates all workspace filter invocations, docs, tests, and release readiness checks to reference the new package name, and folds the tarball-name helper into `scripts/public-npm-release-metadata.mjs`.
This commit is contained in:
parent
34d4a1e9e1
commit
aa523f9ab3
31 changed files with 99 additions and 452 deletions
|
|
@ -15,8 +15,8 @@ import {
|
|||
import {
|
||||
PUBLIC_NPM_PACKAGE_NAME,
|
||||
publicNpmPackageTarballName,
|
||||
} from './build-public-npm-package.mjs';
|
||||
import { publicNpmPackageVersion } from './public-npm-release-metadata.mjs';
|
||||
publicNpmPackageVersion,
|
||||
} from './public-npm-release-metadata.mjs';
|
||||
|
||||
export {
|
||||
RUNTIME_WHEEL_DISTRIBUTION_NAME,
|
||||
|
|
@ -24,10 +24,6 @@ export {
|
|||
RUNTIME_WHEEL_PACKAGE_VERSION,
|
||||
};
|
||||
|
||||
export const INTERNAL_NPM_WORKSPACE_PACKAGES = [
|
||||
{ name: '@ktx/cli', packageRoot: 'packages/cli' },
|
||||
];
|
||||
|
||||
export const NPM_ARTIFACT_PACKAGES = [{ name: PUBLIC_NPM_PACKAGE_NAME, packageRoot: 'packages/cli' }];
|
||||
|
||||
export const CLI_PYTHON_ASSET_MANIFEST = 'manifest.json';
|
||||
|
|
@ -72,30 +68,22 @@ export function packageArtifactLayout(rootDir = scriptRootDir(), version = publi
|
|||
}
|
||||
|
||||
export function buildArtifactCommands(layout) {
|
||||
const npmBuildCommand = {
|
||||
command: 'pnpm',
|
||||
args: [
|
||||
'--filter',
|
||||
'@ktx/cli',
|
||||
'run',
|
||||
'build',
|
||||
],
|
||||
cwd: layout.rootDir,
|
||||
};
|
||||
const publicPackageCommand = {
|
||||
command: process.execPath,
|
||||
args: ['scripts/build-public-npm-package.mjs'],
|
||||
cwd: layout.rootDir,
|
||||
};
|
||||
|
||||
return [
|
||||
npmBuildCommand,
|
||||
{
|
||||
command: 'pnpm',
|
||||
args: ['--filter', PUBLIC_NPM_PACKAGE_NAME, 'run', 'build'],
|
||||
cwd: layout.rootDir,
|
||||
},
|
||||
{
|
||||
command: process.execPath,
|
||||
args: ['scripts/build-python-runtime-wheel.mjs'],
|
||||
cwd: layout.rootDir,
|
||||
},
|
||||
publicPackageCommand,
|
||||
{
|
||||
command: 'pnpm',
|
||||
args: ['pack', '--out', layout.cliTarball],
|
||||
cwd: join(layout.rootDir, 'packages', 'cli'),
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -163,19 +151,17 @@ function releaseMetadataEntry({ ecosystem, packageName, packageRoot, packageVers
|
|||
|
||||
async function readNpmPackageMetadata(rootDir, packageInfo, version) {
|
||||
const packageJson = await readJson(join(rootDir, packageInfo.packageRoot, 'package.json'));
|
||||
const expectedSourceName = packageInfo.name === PUBLIC_NPM_PACKAGE_NAME ? '@ktx/cli' : packageInfo.name;
|
||||
if (packageJson.name !== expectedSourceName) {
|
||||
if (packageJson.name !== packageInfo.name) {
|
||||
throw new Error(
|
||||
`Unexpected package name in ${packageInfo.packageRoot}/package.json: expected ${expectedSourceName}, got ${packageJson.name}`,
|
||||
`Unexpected package name in ${packageInfo.packageRoot}/package.json: expected ${packageInfo.name}, got ${packageJson.name}`,
|
||||
);
|
||||
}
|
||||
const isPublicKtxPackage = packageInfo.name === PUBLIC_NPM_PACKAGE_NAME;
|
||||
return releaseMetadataEntry({
|
||||
ecosystem: 'npm',
|
||||
packageName: packageInfo.name,
|
||||
packageRoot: packageInfo.packageRoot,
|
||||
packageVersion: isPublicKtxPackage ? version : packageJson.version,
|
||||
privatePackage: isPublicKtxPackage ? false : packageJson.private === true,
|
||||
packageVersion: version,
|
||||
privatePackage: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -922,13 +908,13 @@ async function buildArtifacts(layout) {
|
|||
await mkdir(layout.npmDir, { recursive: true });
|
||||
await mkdir(layout.pythonDir, { recursive: true });
|
||||
|
||||
const [npmBuildCommand, wheelCommand, publicPackageCommand] = buildArtifactCommands(layout);
|
||||
const [npmBuildCommand, wheelCommand, packCommand] = buildArtifactCommands(layout);
|
||||
|
||||
await runCommand(npmBuildCommand.command, npmBuildCommand.args, { cwd: npmBuildCommand.cwd });
|
||||
await runCommand(wheelCommand.command, wheelCommand.args, { cwd: wheelCommand.cwd });
|
||||
const pythonArtifacts = await findPythonArtifacts(layout.pythonDir);
|
||||
await copyRuntimeWheelAssets(layout, pythonArtifacts);
|
||||
await runCommand(publicPackageCommand.command, publicPackageCommand.args, { cwd: publicPackageCommand.cwd });
|
||||
await runCommand(packCommand.command, packCommand.args, { cwd: packCommand.cwd });
|
||||
|
||||
for (const packageInfo of NPM_ARTIFACT_PACKAGES) {
|
||||
await assertPathExists(layout.npmTarballs[packageInfo.name], `${packageInfo.name} tarball`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue