-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial use of madge for circular dependency detection, see phetsims/…
- Loading branch information
1 parent
103d8a4
commit 8969056
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"detectiveOptions": { | ||
"ts": { | ||
"skipTypeImports": true | ||
} | ||
}, | ||
"tsConfig": "./tsconfig/tsconfig-browser.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2025, University of Colorado Boulder | ||
|
||
/** | ||
* Checks out circular dependencies within PhET repositories | ||
* | ||
* @author Jonathan Olson <[email protected]> | ||
*/ | ||
import _ from 'lodash'; | ||
import { isOptionKeyProvided } from './util/getOption.js'; | ||
import getRepoList from '../../common/getRepoList.js'; | ||
import fs from 'fs'; | ||
import execute from '../../common/execute.js'; | ||
|
||
( async () => { | ||
const isCommonOnly = isOptionKeyProvided( 'common' ); | ||
|
||
const commonRepos = getRepoList( 'active-common-sim-repos' ); | ||
const simRepos = getRepoList( 'active-sims' ); | ||
const runnableRepos = getRepoList( 'active-runnables' ); | ||
|
||
const potentialRepos = _.uniq( [ | ||
...commonRepos, | ||
|
||
...( isCommonOnly ? [] : simRepos ), | ||
...( isCommonOnly ? [] : runnableRepos ) | ||
] ).sort(); | ||
|
||
const repos = potentialRepos.filter( repo => { | ||
return fs.existsSync( `../${repo}/js` ); | ||
} ); | ||
|
||
const npxCommand = process.platform.startsWith( 'win' ) ? 'npx.cmd' : 'npx'; | ||
|
||
const result = await execute( npxCommand, [ 'madge', '--warning', '--circular', ...repos.map( repo => `../${repo}/js` ) ], '.', { errors: 'resolve' } ); | ||
|
||
console.log( result.stdout ); | ||
console.log( result.stderr ); | ||
|
||
// if ( result.code !== 0 ) { | ||
// console.error( 'madge failed - likely has circular dependencies' ); | ||
// process.exit( 1 ); | ||
// } | ||
} )(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters