@@ -5,7 +5,13 @@ import { parseArgs } from "util";
55import { runCheck } from "./check.mjs" ;
66import { headSha7 , utcDateStamp } from "./lib/git.mjs" ;
77import { npmViewExists , pnpmPublish } from "./lib/npm.mjs" ;
8- import { PACKAGES , packageJsonPath , readPackageJson , writePackageJson } from "./lib/packages.mjs" ;
8+ import {
9+ ALL_PACKAGES ,
10+ PACKAGES ,
11+ packageJsonPath ,
12+ readPackageJson ,
13+ writePackageJson ,
14+ } from "./lib/packages.mjs" ;
915import { assertChannel } from "./lib/validate.mjs" ;
1016
1117function log ( msg = "" ) {
@@ -20,11 +26,14 @@ const { values } = parseArgs({
2026 options : {
2127 channel : { type : "string" } ,
2228 "dry-run" : { type : "boolean" , default : false } ,
29+ knowledge : { type : "boolean" , default : false } ,
2330 } ,
2431 allowPositionals : false ,
2532} ) ;
2633const channel = values . channel ;
2734const dryRun = values [ "dry-run" ] ;
35+ const knowledge = values . knowledge ;
36+ const packages = knowledge ? ALL_PACKAGES : PACKAGES ;
2837assertChannel ( channel ) ;
2938
3039if ( ! dryRun && ! process . env . CI ) {
@@ -34,7 +43,7 @@ if (!dryRun && !process.env.CI) {
3443
3544// Snapshot every package.json so the temporary version bump is reverted in
3645// `finally`, even when the release fails midway.
37- const originals = PACKAGES . map ( ( pkg ) => {
46+ const originals = packages . map ( ( pkg ) => {
3847 const path = packageJsonPath ( pkg ) ;
3948 return { pkg, path, content : readFileSync ( path , "utf-8" ) } ;
4049} ) ;
@@ -51,28 +60,28 @@ try {
5160 log ( `channel=${ channel } version=${ betaVersion } ` ) ;
5261
5362 step ( "temporarily bump package.json (not committed)" ) ;
54- for ( const pkg of PACKAGES ) {
63+ for ( const pkg of packages ) {
5564 const json = readPackageJson ( pkg ) ;
5665 json . version = betaVersion ;
5766 writePackageJson ( pkg , json ) ;
5867 }
5968 // pnpm pack resolves `workspace:*` to the in-tree version, so each tarball
6069 // will depend on its siblings at <betaVersion> after this bump.
6170
62- await runCheck ( { channel : true } ) ;
71+ await runCheck ( { channel : true , knowledge } ) ;
6372
6473 step ( `idempotency: check ${ betaVersion } against registry` ) ;
6574 const published = new Map ( ) ;
66- for ( const pkg of PACKAGES ) {
75+ for ( const pkg of packages ) {
6776 const exists = npmViewExists ( pkg . name , betaVersion ) ;
6877 published . set ( pkg . key , exists ) ;
6978 log ( `${ pkg . name } @${ betaVersion } : ${ exists ? "already published" : "to publish" } ` ) ;
7079 }
71- if ( PACKAGES . every ( ( pkg ) => published . get ( pkg . key ) ) ) {
80+ if ( packages . every ( ( pkg ) => published . get ( pkg . key ) ) ) {
7281 log ( "\nall packages already published; nothing to do." ) ;
7382 } else {
74- // Publish in dependency order (core → runtime → commands → cli).
75- for ( const pkg of PACKAGES ) {
83+ // Publish in dependency order (core → runtime → commands → cli [→ kscli] ).
84+ for ( const pkg of packages ) {
7685 if ( published . get ( pkg . key ) ) continue ;
7786 step ( `publish ${ pkg . name } @${ betaVersion } (tag=${ channel } , provenance)` ) ;
7887 pnpmPublish ( pkg , { tag : channel , provenance : true , dryRun } ) ;
0 commit comments