@pmate/cli 0.45.0 → 0.45.1

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
@@ -4,7 +4,7 @@ A TypeScript-powered command-line tool scaffold for future pMate automation.
4
4
 
5
5
  ## Deploy from an isolated checkout
6
6
 
7
- Vite deployments reject `--cwd`. They use the registered repository's conventional local checkout (`~/dev/pmate/<repository>`), refuse any uncommitted changes (including untracked files), fetch the latest GitHub `main`, switch to `main` and fast-forward to that exact revision. A missing remote `main`, failed switch/fetch, or local main with unpushed/divergent commits aborts before dependency installation, build or upload. No changes are stashed, reset or discarded. Dependencies are installed with `pnpm install --frozen-lockfile`; the deployed commit SHA is printed. Commit and push changes to `main` before deploying.
7
+ Vite deployments reject `--cwd`. They use a dedicated checkout at `~/.pmate/service-deploy/repos/<owner>/<repo>`, automatically cloning the registered repository on first deployment. This directory is independent of the current directory and development checkouts. They, refuse any uncommitted changes (including untracked files), fetch the latest GitHub `main`, switch to `main` and fast-forward to that exact revision. A missing remote `main`, failed switch/fetch, or local main with unpushed/divergent commits aborts before dependency installation, build or upload. No changes are stashed, reset or discarded. Dependencies are installed with `pnpm install --frozen-lockfile`; the deployed commit SHA is printed. Commit and push changes to `main` before deploying.
8
8
 
9
9
  Static and FC services can be released without modifying the conventional `~/dev/pmate` checkout. Use `pmate service deploy pmate:<service> --env prod --cwd /absolute/path/to/repo` for static or FC services. The registered service directory is resolved relative to that repository root; `--cwd` does not change the service's registered repository or environment.
10
10
 
package/dist/index.js CHANGED
@@ -20165,7 +20165,7 @@ var ServiceRuntimeRunner = class {
20165
20165
  }
20166
20166
  async deployVite(service, options) {
20167
20167
  this.assertDeployableStaticSite(service);
20168
- const repoRoot = this.resolveRepoRoot(service);
20168
+ const repoRoot = this.resolveViteDeployRoot(service);
20169
20169
  await this.checkoutViteMain(service, repoRoot);
20170
20170
  const appDir = this.resolveLocalDir(service, repoRoot);
20171
20171
  const packageJsonPath = import_node_path31.default.join(appDir, "package.json");
@@ -20195,6 +20195,13 @@ var ServiceRuntimeRunner = class {
20195
20195
  }
20196
20196
  await AliyunService.uploadDirectory(distDir, bucketName);
20197
20197
  }
20198
+ resolveViteDeployRoot(service) {
20199
+ const repository = this.getRepoStaticSite(service).repository.trim().replace(/\.git$/i, "");
20200
+ if (!/^[a-zA-Z0-9_-][a-zA-Z0-9_.-]*\/[a-zA-Z0-9_-][a-zA-Z0-9_.-]*$/.test(repository)) {
20201
+ throw new Error(`Invalid repository: ${repository}; expected owner/name`);
20202
+ }
20203
+ return import_node_path31.default.join(import_node_os14.default.homedir(), ".pmate", "service-deploy", "repos", repository.toLowerCase());
20204
+ }
20198
20205
  async checkoutViteMain(service, repoRoot) {
20199
20206
  const repository = this.getRepoStaticSite(service).repository;
20200
20207
  const repoUrl = this.getRepoUrl(repository);
@@ -20205,6 +20212,11 @@ var ServiceRuntimeRunner = class {
20205
20212
  gitEnv.GIT_CONFIG_KEY_0 = "http.https://github.com/.extraheader";
20206
20213
  gitEnv.GIT_CONFIG_VALUE_0 = `Authorization: Basic ${Buffer.from(`x-access-token:${token}`).toString("base64")}`;
20207
20214
  }
20215
+ if (!(0, import_node_fs26.existsSync)(repoRoot)) {
20216
+ (0, import_node_fs26.mkdirSync)(import_node_path31.default.dirname(repoRoot), { recursive: true });
20217
+ await this.runCommandWithEnv("git", ["clone", "--branch", "main", "--single-branch", "--", repoUrl, repoRoot], import_node_path31.default.dirname(repoRoot), gitEnv);
20218
+ }
20219
+ ui.info(`Deployment checkout: ${repoRoot}`);
20208
20220
  ui.info(`Updating ${repository} to latest main for Vite deployment`);
20209
20221
  const script = [
20210
20222
  "set -eu",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.45.0",
3
+ "version": "0.45.1",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {