@pushto/cli 0.2.1 → 0.4.9
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/dist/cli.js +0 -0
- package/dist/commands/__tests__/deploy-domain.test.d.ts +2 -0
- package/dist/commands/__tests__/deploy-domain.test.d.ts.map +1 -0
- package/dist/commands/__tests__/deploy-domain.test.js +41 -0
- package/dist/commands/__tests__/deploy-domain.test.js.map +1 -0
- package/dist/commands/__tests__/headless-smoke.test.d.ts +2 -0
- package/dist/commands/__tests__/headless-smoke.test.d.ts.map +1 -0
- package/dist/commands/__tests__/headless-smoke.test.js +110 -0
- package/dist/commands/__tests__/headless-smoke.test.js.map +1 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +77 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/cron.d.ts +2 -0
- package/dist/commands/cron.d.ts.map +1 -0
- package/dist/commands/cron.js +157 -0
- package/dist/commands/cron.js.map +1 -0
- package/dist/commands/db.d.ts +4 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +63 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/deploy.d.ts +16 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +230 -150
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +289 -54
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/domain.d.ts.map +1 -1
- package/dist/commands/domain.js +52 -7
- package/dist/commands/domain.js.map +1 -1
- package/dist/commands/echo.d.ts +2 -0
- package/dist/commands/echo.d.ts.map +1 -0
- package/dist/commands/echo.js +227 -0
- package/dist/commands/echo.js.map +1 -0
- package/dist/commands/env.d.ts +3 -1
- package/dist/commands/env.d.ts.map +1 -1
- package/dist/commands/env.js +76 -50
- package/dist/commands/env.js.map +1 -1
- package/dist/commands/init.d.ts +3 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +58 -11
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/login.d.ts.map +1 -1
- package/dist/commands/login.js +50 -23
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logs.d.ts +3 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +77 -21
- package/dist/commands/logs.js.map +1 -1
- package/dist/commands/mail.d.ts +2 -0
- package/dist/commands/mail.d.ts.map +1 -0
- package/dist/commands/mail.js +105 -0
- package/dist/commands/mail.js.map +1 -0
- package/dist/commands/open.d.ts.map +1 -1
- package/dist/commands/open.js +21 -1
- package/dist/commands/open.js.map +1 -1
- package/dist/commands/preview.d.ts +22 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +223 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/status.d.ts +3 -1
- package/dist/commands/status.d.ts.map +1 -1
- package/dist/commands/status.js +62 -12
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +73 -10
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/use.d.ts +2 -0
- package/dist/commands/use.d.ts.map +1 -0
- package/dist/commands/use.js +108 -0
- package/dist/commands/use.js.map +1 -0
- package/dist/commands/vault.d.ts +2 -0
- package/dist/commands/vault.d.ts.map +1 -0
- package/dist/commands/vault.js +119 -0
- package/dist/commands/vault.js.map +1 -0
- package/dist/commands/whoami.d.ts.map +1 -1
- package/dist/commands/whoami.js +12 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/index.js +117 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/__tests__/build-runner.test.d.ts +2 -0
- package/dist/lib/__tests__/build-runner.test.d.ts.map +1 -0
- package/dist/lib/__tests__/build-runner.test.js +119 -0
- package/dist/lib/__tests__/build-runner.test.js.map +1 -0
- package/dist/lib/__tests__/cron-tail.test.d.ts +2 -0
- package/dist/lib/__tests__/cron-tail.test.d.ts.map +1 -0
- package/dist/lib/__tests__/cron-tail.test.js +27 -0
- package/dist/lib/__tests__/cron-tail.test.js.map +1 -0
- package/dist/lib/__tests__/detect-static-framework.test.d.ts +2 -0
- package/dist/lib/__tests__/detect-static-framework.test.d.ts.map +1 -0
- package/dist/lib/__tests__/detect-static-framework.test.js +146 -0
- package/dist/lib/__tests__/detect-static-framework.test.js.map +1 -0
- package/dist/lib/__tests__/errors.test.d.ts +2 -0
- package/dist/lib/__tests__/errors.test.d.ts.map +1 -0
- package/dist/lib/__tests__/errors.test.js +56 -0
- package/dist/lib/__tests__/errors.test.js.map +1 -0
- package/dist/lib/__tests__/interactive.test.d.ts +2 -0
- package/dist/lib/__tests__/interactive.test.d.ts.map +1 -0
- package/dist/lib/__tests__/interactive.test.js +79 -0
- package/dist/lib/__tests__/interactive.test.js.map +1 -0
- package/dist/lib/__tests__/npm-packaging.test.d.ts +2 -0
- package/dist/lib/__tests__/npm-packaging.test.d.ts.map +1 -0
- package/dist/lib/__tests__/npm-packaging.test.js +81 -0
- package/dist/lib/__tests__/npm-packaging.test.js.map +1 -0
- package/dist/lib/__tests__/output.test.d.ts +2 -0
- package/dist/lib/__tests__/output.test.d.ts.map +1 -0
- package/dist/lib/__tests__/output.test.js +144 -0
- package/dist/lib/__tests__/output.test.js.map +1 -0
- package/dist/lib/__tests__/prepare-artifact.test.d.ts +2 -0
- package/dist/lib/__tests__/prepare-artifact.test.d.ts.map +1 -0
- package/dist/lib/__tests__/prepare-artifact.test.js +55 -0
- package/dist/lib/__tests__/prepare-artifact.test.js.map +1 -0
- package/dist/lib/__tests__/preview-args.test.d.ts +2 -0
- package/dist/lib/__tests__/preview-args.test.d.ts.map +1 -0
- package/dist/lib/__tests__/preview-args.test.js +37 -0
- package/dist/lib/__tests__/preview-args.test.js.map +1 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +22 -4
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/ask.d.ts +15 -0
- package/dist/lib/ask.d.ts.map +1 -0
- package/dist/lib/ask.js +24 -0
- package/dist/lib/ask.js.map +1 -0
- package/dist/lib/build-runner.d.ts +25 -0
- package/dist/lib/build-runner.d.ts.map +1 -0
- package/dist/lib/build-runner.js +141 -0
- package/dist/lib/build-runner.js.map +1 -0
- package/dist/lib/config.d.ts +6 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +7 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/cron-tail.d.ts +10 -0
- package/dist/lib/cron-tail.d.ts.map +1 -0
- package/dist/lib/cron-tail.js +5 -0
- package/dist/lib/cron-tail.js.map +1 -0
- package/dist/lib/detect-static-framework.d.ts +31 -0
- package/dist/lib/detect-static-framework.d.ts.map +1 -0
- package/dist/lib/detect-static-framework.js +96 -0
- package/dist/lib/detect-static-framework.js.map +1 -0
- package/dist/lib/env-parse.d.ts +48 -0
- package/dist/lib/env-parse.d.ts.map +1 -0
- package/dist/lib/env-parse.js +91 -0
- package/dist/lib/env-parse.js.map +1 -0
- package/dist/lib/errors.d.ts +111 -0
- package/dist/lib/errors.d.ts.map +1 -0
- package/dist/lib/errors.js +64 -0
- package/dist/lib/errors.js.map +1 -0
- package/dist/lib/file-walker.d.ts +23 -0
- package/dist/lib/file-walker.d.ts.map +1 -0
- package/dist/lib/file-walker.js +114 -0
- package/dist/lib/file-walker.js.map +1 -0
- package/dist/lib/interactive.d.ts +13 -0
- package/dist/lib/interactive.d.ts.map +1 -0
- package/dist/lib/interactive.js +24 -0
- package/dist/lib/interactive.js.map +1 -0
- package/dist/lib/output.d.ts +24 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +71 -0
- package/dist/lib/output.js.map +1 -0
- package/dist/lib/prepare-artifact.d.ts +22 -0
- package/dist/lib/prepare-artifact.d.ts.map +1 -0
- package/dist/lib/prepare-artifact.js +26 -0
- package/dist/lib/prepare-artifact.js.map +1 -0
- package/dist/lib/preview-args.d.ts +20 -0
- package/dist/lib/preview-args.d.ts.map +1 -0
- package/dist/lib/preview-args.js +19 -0
- package/dist/lib/preview-args.js.map +1 -0
- package/dist/lib/safe-json.d.ts +7 -2
- package/dist/lib/safe-json.d.ts.map +1 -1
- package/dist/lib/safe-json.js +23 -4
- package/dist/lib/safe-json.js.map +1 -1
- package/dist/lib/update-check.d.ts +17 -0
- package/dist/lib/update-check.d.ts.map +1 -0
- package/dist/lib/update-check.js +81 -0
- package/dist/lib/update-check.js.map +1 -0
- package/dist/lib/upload-limits.d.ts +17 -0
- package/dist/lib/upload-limits.d.ts.map +1 -0
- package/dist/lib/upload-limits.js +17 -0
- package/dist/lib/upload-limits.js.map +1 -0
- package/dist/lib/zip-project.d.ts +19 -0
- package/dist/lib/zip-project.d.ts.map +1 -0
- package/dist/lib/zip-project.js +39 -0
- package/dist/lib/zip-project.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +16 -0
- package/dist/version.js.map +1 -0
- package/package.json +5 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/lib/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,WAAW,EAAwB,MAAM,aAAa,CAAC;AAM5E;;;;;;;GAOG;AAEH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,IAAgB,EAAQ,EAAE;IAC/D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAgB,EAAsB,EAAE,CACpE,IAAI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AK,CAAC,GAAG,CAAC,KAAK,MAAM,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CACxE,CAAC;QACF,OAAO;IACT,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACtF,CAAC,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,IAAqB,EACrB,KAAa,EACb,IAAgB,EAChB,KAAwC,EACjC,EAAE;IACT,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AAClC,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one entry point deploy + preview share: decide whether this
|
|
3
|
+
* directory deploys as-is (source) or gets built first (artifact).
|
|
4
|
+
* Keeping it here means `pushto` and `pushto preview` cannot drift —
|
|
5
|
+
* the exact failure the spec calls out (working deploys, blank previews).
|
|
6
|
+
*/
|
|
7
|
+
export type ArtifactPrep = {
|
|
8
|
+
kind: 'source';
|
|
9
|
+
zipDir: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'artifact';
|
|
12
|
+
zipDir: string;
|
|
13
|
+
framework: string;
|
|
14
|
+
typeWarnings: string | null;
|
|
15
|
+
cleanup: () => void;
|
|
16
|
+
} | {
|
|
17
|
+
kind: 'failed';
|
|
18
|
+
message: string;
|
|
19
|
+
buildOutput: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const prepareArtifact: (cwd: string, log: (line: string) => void) => Promise<ArtifactPrep>;
|
|
22
|
+
//# sourceMappingURL=prepare-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-artifact.d.ts","sourceRoot":"","sources":["../../src/lib/prepare-artifact.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,GACzG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7D,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,KAAK,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,KAC1B,OAAO,CAAC,YAAY,CAsBtB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { detectStaticFramework } from './detect-static-framework.js';
|
|
2
|
+
import { runStaticBuild, writeArtifactMeta } from './build-runner.js';
|
|
3
|
+
export const prepareArtifact = async (cwd, log) => {
|
|
4
|
+
const detection = detectStaticFramework(cwd);
|
|
5
|
+
if (!detection)
|
|
6
|
+
return { kind: 'source', zipDir: cwd };
|
|
7
|
+
const build = await runStaticBuild(cwd, detection, { log });
|
|
8
|
+
if (!build.ok)
|
|
9
|
+
return { kind: 'failed', message: build.message, buildOutput: build.buildOutput };
|
|
10
|
+
const cleanup = writeArtifactMeta(build.outputDir, {
|
|
11
|
+
framework: detection.framework,
|
|
12
|
+
spa: detection.spa,
|
|
13
|
+
});
|
|
14
|
+
// The marker must never outlive the command: registering cleanup on
|
|
15
|
+
// process exit covers every failure branch (process.exit calls
|
|
16
|
+
// included), so no call site can forget it. cleanup is idempotent.
|
|
17
|
+
process.once('exit', cleanup);
|
|
18
|
+
return {
|
|
19
|
+
kind: 'artifact',
|
|
20
|
+
zipDir: build.outputDir,
|
|
21
|
+
framework: detection.framework,
|
|
22
|
+
typeWarnings: build.typeWarnings,
|
|
23
|
+
cleanup,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=prepare-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepare-artifact.js","sourceRoot":"","sources":["../../src/lib/prepare-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAatE,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAClC,GAAW,EACX,GAA2B,EACJ,EAAE;IACzB,MAAM,SAAS,GAAG,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,CAAC,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;IAEvD,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5D,IAAI,CAAC,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,CAAC;IAEjG,MAAM,OAAO,GAAG,iBAAiB,CAAC,KAAK,CAAC,SAAS,EAAE;QACjD,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,GAAG,EAAE,SAAS,CAAC,GAAG;KACnB,CAAC,CAAC;IACH,oEAAoE;IACpE,+DAA+D;IAC/D,mEAAmE;IACnE,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK,CAAC,SAAS;QACvB,SAAS,EAAE,SAAS,CAAC,SAAS;QAC9B,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,OAAO;KACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `pushto preview` action grammar, as one pure function.
|
|
3
|
+
*
|
|
4
|
+
* The command's help and docs/cli teach "(create, ls, rm)". Before this
|
|
5
|
+
* seam the dispatcher had no `create` verb — any unknown action word was
|
|
6
|
+
* treated as a directory, so the documented `pushto preview create` died
|
|
7
|
+
* with "not a directory: create". A bare positional directory
|
|
8
|
+
* (`pushto preview dist`) still works.
|
|
9
|
+
*/
|
|
10
|
+
export type PreviewAction = {
|
|
11
|
+
kind: 'create';
|
|
12
|
+
dir: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'ls';
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'rm';
|
|
17
|
+
ref: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare const resolvePreviewAction: (action: string, args: string[]) => PreviewAction;
|
|
20
|
+
//# sourceMappingURL=preview-args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-args.d.ts","sourceRoot":"","sources":["../../src/lib/preview-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,GACd;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE5C,eAAO,MAAM,oBAAoB,GAAI,QAAQ,MAAM,EAAE,MAAM,MAAM,EAAE,KAAG,aAKrE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `pushto preview` action grammar, as one pure function.
|
|
3
|
+
*
|
|
4
|
+
* The command's help and docs/cli teach "(create, ls, rm)". Before this
|
|
5
|
+
* seam the dispatcher had no `create` verb — any unknown action word was
|
|
6
|
+
* treated as a directory, so the documented `pushto preview create` died
|
|
7
|
+
* with "not a directory: create". A bare positional directory
|
|
8
|
+
* (`pushto preview dist`) still works.
|
|
9
|
+
*/
|
|
10
|
+
export const resolvePreviewAction = (action, args) => {
|
|
11
|
+
if (action === 'ls' || action === 'list')
|
|
12
|
+
return { kind: 'ls' };
|
|
13
|
+
if (action === 'rm' || action === 'delete')
|
|
14
|
+
return { kind: 'rm', ref: args[0] };
|
|
15
|
+
if (action === 'create')
|
|
16
|
+
return { kind: 'create', dir: args[0] ?? '.' };
|
|
17
|
+
return { kind: 'create', dir: action.length > 0 ? action : '.' };
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=preview-args.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-args.js","sourceRoot":"","sources":["../../src/lib/preview-args.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAAE,IAAc,EAAiB,EAAE;IACpF,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAChE,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAChF,IAAI,MAAM,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC;IACxE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AACnE,CAAC,CAAC"}
|
package/dist/lib/safe-json.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Safely parse a Response as JSON.
|
|
3
|
-
* Returns the parsed object, or
|
|
4
|
-
* isn't valid JSON
|
|
3
|
+
* Returns the parsed object, or an `{ error }` envelope when the body
|
|
4
|
+
* isn't valid JSON. The error string includes the HTTP status, the
|
|
5
|
+
* request path, and a body preview so a downstream "> ${data.error}"
|
|
6
|
+
* print still tells the user (and us) what actually failed.
|
|
7
|
+
*
|
|
8
|
+
* Replaces the old "server returned non-JSON: " message that lost all
|
|
9
|
+
* context when the body was empty (e.g. an unhandled 500 from the API).
|
|
5
10
|
*/
|
|
6
11
|
export declare const safeJson: <T = Record<string, unknown>>(res: Response) => Promise<T>;
|
|
7
12
|
//# sourceMappingURL=safe-json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-json.d.ts","sourceRoot":"","sources":["../../src/lib/safe-json.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"safe-json.d.ts","sourceRoot":"","sources":["../../src/lib/safe-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAU,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxD,KAAK,QAAQ,KACZ,OAAO,CAAC,CAAC,CAuBX,CAAC"}
|
package/dist/lib/safe-json.js
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Safely parse a Response as JSON.
|
|
3
|
-
* Returns the parsed object, or
|
|
4
|
-
* isn't valid JSON
|
|
3
|
+
* Returns the parsed object, or an `{ error }` envelope when the body
|
|
4
|
+
* isn't valid JSON. The error string includes the HTTP status, the
|
|
5
|
+
* request path, and a body preview so a downstream "> ${data.error}"
|
|
6
|
+
* print still tells the user (and us) what actually failed.
|
|
7
|
+
*
|
|
8
|
+
* Replaces the old "server returned non-JSON: " message that lost all
|
|
9
|
+
* context when the body was empty (e.g. an unhandled 500 from the API).
|
|
5
10
|
*/
|
|
6
11
|
export const safeJson = async (res) => {
|
|
7
12
|
const text = await res.text();
|
|
13
|
+
if (text) {
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(text);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// fall through
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
let path = '';
|
|
8
22
|
try {
|
|
9
|
-
|
|
23
|
+
path = new URL(res.url).pathname;
|
|
10
24
|
}
|
|
11
25
|
catch {
|
|
12
|
-
|
|
26
|
+
// res.url may be empty in some runtimes
|
|
13
27
|
}
|
|
28
|
+
const where = path ? ` from ${path}` : '';
|
|
29
|
+
const error = text
|
|
30
|
+
? `pushto.host returned ${res.status}${where}. body: ${text.slice(0, 200)}`
|
|
31
|
+
: `pushto.host returned ${res.status}${where} with an empty body — likely a server crash. try again, or email support@pushto.host if it sticks.`;
|
|
32
|
+
return { error };
|
|
14
33
|
};
|
|
15
34
|
//# sourceMappingURL=safe-json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-json.js","sourceRoot":"","sources":["../../src/lib/safe-json.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"safe-json.js","sourceRoot":"","sources":["../../src/lib/safe-json.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,EAC3B,GAAa,EACD,EAAE;IACd,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,IAAI,EAAE,CAAC;QACT,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,eAAe;QACjB,CAAC;IACH,CAAC;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC;IACnC,CAAC;IAAC,MAAM,CAAC;QACP,wCAAwC;IAC1C,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAE1C,MAAM,KAAK,GAAG,IAAI;QAChB,CAAC,CAAC,wBAAwB,GAAG,CAAC,MAAM,GAAG,KAAK,WAAW,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;QAC3E,CAAC,CAAC,wBAAwB,GAAG,CAAC,MAAM,GAAG,KAAK,oGAAoG,CAAC;IAEnJ,OAAO,EAAE,KAAK,EAAO,CAAC;AACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface UpdateInfo {
|
|
2
|
+
current: string;
|
|
3
|
+
latest: string;
|
|
4
|
+
needsUpdate: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Check npm registry for a newer version of @pushto/cli.
|
|
8
|
+
* Caches the result for 24 hours to avoid slowing down every invocation.
|
|
9
|
+
* Returns null if the check was skipped (cached) or failed (network error).
|
|
10
|
+
*/
|
|
11
|
+
export declare const checkForUpdate: (force?: boolean) => Promise<UpdateInfo | null>;
|
|
12
|
+
/** Read the version baked into this CLI build. The build script overwrites
|
|
13
|
+
* src/version.ts with the real value before each `bun build --compile`.
|
|
14
|
+
* Local dev (tsx src/index.ts) keeps the committed "0.0.0-dev". */
|
|
15
|
+
export declare const getCurrentVersion: () => string;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=update-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-check.d.ts","sourceRoot":"","sources":["../../src/lib/update-check.ts"],"names":[],"mappings":"AAGA,UAAU,UAAU;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;CACtB;AAID;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACzB,eAAa,KACZ,OAAO,CAAC,UAAU,GAAG,IAAI,CAiC3B,CAAC;AAoCF;;oEAEoE;AACpE,eAAO,MAAM,iBAAiB,QAAO,MAAiB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { config } from './config.js';
|
|
2
|
+
import { VERSION } from '../version.js';
|
|
3
|
+
const CHECK_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
4
|
+
/**
|
|
5
|
+
* Check npm registry for a newer version of @pushto/cli.
|
|
6
|
+
* Caches the result for 24 hours to avoid slowing down every invocation.
|
|
7
|
+
* Returns null if the check was skipped (cached) or failed (network error).
|
|
8
|
+
*/
|
|
9
|
+
export const checkForUpdate = async (force = false) => {
|
|
10
|
+
const lastCheck = config.get('lastUpdateCheck');
|
|
11
|
+
if (!force && lastCheck && Date.now() - lastCheck < CHECK_INTERVAL_MS) {
|
|
12
|
+
// Return cached result if we checked recently
|
|
13
|
+
const cached = config.get('latestVersion');
|
|
14
|
+
if (cached) {
|
|
15
|
+
const current = getCurrentVersion();
|
|
16
|
+
return { current, latest: cached, needsUpdate: isNewer(cached, current) };
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
const timeout = setTimeout(() => controller.abort(), 3000);
|
|
23
|
+
const latest = await fetchLatestVersion(controller.signal);
|
|
24
|
+
clearTimeout(timeout);
|
|
25
|
+
if (!latest)
|
|
26
|
+
return null;
|
|
27
|
+
config.set('lastUpdateCheck', Date.now());
|
|
28
|
+
config.set('latestVersion', latest);
|
|
29
|
+
const current = getCurrentVersion();
|
|
30
|
+
return { current, latest, needsUpdate: isNewer(latest, current) };
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Network error, offline, timeout — don't bother the user
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
// Pick the right "latest version" source for how this CLI was installed.
|
|
38
|
+
// Homebrew binaries get versioned by GitHub releases on the homebrew-tap
|
|
39
|
+
// repo (the source repo is private). npm-installed CLIs check the npm
|
|
40
|
+
// registry. Mixing them caused the infinite "upgrade available → brew says
|
|
41
|
+
// already current → re-prompt" loop in <0.4.0.
|
|
42
|
+
const fetchLatestVersion = async (signal) => {
|
|
43
|
+
if (isBrewBinary()) {
|
|
44
|
+
const res = await fetch('https://api.github.com/repos/mydude-industries/homebrew-tap/releases/latest', { signal, headers: { Accept: 'application/vnd.github+json' } });
|
|
45
|
+
if (!res.ok)
|
|
46
|
+
return null;
|
|
47
|
+
const data = (await res.json());
|
|
48
|
+
return data.tag_name?.replace(/^v/, '') ?? null;
|
|
49
|
+
}
|
|
50
|
+
const res = await fetch('https://registry.npmjs.org/@pushto/cli/latest', { signal });
|
|
51
|
+
if (!res.ok)
|
|
52
|
+
return null;
|
|
53
|
+
const data = (await res.json());
|
|
54
|
+
return data.version ?? null;
|
|
55
|
+
};
|
|
56
|
+
const isBrewBinary = () => {
|
|
57
|
+
const exe = process.execPath;
|
|
58
|
+
return (exe.includes('/Cellar/') ||
|
|
59
|
+
exe.startsWith('/opt/homebrew/') ||
|
|
60
|
+
exe.includes('/linuxbrew/') ||
|
|
61
|
+
exe.includes('/home/linuxbrew/'));
|
|
62
|
+
};
|
|
63
|
+
/** Read the version baked into this CLI build. The build script overwrites
|
|
64
|
+
* src/version.ts with the real value before each `bun build --compile`.
|
|
65
|
+
* Local dev (tsx src/index.ts) keeps the committed "0.0.0-dev". */
|
|
66
|
+
export const getCurrentVersion = () => VERSION;
|
|
67
|
+
/** True if `a` is a newer semver than `b`. */
|
|
68
|
+
const isNewer = (a, b) => {
|
|
69
|
+
const pa = a.split('.').map(Number);
|
|
70
|
+
const pb = b.split('.').map(Number);
|
|
71
|
+
for (let i = 0; i < 3; i++) {
|
|
72
|
+
const av = pa[i] ?? 0;
|
|
73
|
+
const bv = pb[i] ?? 0;
|
|
74
|
+
if (av > bv)
|
|
75
|
+
return true;
|
|
76
|
+
if (av < bv)
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
return false;
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=update-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-check.js","sourceRoot":"","sources":["../../src/lib/update-check.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAQxC,MAAM,iBAAiB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,WAAW;AAE1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,KAAK,GAAG,KAAK,EACe,EAAE;IAC9B,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,iBAA0B,CAE1C,CAAC;IAEd,IAAI,CAAC,KAAK,IAAI,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,GAAG,iBAAiB,EAAE,CAAC;QACtE,8CAA8C;QAC9C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,eAAwB,CAAuB,CAAC;QAC1E,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;YACpC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;QAC5E,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAA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YAAE,OAAO,IAAI,CAAC;QACzB,IAAI,EAAE,GAAG,EAAE;YAAE,OAAO,KAAK,CAAC;IAC5B,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload-size cap that matches the server-side validation in
|
|
3
|
+
* apps/web/app/api/cli/projects/[slug]/upload/route.ts (line ~83).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth so doctor and deploy can't disagree:
|
|
6
|
+
* - doctor uses it to warn before the user even tries
|
|
7
|
+
* - deploy uses it to fail fast LOCALLY before wasting a ~30s upload
|
|
8
|
+
* that the server will 413 anyway
|
|
9
|
+
*
|
|
10
|
+
* If you bump this, bump the server check at the same time. Pre-fix,
|
|
11
|
+
* deploy.ts had its own MAX_ZIP_BYTES = 500MB constant — uploads
|
|
12
|
+
* between 50MB and 500MB went up the wire and got rejected after
|
|
13
|
+
* the long upload finished.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SERVER_UPLOAD_CAP_BYTES: number;
|
|
16
|
+
export declare const fmtMB: (bytes: number) => string;
|
|
17
|
+
//# sourceMappingURL=upload-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-limits.d.ts","sourceRoot":"","sources":["../../src/lib/upload-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AAExD,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,KAAG,MAAiD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Upload-size cap that matches the server-side validation in
|
|
3
|
+
* apps/web/app/api/cli/projects/[slug]/upload/route.ts (line ~83).
|
|
4
|
+
*
|
|
5
|
+
* Single source of truth so doctor and deploy can't disagree:
|
|
6
|
+
* - doctor uses it to warn before the user even tries
|
|
7
|
+
* - deploy uses it to fail fast LOCALLY before wasting a ~30s upload
|
|
8
|
+
* that the server will 413 anyway
|
|
9
|
+
*
|
|
10
|
+
* If you bump this, bump the server check at the same time. Pre-fix,
|
|
11
|
+
* deploy.ts had its own MAX_ZIP_BYTES = 500MB constant — uploads
|
|
12
|
+
* between 50MB and 500MB went up the wire and got rejected after
|
|
13
|
+
* the long upload finished.
|
|
14
|
+
*/
|
|
15
|
+
export const SERVER_UPLOAD_CAP_BYTES = 50 * 1024 * 1024;
|
|
16
|
+
export const fmtMB = (bytes) => `${(bytes / 1024 / 1024).toFixed(1)}MB`;
|
|
17
|
+
//# sourceMappingURL=upload-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upload-limits.js","sourceRoot":"","sources":["../../src/lib/upload-limits.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git metadata for the current working tree. Falls back to safe defaults
|
|
3
|
+
* outside a git repo so a deploy/preview from a plain folder still works.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getGitInfo: () => {
|
|
6
|
+
hash: string | null;
|
|
7
|
+
message: string | null;
|
|
8
|
+
branch: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Zip a directory's deployable files into an in-memory buffer. Respects
|
|
12
|
+
* .gitignore/.pushtoignore + the ALWAYS_IGNORE footgun list via walkProject.
|
|
13
|
+
* Shared by `pushto` (deploy) and `pushto preview` so the two can't drift.
|
|
14
|
+
*/
|
|
15
|
+
export declare const zipDirectory: (dir: string) => Promise<{
|
|
16
|
+
buffer: Buffer;
|
|
17
|
+
fileCount: number;
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=zip-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-project.d.ts","sourceRoot":"","sources":["../../src/lib/zip-project.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,UAAU,QAAO;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAS1F,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAiBvF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { execSync } from 'node:child_process';
|
|
2
|
+
import archiver from 'archiver';
|
|
3
|
+
import { walkProject } from './file-walker.js';
|
|
4
|
+
/**
|
|
5
|
+
* Git metadata for the current working tree. Falls back to safe defaults
|
|
6
|
+
* outside a git repo so a deploy/preview from a plain folder still works.
|
|
7
|
+
*/
|
|
8
|
+
export const getGitInfo = () => {
|
|
9
|
+
try {
|
|
10
|
+
const hash = execSync('git rev-parse --short HEAD', { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
11
|
+
const message = execSync('git log -1 --pretty=%s', { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
12
|
+
const branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: ['pipe', 'pipe', 'ignore'] }).toString().trim();
|
|
13
|
+
return { hash, message, branch };
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return { hash: null, message: null, branch: 'main' };
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Zip a directory's deployable files into an in-memory buffer. Respects
|
|
21
|
+
* .gitignore/.pushtoignore + the ALWAYS_IGNORE footgun list via walkProject.
|
|
22
|
+
* Shared by `pushto` (deploy) and `pushto preview` so the two can't drift.
|
|
23
|
+
*/
|
|
24
|
+
export const zipDirectory = (dir) => {
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
const archive = archiver('zip', { zlib: { level: 9 } });
|
|
27
|
+
const chunks = [];
|
|
28
|
+
archive.on('data', (chunk) => chunks.push(chunk));
|
|
29
|
+
archive.on('end', () => resolve({ buffer: Buffer.concat(chunks), fileCount }));
|
|
30
|
+
archive.on('error', reject);
|
|
31
|
+
const files = walkProject(dir);
|
|
32
|
+
const fileCount = files.length;
|
|
33
|
+
for (const file of files) {
|
|
34
|
+
archive.file(file.fullPath, { name: file.archivePath });
|
|
35
|
+
}
|
|
36
|
+
archive.finalize();
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=zip-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zip-project.js","sourceRoot":"","sources":["../../src/lib/zip-project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAoE,EAAE;IAC9F,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,QAAQ,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC;QAC7G,MAAM,OAAO,GAAG,QAAQ,CAAC,wBAAwB,EAAE,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,IAA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C,QAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,CAAC,QAAQ,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// AUTO-GENERATED FILE — DO NOT EDIT BY HAND.
|
|
2
|
+
//
|
|
3
|
+
// The literal "0.4.9" below is a placeholder. In CI release
|
|
4
|
+
// builds (scripts/build-binaries.sh), `sed` replaces it with the real version
|
|
5
|
+
// string before each `bun build --compile` invocation, and the build asserts
|
|
6
|
+
// the version was actually embedded by greping the binary. This is the
|
|
7
|
+
// approach that finally stuck after `bun build --define` and the `cat >
|
|
8
|
+
// version.ts` overwrite both lost the version on darwin-arm64 cross-compiles
|
|
9
|
+
// (linux-amd64 worked fine — the failure mode was platform-specific and
|
|
10
|
+
// silent).
|
|
11
|
+
//
|
|
12
|
+
// In local dev (`tsx src/index.ts`) the placeholder stays put and `pushto
|
|
13
|
+
// --version` reports the literal "0.4.9" — a giveaway
|
|
14
|
+
// that you're on the source tree, not a release build.
|
|
15
|
+
export const VERSION = "0.4.9";
|
|
16
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,4DAA4D;AAC5D,8EAA8E;AAC9E,6EAA6E;AAC7E,uEAAuE;AACvE,wEAAwE;AACxE,6EAA6E;AAC7E,wEAAwE;AACxE,WAAW;AACX,EAAE;AACF,0EAA0E;AAC1E,sDAAsD;AACtD,uDAAuD;AACvD,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushto/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "Deploy to pushto.host from your terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -11,8 +11,10 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc",
|
|
14
|
-
"
|
|
14
|
+
"start": "tsx src/index.ts",
|
|
15
15
|
"lint": "tsc --noEmit",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"test": "vitest run",
|
|
16
18
|
"prepublishOnly": "npm run build"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
@@ -20,12 +22,7 @@
|
|
|
20
22
|
"chalk": "^5.4.0",
|
|
21
23
|
"commander": "^13.0.0",
|
|
22
24
|
"conf": "^13.0.0",
|
|
25
|
+
"ignore": "^7.0.0",
|
|
23
26
|
"ora": "^8.1.0"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/archiver": "^7.0.0",
|
|
27
|
-
"@types/node": "^22.10.0",
|
|
28
|
-
"tsx": "^4.19.0",
|
|
29
|
-
"typescript": "^5.7.0"
|
|
30
27
|
}
|
|
31
28
|
}
|