@tapi-dev/sdk 0.1.8 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -25,8 +25,10 @@ npx tapi studio
25
25
  `tapi studio` checks the required local `tapi-service`, installs it when needed,
26
26
  downloads the portable Studio server release when the channel manifest uses
27
27
  `installerKind: portable-server`, starts Studio locally, and opens the browser.
28
- Legacy NSIS desktop Studio manifests still work, but the normal developer path
29
- is the portable server launched by the CLI.
28
+ If the channel still publishes a legacy NSIS desktop Studio manifest and no
29
+ Studio executable is installed yet, `tapi studio` runs the installer first, then
30
+ opens Studio. The normal developer path is the portable server launched by the
31
+ CLI.
30
32
 
31
33
  Useful commands:
32
34
 
package/dist/cli.d.ts CHANGED
@@ -85,4 +85,5 @@ export declare function getStudioExecutableCandidates(): string[];
85
85
  export declare function validateStudioManifest(input: unknown): StudioReleaseManifest;
86
86
  export declare function validateServiceReleaseManifest(input: unknown): ServiceReleaseManifest;
87
87
  export declare function compareVersions(left: string, right: string): number;
88
+ export declare function findPortableStudioServerExe(releaseDir: string, manifest: StudioReleaseManifest): string | undefined;
88
89
  export {};
package/dist/cli.js CHANGED
@@ -1329,7 +1329,15 @@ async function openStudio(options) {
1329
1329
  return 0;
1330
1330
  }
1331
1331
  }
1332
- const exePath = options.exePath ?? getStudioExecutableCandidates().find((candidate) => existsSync(candidate));
1332
+ let exePath = findStudioExecutable(options);
1333
+ if (!exePath && !options.exePath) {
1334
+ console.log("Tapi Studio executable was not found. Installing Tapi Studio now...");
1335
+ const installCode = await installStudio(options);
1336
+ if (installCode !== 0) {
1337
+ return installCode;
1338
+ }
1339
+ exePath = findStudioExecutable(options);
1340
+ }
1333
1341
  if (!exePath || !existsSync(exePath)) {
1334
1342
  console.error("Tapi Studio executable was not found.");
1335
1343
  console.error("Run `npx tapi studio install --channel pilot`, or set TAPI_STUDIO_EXE to the installed executable path.");
@@ -1345,6 +1353,12 @@ async function openStudio(options) {
1345
1353
  console.log(`Opened Tapi Studio: ${exePath}`);
1346
1354
  return 0;
1347
1355
  }
1356
+ function findStudioExecutable(options) {
1357
+ if (options.exePath) {
1358
+ return existsSync(options.exePath) ? options.exePath : undefined;
1359
+ }
1360
+ return getStudioExecutableCandidates().find((candidate) => existsSync(candidate));
1361
+ }
1348
1362
  async function ensurePortableStudioServer(options) {
1349
1363
  const event = await createCliWideEvent("tapi_cli.studio_server_ensure", {
1350
1364
  sdk_version: sdkVersion,
@@ -1896,16 +1910,18 @@ function getDefaultPortableStudioServerReleasesDir() {
1896
1910
  }
1897
1911
  return join(process.env.XDG_CACHE_HOME ?? join(homedir(), ".cache"), "tapi", "studio", "server", "releases");
1898
1912
  }
1899
- function findPortableStudioServerExe(releaseDir, manifest) {
1900
- const executable = manifest.serverExecutable || "tapi-studio-server.exe";
1901
- const baseName = executable.toLowerCase().endsWith(".exe")
1902
- ? executable.slice(0, -4)
1903
- : executable;
1913
+ export function findPortableStudioServerExe(releaseDir, manifest) {
1914
+ const executable = (manifest.serverExecutable || "tapi-studio-server.exe").replace(/\\/g, "/");
1915
+ const executableFile = basename(executable);
1916
+ const baseName = executableFile.toLowerCase().endsWith(".exe")
1917
+ ? executableFile.slice(0, -4)
1918
+ : executableFile;
1904
1919
  const candidates = [
1905
- join(releaseDir, executable),
1920
+ ...(executable.includes("/") ? [join(releaseDir, ...executable.split("/").filter(Boolean))] : []),
1906
1921
  join(releaseDir, baseName, `${baseName}.exe`),
1907
- join(releaseDir, "tapi-studio-server.exe"),
1908
1922
  join(releaseDir, "tapi-studio-server", "tapi-studio-server.exe"),
1923
+ join(releaseDir, executableFile),
1924
+ join(releaseDir, "tapi-studio-server.exe"),
1909
1925
  ];
1910
1926
  return candidates.find((candidate) => existsSync(candidate));
1911
1927
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tapi-dev/sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",