@pushto/cli 0.0.9 → 0.1.0

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.
Files changed (43) hide show
  1. package/dist/cli.d.ts +3 -0
  2. package/dist/cli.d.ts.map +1 -0
  3. package/dist/cli.js +2 -1
  4. package/dist/cli.js.map +1 -0
  5. package/dist/commands/deploy.d.ts.map +1 -1
  6. package/dist/commands/deploy.js +32 -10
  7. package/dist/commands/deploy.js.map +1 -1
  8. package/dist/commands/domain.d.ts.map +1 -1
  9. package/dist/commands/domain.js +25 -14
  10. package/dist/commands/domain.js.map +1 -1
  11. package/dist/commands/env.d.ts.map +1 -1
  12. package/dist/commands/env.js +43 -1
  13. package/dist/commands/env.js.map +1 -1
  14. package/dist/commands/upgrade.d.ts +2 -0
  15. package/dist/commands/upgrade.d.ts.map +1 -0
  16. package/dist/commands/upgrade.js +19 -0
  17. package/dist/commands/upgrade.js.map +1 -0
  18. package/dist/commands/whoami.d.ts +2 -0
  19. package/dist/commands/whoami.d.ts.map +1 -0
  20. package/dist/commands/whoami.js +35 -0
  21. package/dist/commands/whoami.js.map +1 -0
  22. package/dist/index.d.ts +0 -1
  23. package/dist/index.js +14 -1
  24. package/dist/index.js.map +1 -1
  25. package/package.json +5 -2
  26. package/.turbo/turbo-build.log +0 -4
  27. package/bin/pushto.js +0 -2
  28. package/src/commands/deploy.ts +0 -135
  29. package/src/commands/doctor.ts +0 -160
  30. package/src/commands/domain.ts +0 -54
  31. package/src/commands/env.ts +0 -129
  32. package/src/commands/init.ts +0 -66
  33. package/src/commands/login.ts +0 -97
  34. package/src/commands/logs.ts +0 -24
  35. package/src/commands/open.ts +0 -27
  36. package/src/commands/rollback.ts +0 -43
  37. package/src/commands/status.ts +0 -59
  38. package/src/index.ts +0 -88
  39. package/src/lib/api.ts +0 -25
  40. package/src/lib/config.ts +0 -30
  41. package/src/lib/resolve-slug.ts +0 -23
  42. package/src/lib/safe-json.ts +0 -15
  43. package/tsconfig.json +0 -18
package/src/index.ts DELETED
@@ -1,88 +0,0 @@
1
- #!/usr/bin/env node
2
- import { Command } from 'commander';
3
- import chalk from 'chalk';
4
- import { init } from './commands/init.js';
5
- import { deploy } from './commands/deploy.js';
6
- import { login } from './commands/login.js';
7
- import { logs } from './commands/logs.js';
8
- import { status } from './commands/status.js';
9
- import { doctor } from './commands/doctor.js';
10
- import { env } from './commands/env.js';
11
- import { open } from './commands/open.js';
12
- import { rollback } from './commands/rollback.js';
13
- import { domain } from './commands/domain.js';
14
-
15
- const program = new Command();
16
-
17
- program
18
- .name('pushto')
19
- .description(chalk.green('pushto') + chalk.dim(' — deploy from your terminal. no yaml. no drama.'))
20
- .version('0.0.1')
21
- .action(async () => {
22
- await deploy();
23
- });
24
-
25
- program
26
- .command('init <name>')
27
- .description('create a new project')
28
- .action(async (name: string) => {
29
- await init(name);
30
- });
31
-
32
- program
33
- .command('login')
34
- .description('authenticate with pushto.host')
35
- .action(async () => {
36
- await login();
37
- });
38
-
39
- program
40
- .command('logs')
41
- .description('stream logs from your project')
42
- .action(async () => {
43
- await logs();
44
- });
45
-
46
- program
47
- .command('status')
48
- .description('check your project status')
49
- .action(async () => {
50
- await status();
51
- });
52
-
53
- program
54
- .command('doctor')
55
- .description('check if your project is ready to deploy')
56
- .action(async () => {
57
- await doctor();
58
- });
59
-
60
- program
61
- .command('env <action> [args...]')
62
- .description('manage environment variables (set, list, pull, rm)')
63
- .action(async (action: string, args: string[]) => {
64
- await env(action, args);
65
- });
66
-
67
- program
68
- .command('open')
69
- .description('open your live site in the browser')
70
- .action(async () => {
71
- await open();
72
- });
73
-
74
- program
75
- .command('rollback [version]')
76
- .description('rollback to a previous deployment')
77
- .action(async (version?: string) => {
78
- await rollback(version);
79
- });
80
-
81
- program
82
- .command('domain <action> [domain]')
83
- .description('manage custom domains (add, remove)')
84
- .action(async (action: string, domainName?: string) => {
85
- await domain(action, domainName);
86
- });
87
-
88
- program.parse();
package/src/lib/api.ts DELETED
@@ -1,25 +0,0 @@
1
- import { config, getToken } from './config.js';
2
-
3
- export const api = async (path: string, options: RequestInit = {}): Promise<Response> => {
4
- const baseUrl = config.get('apiUrl');
5
- const token = getToken();
6
-
7
- const existingHeaders = (options.headers as Record<string, string>) ?? {};
8
- const headers: Record<string, string> = {
9
- ...existingHeaders,
10
- };
11
-
12
- // Only set Content-Type to JSON if not already specified
13
- if (!headers['Content-Type']) {
14
- headers['Content-Type'] = 'application/json';
15
- }
16
-
17
- if (token) {
18
- headers['Authorization'] = `Bearer ${token}`;
19
- }
20
-
21
- return fetch(`${baseUrl}/api${path}`, {
22
- ...options,
23
- headers,
24
- });
25
- };
package/src/lib/config.ts DELETED
@@ -1,30 +0,0 @@
1
- import Conf from 'conf';
2
-
3
- interface PushtoConfig {
4
- token?: string;
5
- apiUrl: string;
6
- projectSlug?: string;
7
- }
8
-
9
- export const config = new Conf<PushtoConfig>({
10
- projectName: 'pushto',
11
- defaults: {
12
- apiUrl: 'https://pushto.host',
13
- },
14
- });
15
-
16
- export const getToken = (): string | undefined => config.get('token');
17
-
18
- export const setToken = (token: string): void => {
19
- config.set('token', token);
20
- };
21
-
22
- export const clearToken = (): void => {
23
- config.delete('token');
24
- };
25
-
26
- export const getProjectSlug = (): string | undefined => config.get('projectSlug');
27
-
28
- export const setProjectSlug = (slug: string): void => {
29
- config.set('projectSlug', slug);
30
- };
@@ -1,23 +0,0 @@
1
- import fs from 'node:fs';
2
- import path from 'node:path';
3
- import { getProjectSlug } from './config.js';
4
-
5
- /**
6
- * Resolve the project slug from:
7
- * 1. .pushto file in the current directory
8
- * 2. Global config (last `pushto init`)
9
- */
10
- export const resolveSlug = (): string | undefined => {
11
- // Check for .pushto file in cwd
12
- const pushtoFile = path.join(process.cwd(), '.pushto');
13
- try {
14
- const content = fs.readFileSync(pushtoFile, 'utf-8');
15
- const parsed = JSON.parse(content);
16
- if (parsed.slug) return parsed.slug;
17
- } catch {
18
- // No .pushto file or invalid JSON — fall through
19
- }
20
-
21
- // Fall back to global config
22
- return getProjectSlug();
23
- };
@@ -1,15 +0,0 @@
1
- /**
2
- * Safely parse a Response as JSON.
3
- * Returns the parsed object, or a fallback error object if the response
4
- * isn't valid JSON (e.g., HTML error pages from the server).
5
- */
6
- export const safeJson = async <T = Record<string, unknown>>(
7
- res: Response,
8
- ): Promise<T> => {
9
- const text = await res.text();
10
- try {
11
- return JSON.parse(text) as T;
12
- } catch {
13
- return { error: `server returned non-JSON: ${text.slice(0, 100)}` } as T;
14
- }
15
- };
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "NodeNext",
5
- "moduleResolution": "NodeNext",
6
- "outDir": "./dist",
7
- "rootDir": "./src",
8
- "strict": true,
9
- "esModuleInterop": true,
10
- "skipLibCheck": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "resolveJsonModule": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true
16
- },
17
- "include": ["src"]
18
- }