pixelstart 1.1.0 → 1.2.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.
- package/dist/index.js +8 -4
- package/dist/modules/init.js +7 -3
- package/dist/modules/license.d.ts +8 -1
- package/dist/modules/license.js +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { banner, section, success, error, info } from './modules/ui.js';
|
|
|
5
5
|
import { checkRequirements } from './modules/requirements.js';
|
|
6
6
|
import { showNDA } from './modules/nda.js';
|
|
7
7
|
import { initProject } from './modules/init.js';
|
|
8
|
-
const VERSION = '1.
|
|
8
|
+
const VERSION = '1.2.0';
|
|
9
9
|
async function main() {
|
|
10
10
|
const args = process.argv.slice(2);
|
|
11
11
|
const command = args[0];
|
|
@@ -47,7 +47,7 @@ async function main() {
|
|
|
47
47
|
async function retryPull() {
|
|
48
48
|
section('Pull Docker Image');
|
|
49
49
|
const inquirer = await import('inquirer');
|
|
50
|
-
const { validateLicense, exchangeDownloadToken } = await import('./modules/license.js');
|
|
50
|
+
const { validateLicense, exchangeDownloadToken, buildDockerCommands } = await import('./modules/license.js');
|
|
51
51
|
const { key } = await inquirer.default.prompt([
|
|
52
52
|
{
|
|
53
53
|
type: 'input',
|
|
@@ -71,14 +71,18 @@ async function retryPull() {
|
|
|
71
71
|
info('Pulling Docker image...');
|
|
72
72
|
const { execSync } = await import('child_process');
|
|
73
73
|
try {
|
|
74
|
-
|
|
74
|
+
const { login, pull } = buildDockerCommands(downloadResult);
|
|
75
|
+
execSync(login, { stdio: 'inherit' });
|
|
76
|
+
execSync(pull, { stdio: 'inherit' });
|
|
75
77
|
console.log('');
|
|
76
78
|
success(`Docker image ${chalk.bold(downloadResult.image)} pulled successfully!`);
|
|
77
79
|
}
|
|
78
80
|
catch {
|
|
79
81
|
error('Docker pull failed. You can retry manually:');
|
|
80
82
|
console.log('');
|
|
81
|
-
|
|
83
|
+
const { login, pull } = buildDockerCommands(downloadResult);
|
|
84
|
+
console.log(chalk.white(` ${login}`));
|
|
85
|
+
console.log(chalk.white(` ${pull}`));
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
88
|
function printHelp() {
|
package/dist/modules/init.js
CHANGED
|
@@ -4,7 +4,7 @@ import path from 'path';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import { section, success, error, info } from './ui.js';
|
|
7
|
-
import { validateLicense, exchangeDownloadToken } from './license.js';
|
|
7
|
+
import { validateLicense, exchangeDownloadToken, buildDockerCommands } from './license.js';
|
|
8
8
|
export async function initProject() {
|
|
9
9
|
section('Project Setup');
|
|
10
10
|
const config = await inquirer.prompt([
|
|
@@ -103,14 +103,18 @@ data/
|
|
|
103
103
|
info('Pulling Docker image...');
|
|
104
104
|
console.log('');
|
|
105
105
|
try {
|
|
106
|
-
|
|
106
|
+
const { login, pull } = buildDockerCommands(downloadResult);
|
|
107
|
+
execSync(login, { stdio: 'inherit' });
|
|
108
|
+
execSync(pull, { stdio: 'inherit' });
|
|
107
109
|
console.log('');
|
|
108
110
|
success(`Docker image ${chalk.bold(downloadResult.image)} pulled successfully!`);
|
|
109
111
|
}
|
|
110
112
|
catch (err) {
|
|
111
113
|
error('Docker pull failed. You can retry manually:');
|
|
112
114
|
console.log('');
|
|
113
|
-
|
|
115
|
+
const { login, pull } = buildDockerCommands(downloadResult);
|
|
116
|
+
console.log(chalk.white(` ${login}`));
|
|
117
|
+
console.log(chalk.white(` ${pull}`));
|
|
114
118
|
}
|
|
115
119
|
console.log('');
|
|
116
120
|
success(`Project "${chalk.bold(config.name)}" created!`);
|
|
@@ -7,12 +7,19 @@ export interface LicenseValidation {
|
|
|
7
7
|
}
|
|
8
8
|
export interface DownloadResult {
|
|
9
9
|
success: boolean;
|
|
10
|
-
|
|
10
|
+
token: string;
|
|
11
11
|
image: string;
|
|
12
|
+
owner: string;
|
|
13
|
+
imageName: string;
|
|
12
14
|
tag: string;
|
|
15
|
+
registry: string;
|
|
13
16
|
}
|
|
14
17
|
export declare function validateLicense(licenseKey: string, imageTag: string): Promise<LicenseValidation | null>;
|
|
15
18
|
export declare function exchangeDownloadToken(token: string): Promise<DownloadResult | null>;
|
|
19
|
+
export declare function buildDockerCommands(result: DownloadResult): {
|
|
20
|
+
login: string;
|
|
21
|
+
pull: string;
|
|
22
|
+
};
|
|
16
23
|
export declare function showLicense(): Promise<{
|
|
17
24
|
key: string;
|
|
18
25
|
imageTag: string;
|
package/dist/modules/license.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
-
import {
|
|
2
|
+
import { success, error, info, section } from './ui.js';
|
|
3
3
|
const SUPABASE_URL = 'https://qnuzhgozszftvvxsnaos.supabase.co';
|
|
4
4
|
const ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFudXpoZ296c3pmdHZ2eHNuYW9zIiwicm9sZSI6ImFub24iLCJpYXQiOjE3ODM0MjEwODMsImV4cCI6MjA5ODk5NzA4M30.q3mgpAS8nm1OtvnlKuOgTEi_vLmb46bV0sf3bS-fSCg';
|
|
5
5
|
const EDGE_FUNCTION = `${SUPABASE_URL}/functions/v1/proxy-package`;
|
|
@@ -51,6 +51,11 @@ export async function exchangeDownloadToken(token) {
|
|
|
51
51
|
return null;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
export function buildDockerCommands(result) {
|
|
55
|
+
const login = `echo ${result.token} | docker login ${result.registry} -u ${result.owner} --password-stdin`;
|
|
56
|
+
const pull = `docker pull ${result.image}`;
|
|
57
|
+
return { login, pull };
|
|
58
|
+
}
|
|
54
59
|
export async function showLicense() {
|
|
55
60
|
section('License');
|
|
56
61
|
console.log(chalk.white(' Enter your PixelStack license key to download the image.'));
|