nivii 0.3.2 → 0.3.4

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 (121) hide show
  1. package/README.md +113 -223
  2. package/dist/cli.js +48 -1
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/pro.d.ts +2 -0
  5. package/dist/commands/pro.d.ts.map +1 -0
  6. package/dist/commands/pro.js +174 -0
  7. package/dist/commands/pro.js.map +1 -0
  8. package/dist/commands/share.d.ts.map +1 -1
  9. package/dist/commands/share.js +5 -4
  10. package/dist/commands/share.js.map +1 -1
  11. package/dist/core/upload.d.ts +2 -1
  12. package/dist/core/upload.d.ts.map +1 -1
  13. package/dist/core/upload.js +2 -0
  14. package/dist/core/upload.js.map +1 -1
  15. package/dist/ui/spinner.d.ts +1 -0
  16. package/dist/ui/spinner.d.ts.map +1 -1
  17. package/dist/ui/spinner.js +3 -0
  18. package/dist/ui/spinner.js.map +1 -1
  19. package/dist/ui/welcome.d.ts.map +1 -1
  20. package/dist/ui/welcome.js +6 -3
  21. package/dist/ui/welcome.js.map +1 -1
  22. package/dist/utils/config.d.ts +3 -0
  23. package/dist/utils/config.d.ts.map +1 -1
  24. package/dist/utils/config.js.map +1 -1
  25. package/package.json +1 -1
  26. package/dist/dist/cli.d.ts +0 -3
  27. package/dist/dist/cli.d.ts.map +0 -1
  28. package/dist/dist/cli.js +0 -144
  29. package/dist/dist/cli.js.map +0 -1
  30. package/dist/dist/commands/config.d.ts +0 -2
  31. package/dist/dist/commands/config.d.ts.map +0 -1
  32. package/dist/dist/commands/config.js +0 -32
  33. package/dist/dist/commands/config.js.map +0 -1
  34. package/dist/dist/commands/share.d.ts +0 -18
  35. package/dist/dist/commands/share.d.ts.map +0 -1
  36. package/dist/dist/commands/share.js +0 -125
  37. package/dist/dist/commands/share.js.map +0 -1
  38. package/dist/dist/commands/whoami.d.ts +0 -2
  39. package/dist/dist/commands/whoami.d.ts.map +0 -1
  40. package/dist/dist/commands/whoami.js +0 -17
  41. package/dist/dist/commands/whoami.js.map +0 -1
  42. package/dist/dist/core/analytics.d.ts +0 -11
  43. package/dist/dist/core/analytics.d.ts.map +0 -1
  44. package/dist/dist/core/analytics.js +0 -47
  45. package/dist/dist/core/analytics.js.map +0 -1
  46. package/dist/dist/core/build.d.ts +0 -11
  47. package/dist/dist/core/build.d.ts.map +0 -1
  48. package/dist/dist/core/build.js +0 -34
  49. package/dist/dist/core/build.js.map +0 -1
  50. package/dist/dist/core/detect.d.ts +0 -12
  51. package/dist/dist/core/detect.d.ts.map +0 -1
  52. package/dist/dist/core/detect.js +0 -122
  53. package/dist/dist/core/detect.js.map +0 -1
  54. package/dist/dist/core/qr.d.ts +0 -4
  55. package/dist/dist/core/qr.d.ts.map +0 -1
  56. package/dist/dist/core/qr.js +0 -29
  57. package/dist/dist/core/qr.js.map +0 -1
  58. package/dist/dist/core/tunnel.d.ts +0 -9
  59. package/dist/dist/core/tunnel.d.ts.map +0 -1
  60. package/dist/dist/core/tunnel.js +0 -55
  61. package/dist/dist/core/tunnel.js.map +0 -1
  62. package/dist/dist/core/upload.d.ts +0 -22
  63. package/dist/dist/core/upload.d.ts.map +0 -1
  64. package/dist/dist/core/upload.js +0 -73
  65. package/dist/dist/core/upload.js.map +0 -1
  66. package/dist/dist/ui/spinner.d.ts +0 -8
  67. package/dist/dist/ui/spinner.d.ts.map +0 -1
  68. package/dist/dist/ui/spinner.js +0 -35
  69. package/dist/dist/ui/spinner.js.map +0 -1
  70. package/dist/dist/ui/theme.d.ts +0 -14
  71. package/dist/dist/ui/theme.d.ts.map +0 -1
  72. package/dist/dist/ui/theme.js +0 -32
  73. package/dist/dist/ui/theme.js.map +0 -1
  74. package/dist/dist/ui/welcome.d.ts +0 -4
  75. package/dist/dist/ui/welcome.d.ts.map +0 -1
  76. package/dist/dist/ui/welcome.js +0 -95
  77. package/dist/dist/ui/welcome.js.map +0 -1
  78. package/dist/dist/utils/config.d.ts +0 -19
  79. package/dist/dist/utils/config.d.ts.map +0 -1
  80. package/dist/dist/utils/config.js +0 -31
  81. package/dist/dist/utils/config.js.map +0 -1
  82. package/dist/dist/utils/hash.d.ts +0 -3
  83. package/dist/dist/utils/hash.d.ts.map +0 -1
  84. package/dist/dist/utils/hash.js +0 -10
  85. package/dist/dist/utils/hash.js.map +0 -1
  86. package/dist/dist/utils/zip.d.ts +0 -2
  87. package/dist/dist/utils/zip.d.ts.map +0 -1
  88. package/dist/dist/utils/zip.js +0 -19
  89. package/dist/dist/utils/zip.js.map +0 -1
  90. package/src/cli.ts +0 -118
  91. package/src/commands/config.ts +0 -33
  92. package/src/commands/share.ts +0 -159
  93. package/src/commands/whoami.ts +0 -16
  94. package/src/core/analytics.ts +0 -64
  95. package/src/core/build.ts +0 -46
  96. package/src/core/detect.ts +0 -159
  97. package/src/core/qr.ts +0 -30
  98. package/src/core/tunnel.ts +0 -70
  99. package/src/core/upload.ts +0 -95
  100. package/src/ui/spinner.ts +0 -36
  101. package/src/ui/theme.ts +0 -35
  102. package/src/ui/welcome.ts +0 -104
  103. package/src/utils/config.ts +0 -47
  104. package/src/utils/hash.ts +0 -11
  105. package/src/utils/zip.ts +0 -22
  106. /package/dist/{dist/commands → commands}/fullstack.d.ts +0 -0
  107. /package/dist/{dist/commands → commands}/fullstack.d.ts.map +0 -0
  108. /package/dist/{dist/commands → commands}/fullstack.js +0 -0
  109. /package/dist/{dist/commands → commands}/fullstack.js.map +0 -0
  110. /package/dist/{dist/core → core}/backend.d.ts +0 -0
  111. /package/dist/{dist/core → core}/backend.d.ts.map +0 -0
  112. /package/dist/{dist/core → core}/backend.js +0 -0
  113. /package/dist/{dist/core → core}/backend.js.map +0 -0
  114. /package/dist/{dist/core → core}/env.d.ts +0 -0
  115. /package/dist/{dist/core → core}/env.d.ts.map +0 -0
  116. /package/dist/{dist/core → core}/env.js +0 -0
  117. /package/dist/{dist/core → core}/env.js.map +0 -0
  118. /package/dist/{dist/core → core}/fullstack.d.ts +0 -0
  119. /package/dist/{dist/core → core}/fullstack.d.ts.map +0 -0
  120. /package/dist/{dist/core → core}/fullstack.js +0 -0
  121. /package/dist/{dist/core → core}/fullstack.js.map +0 -0
package/src/ui/theme.ts DELETED
@@ -1,35 +0,0 @@
1
- import chalk from 'chalk';
2
-
3
- export const theme = {
4
- primary: chalk.hex('#7C3AED'), // violet
5
- accent: chalk.hex('#06B6D4'), // cyan
6
- success: chalk.hex('#10B981'), // emerald
7
- warning: chalk.hex('#F59E0B'), // amber
8
- error: chalk.hex('#EF4444'), // red
9
- muted: chalk.hex('#6B7280'), // gray
10
- white: chalk.white,
11
- bold: chalk.bold,
12
- dim: chalk.dim,
13
-
14
- gradient: (text: string) => {
15
- const chars = text.split('');
16
- const colors = ['#7C3AED', '#8B5CF6', '#A78BFA', '#06B6D4', '#22D3EE'];
17
- return chars.map((c, i) => chalk.hex(colors[i % colors.length])(c)).join('');
18
- },
19
-
20
- box: (lines: string[]) => {
21
- const maxLen = Math.max(...lines.map(l => stripAnsi(l).length));
22
- const border = chalk.hex('#7C3AED')('─'.repeat(maxLen + 4));
23
- const top = chalk.hex('#7C3AED')('╭') + border + chalk.hex('#7C3AED')('╮');
24
- const bottom = chalk.hex('#7C3AED')('╰') + border + chalk.hex('#7C3AED')('╯');
25
- const mid = lines.map(l => {
26
- const pad = maxLen - stripAnsi(l).length;
27
- return chalk.hex('#7C3AED')('│') + ' ' + l + ' '.repeat(pad) + ' ' + chalk.hex('#7C3AED')('│');
28
- });
29
- return [top, ...mid, bottom].join('\n');
30
- }
31
- };
32
-
33
- function stripAnsi(str: string): string {
34
- return str.replace(/\x1b\[[0-9;]*m/g, '');
35
- }
package/src/ui/welcome.ts DELETED
@@ -1,104 +0,0 @@
1
- import chalk from 'chalk';
2
-
3
- // Fixed NIVII ASCII art — V now properly narrows to a point
4
- const NIVII_ASCII = [
5
- '███╗ ██╗██╗██╗ ██╗██╗██╗',
6
- '████╗ ██║██║██║ ██║██║██║',
7
- '██╔██╗ ██║██║██║ ██║██║██║',
8
- '██║╚██╗██║██║╚██╗ ██╔╝██║██║',
9
- '██║ ╚████║██║ ╚████╔╝ ██║██║',
10
- '╚═╝ ╚═══╝╚═╝ ╚═══╝ ╚═╝╚═╝',
11
- ];
12
-
13
- const GRADIENT = [
14
- '#6B21A8',
15
- '#7C3AED',
16
- '#8B5CF6',
17
- '#A78BFA',
18
- '#C4B5FD',
19
- '#DDD6FE',
20
- ];
21
-
22
- const cyan = chalk.hex('#06B6D4');
23
- const gray = chalk.hex('#6B7280');
24
- const green = chalk.hex('#10B981');
25
- const orange = chalk.hex('#F97316');
26
- const white = chalk.white;
27
- const purple = chalk.hex('#A78BFA');
28
-
29
- // Snow/sparkle effect row
30
- const SNOW_CHARS = ['✦', '✧', '⋆', '·', '❄', '❆', '✵', '˚', '*', ' ', ' ', ' ', ' ', ' '];
31
- function snowRow(width: number, color: string): string {
32
- return Array.from({ length: width }, () => {
33
- const ch = SNOW_CHARS[Math.floor(Math.random() * SNOW_CHARS.length)];
34
- return chalk.hex(color)(ch);
35
- }).join('');
36
- }
37
-
38
- function printSnow(): void {
39
- // Two rows of snow — alternating purple shades
40
- console.log(' ' + snowRow(30, '#7C3AED'));
41
- console.log(' ' + snowRow(30, '#A78BFA'));
42
- }
43
-
44
- export function showWelcome(): void {
45
- console.log('');
46
- printSnow();
47
- for (let i = 0; i < NIVII_ASCII.length; i++) {
48
- console.log(' ' + chalk.hex(GRADIENT[i])(NIVII_ASCII[i]));
49
- }
50
- printSnow();
51
- console.log('');
52
- console.log(' ' + orange('⚡') + ' ' + cyan('Share any project in seconds. No accounts. No config.'));
53
- console.log(' ' + gray('v0.1.8 · nivii.app'));
54
- console.log('');
55
- console.log(' ' + gray('─'.repeat(46)));
56
- console.log(' ' + cyan('Quick start:') + ' ' + white('nivii share'));
57
- console.log(' ' + cyan('Custom slug:') + ' ' + white('nivii share --slug my-demo'));
58
- console.log(' ' + cyan('With password:') + white('nivii share --pass secret123'));
59
- console.log(' ' + cyan('Live sync:') + ' ' + white('nivii share --live'));
60
- console.log(' ' + gray('─'.repeat(46)));
61
- console.log('');
62
- console.log(' ' + green('✓') + ' ' + cyan('First-run setup complete!') + gray(' Config saved to ~/.nivii/config.json'));
63
- console.log('');
64
- }
65
-
66
- export function showHelp(): void {
67
- console.log('');
68
- printSnow();
69
- for (let i = 0; i < NIVII_ASCII.length; i++) {
70
- console.log(' ' + chalk.hex(GRADIENT[i])(NIVII_ASCII[i]));
71
- }
72
- printSnow();
73
- console.log('');
74
- console.log(' ' + orange('⚡') + ' ' + cyan('Share any project in seconds. No accounts. No config.'));
75
- console.log(' ' + gray('v0.1.8 · nivii.app'));
76
- console.log('');
77
- console.log(' ' + gray('─'.repeat(50)));
78
- console.log(' ' + purple.bold('Commands'));
79
- console.log('');
80
- console.log(' ' + cyan('nivii share') + ' ' + gray('Deploy current directory'));
81
- console.log(' ' + cyan('nivii share --slug my-demo') + ' ' + gray('Custom slug (Pro)'));
82
- console.log(' ' + cyan('nivii share --pass secret') + ' ' + gray('Password protect'));
83
- console.log(' ' + cyan('nivii share --expires 24h') + ' ' + gray('Set expiry (1h/24h/7d/30d)'));
84
- console.log(' ' + cyan('nivii share --live') + ' ' + gray('Live sync on file changes'));
85
- console.log(' ' + cyan('nivii share --no-build') + ' ' + gray('Skip build step'));
86
- console.log(' ' + cyan('nivii ls') + ' ' + gray('List recent deployments'));
87
- console.log(' ' + cyan('nivii whoami') + ' ' + gray('Show account info'));
88
- console.log(' ' + cyan('nivii analytics [slug]') + ' ' + gray('View deployment analytics'));
89
- console.log(' ' + cyan('nivii config') + ' ' + gray('View/set config values'));
90
- console.log('');
91
- console.log(' ' + gray('─'.repeat(50)));
92
- console.log(' ' + gray('Docs: ') + white('https://nivii.app') + ' ' + gray('·') + ' ' + gray('Pro: ') + white('https://nivii.app/#pricing'));
93
- console.log('');
94
- }
95
-
96
- export function showBanner(): void {
97
- console.log('');
98
- console.log(
99
- ' ' + orange('⚡') + ' ' +
100
- chalk.hex('#A78BFA').bold('NIVII') + ' ' +
101
- gray('v0.1.8')
102
- );
103
- console.log('');
104
- }
@@ -1,47 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import os from 'os';
4
-
5
- export interface NiviiConfig {
6
- token?: string;
7
- plan?: 'free' | 'pro';
8
- apiBase?: string;
9
- firstRun?: boolean;
10
- deployments?: Array<{
11
- slug: string;
12
- url: string;
13
- createdAt: string;
14
- expiresAt?: string;
15
- }>;
16
- }
17
-
18
- const CONFIG_DIR = path.join(os.homedir(), '.nivii');
19
- const CONFIG_FILE = path.join(CONFIG_DIR, 'config.json');
20
-
21
- export const API_BASE = process.env.NIVII_API || 'https://api.nivii.app';
22
-
23
- export function loadConfig(): NiviiConfig {
24
- try {
25
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
26
- if (!fs.existsSync(CONFIG_FILE)) {
27
- const defaults: NiviiConfig = { firstRun: true, apiBase: API_BASE, deployments: [] };
28
- saveConfig(defaults);
29
- return defaults;
30
- }
31
- return JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf-8'));
32
- } catch {
33
- return { firstRun: true, apiBase: API_BASE, deployments: [] };
34
- }
35
- }
36
-
37
- export function saveConfig(config: NiviiConfig): void {
38
- fs.mkdirSync(CONFIG_DIR, { recursive: true });
39
- fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
40
- }
41
-
42
- export function updateConfig(updates: Partial<NiviiConfig>): NiviiConfig {
43
- const current = loadConfig();
44
- const updated = { ...current, ...updates };
45
- saveConfig(updated);
46
- return updated;
47
- }
package/src/utils/hash.ts DELETED
@@ -1,11 +0,0 @@
1
- import crypto from 'crypto';
2
-
3
- export function generateSlug(length = 8): string {
4
- const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
5
- const bytes = crypto.randomBytes(length);
6
- return Array.from(bytes).map(b => chars[b % chars.length]).join('');
7
- }
8
-
9
- export function hashFile(content: Buffer): string {
10
- return crypto.createHash('sha256').update(content).digest('hex').slice(0, 16);
11
- }
package/src/utils/zip.ts DELETED
@@ -1,22 +0,0 @@
1
- import fs from 'fs';
2
- import path from 'path';
3
- import { createWriteStream } from 'fs';
4
- import archiver from 'archiver';
5
- import os from 'os';
6
-
7
- export async function zipDirectory(sourceDir: string): Promise<string> {
8
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'nivii-'));
9
- const zipPath = path.join(tmpDir, 'deploy.zip');
10
-
11
- return new Promise((resolve, reject) => {
12
- const output = createWriteStream(zipPath);
13
- const archive = archiver('zip', { zlib: { level: 9 } });
14
-
15
- output.on('close', () => resolve(zipPath));
16
- archive.on('error', reject);
17
-
18
- archive.pipe(output);
19
- archive.directory(sourceDir, false);
20
- archive.finalize();
21
- });
22
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes