Skip to content

Commit fe16ee9

Browse files
committed
Use requested SSI plugin path in CLI
1 parent 0e70a38 commit fe16ee9

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

apps/cli/lib/dependency-management/paths.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ export function getBlueprintsPharPath(): string {
5858

5959
// Static Site Importer ships read-only with the CLI bundle (downloaded at npm
6060
// install time by `scripts/download-wp-server-files.ts`) and is symlinked into
61-
// each site's mu-plugins temp directory. No writable cache needed — the
62-
// bundled directory is treated as the source of truth.
61+
// each site's mu-plugins temp directory. Bench harnesses may override that
62+
// bundled copy to test an active SSI worktree.
6363
export function getStaticSiteImporterPluginPath(): string {
64+
if ( process.env.STUDIO_STATIC_SITE_IMPORTER_PLUGIN_PATH ) {
65+
return process.env.STUDIO_STATIC_SITE_IMPORTER_PLUGIN_PATH;
66+
}
67+
6468
return path.join( getWpFilesPath(), 'static-site-importer' );
6569
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import path from 'path';
2+
import { afterEach, describe, expect, it } from 'vitest';
3+
import { getStaticSiteImporterPluginPath } from '../paths';
4+
5+
describe( 'dependency path helpers', () => {
6+
afterEach( () => {
7+
delete process.env.STUDIO_STATIC_SITE_IMPORTER_PLUGIN_PATH;
8+
} );
9+
10+
it( 'uses the requested Static Site Importer plugin path when provided', () => {
11+
process.env.STUDIO_STATIC_SITE_IMPORTER_PLUGIN_PATH =
12+
'/tmp/static-site-importer-worktree';
13+
14+
expect( getStaticSiteImporterPluginPath() ).toBe( '/tmp/static-site-importer-worktree' );
15+
} );
16+
17+
it( 'falls back to the bundled Static Site Importer plugin path', () => {
18+
expect( getStaticSiteImporterPluginPath() ).toContain(
19+
path.join( 'wp-files', 'static-site-importer' )
20+
);
21+
} );
22+
} );

0 commit comments

Comments
 (0)