Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2988262

Browse files
committed
fix: restored proper paths for manifest checks
1 parent 3322d0f commit 2988262

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

packages/cli/src/dx/readiness/helpers/releasePack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ async function detectCliPhpDriverBundle(
265265
}
266266

267267
const bundleTargets = [
268+
path.join('dist', 'packages', 'php-driver', entryPoint),
268269
path.join('dist', 'packages', 'php-driver', 'dist', 'installer.js'),
269270
path.join(
270271
'dist',

packages/cli/vite.config.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { resolve as resolvePath } from 'node:path';
2+
import { cp, mkdir, rm } from 'node:fs/promises';
23
import { fileURLToPath } from 'node:url';
34
import type { PluginOption } from 'vite';
45
import type { Reporter } from '@wpkernel/core/reporter';
@@ -14,6 +15,15 @@ interface DriverInstallerHelper {
1415

1516
type PhpDriverInstallerFactory = () => DriverInstallerHelper;
1617

18+
async function copyPhpDriverDist(outDir: string): Promise<void> {
19+
const source = resolvePath(CLI_ROOT, '..', 'php-driver', 'dist');
20+
const target = resolvePath(outDir, 'packages', 'php-driver', 'dist');
21+
22+
await rm(target, { recursive: true, force: true }).catch(() => undefined);
23+
await mkdir(target, { recursive: true });
24+
await cp(source, target, { recursive: true });
25+
}
26+
1727
function resolveCliRoot(): string {
1828
if (typeof __dirname === 'string') {
1929
return __dirname;
@@ -117,10 +127,16 @@ function createConsoleReporter(): Reporter {
117127

118128
function phpDriverInstallerPlugin(): PluginOption {
119129
let hasRun = false;
130+
let resolvedOutDir = resolvePath(CLI_ROOT, 'dist');
120131

121132
return {
122133
name: 'wpkernel-cli-php-driver-installer',
123134
apply: 'build',
135+
configResolved(config) {
136+
const root = config.root ?? CLI_ROOT;
137+
const dir = config.build?.outDir ?? 'dist';
138+
resolvedOutDir = resolvePath(root, dir);
139+
},
124140
async buildStart() {
125141
if (hasRun) {
126142
return;
@@ -147,6 +163,9 @@ function phpDriverInstallerPlugin(): PluginOption {
147163
undefined
148164
);
149165
},
166+
async writeBundle() {
167+
await copyPhpDriverDist(resolvedOutDir);
168+
},
150169
};
151170
}
152171

0 commit comments

Comments
 (0)