@@ -6,14 +6,13 @@ import { ensureDir, exists } from '../utils/fs.ts';
66import { randomName , slugify } from '../utils/names.ts' ;
77import { writeBumpFile , readBumpFiles , filterBranchBumpFiles } from '../core/bump-file.ts' ;
88import picomatch from 'picomatch' ;
9- import { getBumpyDir , loadConfig , loadPackageConfig , matchGlob } from '../core/config.ts' ;
9+ import { getBumpyDir , loadConfig , loadPackageConfig } from '../core/config.ts' ;
1010import { discoverPackages , discoverWorkspace } from '../core/workspace.ts' ;
1111import { findChangedPackages } from './check.ts' ;
12- import { DependencyGraph } from '../core/dep-graph.ts' ;
1312import { getChangedFiles } from '../core/git.ts' ;
1413import { bumpSelectPrompt } from '../prompts/bump-select.ts' ;
1514import type { BumpSelectItem , BumpLevel } from '../prompts/bump-select.ts' ;
16- import type { BumpType , BumpTypeWithNone , BumpFileRelease , BumpFileReleaseCascade } from '../types.ts' ;
15+ import type { BumpTypeWithNone , BumpFileRelease } from '../types.ts' ;
1716
1817interface AddOptions {
1918 packages ?: string ; // "pkg-a:minor,pkg-b:patch"
@@ -23,12 +22,6 @@ interface AddOptions {
2322 none ?: boolean ;
2423}
2524
26- const CASCADE_CHOICES : { label : string ; value : BumpType } [ ] = [
27- { label : 'patch' , value : 'patch' } ,
28- { label : 'minor' , value : 'minor' } ,
29- { label : 'major' , value : 'major' } ,
30- ] ;
31-
3225export async function addCommand ( rootDir : string , opts : AddOptions ) : Promise < void > {
3326 const config = await loadConfig ( rootDir ) ;
3427 const bumpyDir = getBumpyDir ( rootDir ) ;
@@ -86,8 +79,6 @@ export async function addCommand(rootDir: string, opts: AddOptions): Promise<voi
8679 p . intro ( pc . bgCyan ( pc . black ( ' bumpy add ' ) ) ) ;
8780
8881 const pkgs = await discoverPackages ( rootDir , config ) ;
89- const depGraph = new DependencyGraph ( pkgs ) ;
90-
9182 if ( pkgs . size === 0 ) {
9283 p . cancel ( 'No managed packages found in this workspace.' ) ;
9384 process . exit ( 1 ) ;
@@ -153,62 +144,7 @@ export async function addCommand(rootDir: string, opts: AddOptions): Promise<voi
153144 process . exit ( 0 ) ;
154145 }
155146
156- releases = [ ] ;
157- for ( const { name, type : bumpType } of bumpSelections ) {
158- const release : BumpFileRelease = { name, type : bumpType } ;
159-
160- // Offer cascade options if the package has dependents (not for 'none' bumps)
161- if ( bumpType !== 'none' ) {
162- const dependents = depGraph . getDependents ( name ) ;
163- const pkg = pkgs . get ( name ) ! ;
164- const cascadeTargets = pkg . bumpy ?. cascadeTo ;
165-
166- if ( dependents . length > 0 || cascadeTargets ) {
167- const wantCascade = unwrap (
168- await p . confirm ( {
169- message : `${ pc . cyan ( name ) } has ${ pc . bold ( String ( dependents . length ) ) } dependents. Specify explicit cascades?` ,
170- initialValue : false ,
171- } ) ,
172- ) ;
173-
174- if ( wantCascade ) {
175- const allTargets = new Set < string > ( ) ;
176- for ( const d of dependents ) allTargets . add ( d . name ) ;
177- if ( cascadeTargets ) {
178- for ( const pattern of Object . keys ( cascadeTargets ) ) {
179- for ( const [ pName ] of pkgs ) {
180- if ( matchGlob ( pName , pattern ) ) allTargets . add ( pName ) ;
181- }
182- }
183- }
184-
185- const cascadeSelected = unwrap (
186- await p . multiselect < string > ( {
187- message : 'Which packages should cascade?' ,
188- options : [ ...allTargets ] . map ( ( n ) => ( { label : n , value : n } ) ) ,
189- required : false ,
190- } ) ,
191- ) ;
192-
193- if ( cascadeSelected . length > 0 ) {
194- const cascadeBump = unwrap (
195- await p . select < BumpType > ( {
196- message : 'Cascade bump type' ,
197- options : CASCADE_CHOICES ,
198- } ) ,
199- ) ;
200- const cascade : Record < string , BumpType > = { } ;
201- for ( const target of cascadeSelected ) {
202- cascade [ target ] = cascadeBump ;
203- }
204- ( release as BumpFileReleaseCascade ) . cascade = cascade ;
205- }
206- }
207- }
208- }
209-
210- releases . push ( release ) ;
211- }
147+ releases = bumpSelections . map ( ( { name, type } ) => ( { name, type } ) as BumpFileRelease ) ;
212148
213149 summary = unwrap (
214150 await p . text ( {
0 commit comments