Files
wehub-resource-sync 98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:40:49 +08:00

56 lines
1.4 KiB
JavaScript

'use strict';
const fs = require('node:fs');
const path = require('node:path');
const { createRequire } = require('node:module');
const require_ = createRequire(__filename);
function packageRoot() {
return __dirname;
}
function getWebappDirectory() {
return path.join(packageRoot(), 'webapp');
}
function findTsxCli() {
return require_.resolve('tsx/cli', { paths: [packageRoot()] });
}
function resolveServerArtifact() {
const runtime = path.join(packageRoot(), 'dist', 'standalone.mjs');
if (fs.existsSync(runtime)) {
const webappDir = getWebappDirectory();
return {
command: process.execPath,
prefixArgs: [runtime],
cwd: packageRoot(),
bundled: false,
source: 'package',
platform: `${process.arch}-${process.platform}`,
webappDir: fs.existsSync(path.join(webappDir, 'index.html')) ? webappDir : undefined,
};
}
const standalone = path.join(packageRoot(), 'sources', 'standalone.ts');
if (!fs.existsSync(standalone)) return undefined;
const webappDir = getWebappDirectory();
return {
command: process.execPath,
prefixArgs: [findTsxCli(), standalone],
cwd: packageRoot(),
bundled: false,
source: 'package',
platform: `${process.arch}-${process.platform}`,
webappDir: fs.existsSync(path.join(webappDir, 'index.html')) ? webappDir : undefined,
};
}
module.exports = {
packageRoot,
getWebappDirectory,
resolveServerArtifact,
};