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.
- package/README.md +113 -223
- package/dist/cli.js +48 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/pro.d.ts +2 -0
- package/dist/commands/pro.d.ts.map +1 -0
- package/dist/commands/pro.js +174 -0
- package/dist/commands/pro.js.map +1 -0
- package/dist/commands/share.d.ts.map +1 -1
- package/dist/commands/share.js +5 -4
- package/dist/commands/share.js.map +1 -1
- package/dist/core/upload.d.ts +2 -1
- package/dist/core/upload.d.ts.map +1 -1
- package/dist/core/upload.js +2 -0
- package/dist/core/upload.js.map +1 -1
- package/dist/ui/spinner.d.ts +1 -0
- package/dist/ui/spinner.d.ts.map +1 -1
- package/dist/ui/spinner.js +3 -0
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/welcome.d.ts.map +1 -1
- package/dist/ui/welcome.js +6 -3
- package/dist/ui/welcome.js.map +1 -1
- package/dist/utils/config.d.ts +3 -0
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js.map +1 -1
- package/package.json +1 -1
- package/dist/dist/cli.d.ts +0 -3
- package/dist/dist/cli.d.ts.map +0 -1
- package/dist/dist/cli.js +0 -144
- package/dist/dist/cli.js.map +0 -1
- package/dist/dist/commands/config.d.ts +0 -2
- package/dist/dist/commands/config.d.ts.map +0 -1
- package/dist/dist/commands/config.js +0 -32
- package/dist/dist/commands/config.js.map +0 -1
- package/dist/dist/commands/share.d.ts +0 -18
- package/dist/dist/commands/share.d.ts.map +0 -1
- package/dist/dist/commands/share.js +0 -125
- package/dist/dist/commands/share.js.map +0 -1
- package/dist/dist/commands/whoami.d.ts +0 -2
- package/dist/dist/commands/whoami.d.ts.map +0 -1
- package/dist/dist/commands/whoami.js +0 -17
- package/dist/dist/commands/whoami.js.map +0 -1
- package/dist/dist/core/analytics.d.ts +0 -11
- package/dist/dist/core/analytics.d.ts.map +0 -1
- package/dist/dist/core/analytics.js +0 -47
- package/dist/dist/core/analytics.js.map +0 -1
- package/dist/dist/core/build.d.ts +0 -11
- package/dist/dist/core/build.d.ts.map +0 -1
- package/dist/dist/core/build.js +0 -34
- package/dist/dist/core/build.js.map +0 -1
- package/dist/dist/core/detect.d.ts +0 -12
- package/dist/dist/core/detect.d.ts.map +0 -1
- package/dist/dist/core/detect.js +0 -122
- package/dist/dist/core/detect.js.map +0 -1
- package/dist/dist/core/qr.d.ts +0 -4
- package/dist/dist/core/qr.d.ts.map +0 -1
- package/dist/dist/core/qr.js +0 -29
- package/dist/dist/core/qr.js.map +0 -1
- package/dist/dist/core/tunnel.d.ts +0 -9
- package/dist/dist/core/tunnel.d.ts.map +0 -1
- package/dist/dist/core/tunnel.js +0 -55
- package/dist/dist/core/tunnel.js.map +0 -1
- package/dist/dist/core/upload.d.ts +0 -22
- package/dist/dist/core/upload.d.ts.map +0 -1
- package/dist/dist/core/upload.js +0 -73
- package/dist/dist/core/upload.js.map +0 -1
- package/dist/dist/ui/spinner.d.ts +0 -8
- package/dist/dist/ui/spinner.d.ts.map +0 -1
- package/dist/dist/ui/spinner.js +0 -35
- package/dist/dist/ui/spinner.js.map +0 -1
- package/dist/dist/ui/theme.d.ts +0 -14
- package/dist/dist/ui/theme.d.ts.map +0 -1
- package/dist/dist/ui/theme.js +0 -32
- package/dist/dist/ui/theme.js.map +0 -1
- package/dist/dist/ui/welcome.d.ts +0 -4
- package/dist/dist/ui/welcome.d.ts.map +0 -1
- package/dist/dist/ui/welcome.js +0 -95
- package/dist/dist/ui/welcome.js.map +0 -1
- package/dist/dist/utils/config.d.ts +0 -19
- package/dist/dist/utils/config.d.ts.map +0 -1
- package/dist/dist/utils/config.js +0 -31
- package/dist/dist/utils/config.js.map +0 -1
- package/dist/dist/utils/hash.d.ts +0 -3
- package/dist/dist/utils/hash.d.ts.map +0 -1
- package/dist/dist/utils/hash.js +0 -10
- package/dist/dist/utils/hash.js.map +0 -1
- package/dist/dist/utils/zip.d.ts +0 -2
- package/dist/dist/utils/zip.d.ts.map +0 -1
- package/dist/dist/utils/zip.js +0 -19
- package/dist/dist/utils/zip.js.map +0 -1
- package/src/cli.ts +0 -118
- package/src/commands/config.ts +0 -33
- package/src/commands/share.ts +0 -159
- package/src/commands/whoami.ts +0 -16
- package/src/core/analytics.ts +0 -64
- package/src/core/build.ts +0 -46
- package/src/core/detect.ts +0 -159
- package/src/core/qr.ts +0 -30
- package/src/core/tunnel.ts +0 -70
- package/src/core/upload.ts +0 -95
- package/src/ui/spinner.ts +0 -36
- package/src/ui/theme.ts +0 -35
- package/src/ui/welcome.ts +0 -104
- package/src/utils/config.ts +0 -47
- package/src/utils/hash.ts +0 -11
- package/src/utils/zip.ts +0 -22
- /package/dist/{dist/commands → commands}/fullstack.d.ts +0 -0
- /package/dist/{dist/commands → commands}/fullstack.d.ts.map +0 -0
- /package/dist/{dist/commands → commands}/fullstack.js +0 -0
- /package/dist/{dist/commands → commands}/fullstack.js.map +0 -0
- /package/dist/{dist/core → core}/backend.d.ts +0 -0
- /package/dist/{dist/core → core}/backend.d.ts.map +0 -0
- /package/dist/{dist/core → core}/backend.js +0 -0
- /package/dist/{dist/core → core}/backend.js.map +0 -0
- /package/dist/{dist/core → core}/env.d.ts +0 -0
- /package/dist/{dist/core → core}/env.d.ts.map +0 -0
- /package/dist/{dist/core → core}/env.js +0 -0
- /package/dist/{dist/core → core}/env.js.map +0 -0
- /package/dist/{dist/core → core}/fullstack.d.ts +0 -0
- /package/dist/{dist/core → core}/fullstack.d.ts.map +0 -0
- /package/dist/{dist/core → core}/fullstack.js +0 -0
- /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
|
-
}
|
package/src/utils/config.ts
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|