@explorer02/cfm-survey-sdk 0.0.1 ā 0.0.2
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/const.d.ts +10 -0
- package/dist/cli/const.d.ts.map +1 -0
- package/dist/cli/const.js +13 -0
- package/dist/cli/const.js.map +1 -0
- package/dist/cli/constants.d.ts +9 -0
- package/dist/cli/constants.js +12 -0
- package/dist/cli/deploy.d.ts.map +1 -1
- package/dist/cli/deploy.js +10 -189
- package/dist/cli/deploy.js.map +1 -1
- package/dist/cli/index.js +8 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/exec.d.ts +4 -0
- package/dist/cli/utils/exec.d.ts.map +1 -0
- package/dist/cli/utils/exec.js +41 -0
- package/dist/cli/utils/exec.js.map +1 -0
- package/dist/cli/utils/nodeCheck.d.ts +2 -0
- package/dist/cli/utils/nodeCheck.d.ts.map +1 -0
- package/dist/cli/utils/nodeCheck.js +64 -0
- package/dist/cli/utils/nodeCheck.js.map +1 -0
- package/dist/cli/utils/prompts.d.ts +2 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/prompts.js +29 -0
- package/dist/cli/utils/prompts.js.map +1 -0
- package/dist/cli/utils/vercelCliCheck.d.ts +6 -0
- package/dist/cli/utils/vercelCliCheck.d.ts.map +1 -0
- package/dist/cli/utils/vercelCliCheck.js +38 -0
- package/dist/cli/utils/vercelCliCheck.js.map +1 -0
- package/dist/cli/utils/vercelDeploy.d.ts +2 -0
- package/dist/cli/utils/vercelDeploy.d.ts.map +1 -0
- package/dist/cli/utils/vercelDeploy.js +21 -0
- package/dist/cli/utils/vercelDeploy.js.map +1 -0
- package/dist/cli/utils/vercelLoginCheck.d.ts +2 -0
- package/dist/cli/utils/vercelLoginCheck.d.ts.map +1 -0
- package/dist/cli/utils/vercelLoginCheck.js +42 -0
- package/dist/cli/utils/vercelLoginCheck.js.map +1 -0
- package/package.json +8 -2
- package/postinstall.js +40 -0
- package/templates/AGENT.md +1219 -0
- package/src/analytics/analyticsTracker.ts +0 -48
- package/src/analytics/types.ts +0 -80
- package/src/cli/deploy.ts +0 -205
- package/src/cli/index.ts +0 -33
- package/src/fetchSurvey/internalTypes.ts +0 -80
- package/src/fetchSurvey/logger/fetchLogger.ts +0 -34
- package/src/fetchSurvey/logger/mapperLogger.ts +0 -13
- package/src/fetchSurvey/telemetry/fetchTelemetry.ts +0 -26
- package/src/fetchSurvey/types.ts +0 -82
- package/src/fetchSurvey/useFetchSurvey.ts +0 -126
- package/src/fetchSurvey/utils/constants.ts +0 -11
- package/src/fetchSurvey/utils/extractSurveyLanguages.ts +0 -63
- package/src/fetchSurvey/utils/index.ts +0 -7
- package/src/fetchSurvey/utils/mapSurveyPages.ts +0 -35
- package/src/fetchSurvey/utils/mappers/index.ts +0 -2
- package/src/fetchSurvey/utils/mappers/questionMapper.ts +0 -213
- package/src/fetchSurvey/utils/mappers/surveyMapper.ts +0 -69
- package/src/fetchSurvey/utils/url.ts +0 -21
- package/src/index.ts +0 -6
- package/src/logger/logger.ts +0 -71
- package/src/queryClient.ts +0 -67
- package/src/submitSurvey/logger/resolutionLogger.ts +0 -13
- package/src/submitSurvey/logger/submitLogger.ts +0 -51
- package/src/submitSurvey/telemetry/submitTelemetry.ts +0 -33
- package/src/submitSurvey/types.ts +0 -51
- package/src/submitSurvey/useSubmitResponse.ts +0 -111
- package/src/submitSurvey/utils/constants.ts +0 -4
- package/src/submitSurvey/utils/formatters.ts +0 -33
- package/src/submitSurvey/utils/index.ts +0 -4
- package/src/submitSurvey/utils/url.ts +0 -17
- package/src/submitSurvey/utils/validation.ts +0 -48
- package/src/surveyPagination/actions/index.ts +0 -4
- package/src/surveyPagination/actions/useOnBack.ts +0 -37
- package/src/surveyPagination/actions/useOnChange.ts +0 -16
- package/src/surveyPagination/actions/useOnNext.ts +0 -99
- package/src/surveyPagination/actions/useOnSubmit.ts +0 -137
- package/src/surveyPagination/dispatchers/index.ts +0 -3
- package/src/surveyPagination/dispatchers/useCheckBacktrackChanges.ts +0 -35
- package/src/surveyPagination/dispatchers/useTrackOptionalSkips.ts +0 -21
- package/src/surveyPagination/dispatchers/useTrackPageTime.ts +0 -13
- package/src/surveyPagination/effects/index.ts +0 -2
- package/src/surveyPagination/effects/useResetPageStartTime.ts +0 -10
- package/src/surveyPagination/effects/useTrackMaxVisitedPage.ts +0 -12
- package/src/surveyPagination/logger/navigationLogger.ts +0 -25
- package/src/surveyPagination/logger/validationLogger.ts +0 -17
- package/src/surveyPagination/telemetry/pageTelemetry.ts +0 -22
- package/src/surveyPagination/telemetry/sessionTelemetry.ts +0 -55
- package/src/surveyPagination/types.ts +0 -42
- package/src/surveyPagination/useSurveyPagination.ts +0 -109
- package/src/surveyPagination/utils/index.ts +0 -2
- package/src/surveyPagination/utils/scroll.ts +0 -62
- package/src/surveyPagination/utils/validation.ts +0 -62
- package/src/surveyProgress/useSurveyProgress.ts +0 -42
- package/src/surveyProgress/utils/index.ts +0 -1
- package/src/surveyProgress/utils/progress.ts +0 -61
- package/src/surveySDK/constants.ts +0 -9
- package/src/surveySDK/types.ts +0 -22
- package/src/surveySDK/useSurveySDK.ts +0 -109
- package/tsconfig.json +0 -13
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/cli/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;CAQlB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colors = void 0;
|
|
4
|
+
exports.colors = {
|
|
5
|
+
reset: '\x1b[0m',
|
|
6
|
+
bold: '\x1b[1m',
|
|
7
|
+
green: '\x1b[32m',
|
|
8
|
+
red: '\x1b[31m',
|
|
9
|
+
cyan: '\x1b[36m',
|
|
10
|
+
yellow: '\x1b[33m',
|
|
11
|
+
dim: '\x1b[2m',
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../src/cli/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG;IACpB,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,IAAI,EAAE,UAAU;IAChB,MAAM,EAAE,UAAU;IAClB,GAAG,EAAE,SAAS;CACf,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colors = void 0;
|
|
4
|
+
exports.colors = {
|
|
5
|
+
reset: '\x1b[0m',
|
|
6
|
+
bold: '\x1b[1m',
|
|
7
|
+
green: '\x1b[32m',
|
|
8
|
+
red: '\x1b[31m',
|
|
9
|
+
cyan: '\x1b[36m',
|
|
10
|
+
yellow: '\x1b[33m',
|
|
11
|
+
dim: '\x1b[2m',
|
|
12
|
+
};
|
package/dist/cli/deploy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":"AAOA,wBAAsB,aAAa,kBAclC"}
|
package/dist/cli/deploy.js
CHANGED
|
@@ -1,200 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.runDeployment = runDeployment;
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
bold: '\x1b[1m',
|
|
13
|
-
green: '\x1b[32m',
|
|
14
|
-
red: '\x1b[31m',
|
|
15
|
-
cyan: '\x1b[36m',
|
|
16
|
-
yellow: '\x1b[33m',
|
|
17
|
-
dim: '\x1b[2m',
|
|
18
|
-
};
|
|
19
|
-
// Simple interactive prompt using Node.js built-in readline
|
|
20
|
-
async function askQuestion(query) {
|
|
21
|
-
const rl = promises_1.default.createInterface({ input: process_1.stdin, output: process_1.stdout });
|
|
22
|
-
try {
|
|
23
|
-
return (await rl.question(query)).trim();
|
|
24
|
-
}
|
|
25
|
-
finally {
|
|
26
|
-
rl.close();
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
// Check if a shell executable is available in the user's system PATH
|
|
30
|
-
function hasCommand(cmd) {
|
|
31
|
-
try {
|
|
32
|
-
const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
|
|
33
|
-
(0, child_process_1.execSync)(checkCmd, { stdio: 'ignore' });
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
catch {
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Execute a command synchronously and capture output/return code
|
|
41
|
-
function runCommandSync(cmd, args) {
|
|
42
|
-
try {
|
|
43
|
-
const fullCmd = `${cmd} ${args.join(' ')}`;
|
|
44
|
-
(0, child_process_1.execSync)(fullCmd, { stdio: 'inherit', shell: true });
|
|
45
|
-
return true;
|
|
46
|
-
}
|
|
47
|
-
catch {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// Spawn an interactive command that inherits stdin/stdout/stderr
|
|
52
|
-
function runCommandInteractive(cmd, args) {
|
|
53
|
-
return new Promise((resolve) => {
|
|
54
|
-
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
55
|
-
stdio: 'inherit',
|
|
56
|
-
shell: true,
|
|
57
|
-
});
|
|
58
|
-
child.on('close', (code) => {
|
|
59
|
-
resolve(code);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
4
|
+
const const_1 = require("./const");
|
|
5
|
+
const nodeCheck_1 = require("./utils/nodeCheck");
|
|
6
|
+
const vercelCliCheck_1 = require("./utils/vercelCliCheck");
|
|
7
|
+
const vercelLoginCheck_1 = require("./utils/vercelLoginCheck");
|
|
8
|
+
const vercelDeploy_1 = require("./utils/vercelDeploy");
|
|
63
9
|
// Main deployment wrapper
|
|
64
10
|
async function runDeployment() {
|
|
65
|
-
console.log(`\n${colors.bold}${colors.cyan}š Starting CFM Vercel Deployment...${colors.reset}\n`);
|
|
11
|
+
console.log(`\n${const_1.colors.bold}${const_1.colors.cyan}š Starting CFM Vercel Deployment...${const_1.colors.reset}\n`);
|
|
66
12
|
// --- STEP 1: NODE.JS VERSION CHECK & AUTOMATED UPGRADE ---
|
|
67
|
-
|
|
68
|
-
console.log(`${colors.dim}Step 1/4: Checking Node.js version (current: ${process.version})...${colors.reset}`);
|
|
69
|
-
if (majorVersion < 18) {
|
|
70
|
-
console.log(`ā ļø ${colors.yellow}Outdated Node.js version detected. v18.0.0 or higher is required.${colors.reset}`);
|
|
71
|
-
const isWin = process.platform === 'win32';
|
|
72
|
-
const isMac = process.platform === 'darwin';
|
|
73
|
-
if (isWin) {
|
|
74
|
-
if (hasCommand('winget')) {
|
|
75
|
-
console.log(`\nš¦ ${colors.green}winget package manager found! Installing Node.js v18+ in background...${colors.reset}`);
|
|
76
|
-
const success = runCommandSync('winget', ['upgrade', 'OpenJS.NodeJS', '--silent', '--accept-package-agreements', '--accept-source-agreements']);
|
|
77
|
-
if (success) {
|
|
78
|
-
console.log(`\nā ${colors.green}Node.js installation triggered successfully. Please restart your terminal/command-prompt for changes to take effect.${colors.reset}\n`);
|
|
79
|
-
process.exit(0);
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
console.log(`\nā ${colors.red}winget update failed. Please update Node.js manually at https://nodejs.org/${colors.reset}\n`);
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
console.log(`\nā ${colors.red}winget package manager is not installed on this system.${colors.reset}`);
|
|
88
|
-
console.log(`${colors.bold}š To proceed, please either:${colors.reset}`);
|
|
89
|
-
console.log(` 1. Install winget (App Installer) from the Microsoft Store.`);
|
|
90
|
-
console.log(` 2. Or manually download and install Node.js (v18+) from: https://nodejs.org/\n`);
|
|
91
|
-
process.exit(1);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else if (isMac) {
|
|
95
|
-
if (hasCommand('brew')) {
|
|
96
|
-
console.log(`\nš¦ ${colors.green}Homebrew package manager found! Installing Node.js v18+ in background...${colors.reset}`);
|
|
97
|
-
const success = runCommandSync('brew', ['install', 'node']);
|
|
98
|
-
if (success) {
|
|
99
|
-
console.log(`\nā ${colors.green}Node.js installed successfully via Homebrew.${colors.reset}\n`);
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
console.log(`\nā ${colors.red}Homebrew installation failed. Please install Node.js manually at https://nodejs.org/${colors.reset}\n`);
|
|
103
|
-
process.exit(1);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
console.log(`\nā ${colors.red}Homebrew package manager (brew) is not installed on this system.${colors.reset}`);
|
|
108
|
-
console.log(`${colors.bold}š To proceed, please either:${colors.reset}`);
|
|
109
|
-
console.log(` 1. Install Homebrew by running the following command in your terminal:`);
|
|
110
|
-
console.log(` ${colors.cyan}/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"${colors.reset}`);
|
|
111
|
-
console.log(` 2. Or manually download and install Node.js (v18+) from: https://nodejs.org/\n`);
|
|
112
|
-
process.exit(1);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
else {
|
|
116
|
-
console.log(`\nā ${colors.red}Please install or update Node.js to v18+ using your system's package manager.${colors.reset}\n`);
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
console.log(`ā ${colors.green}Node.js version (v${majorVersion}) is sufficient.${colors.reset}`);
|
|
122
|
-
}
|
|
13
|
+
(0, nodeCheck_1.checkNodeVersion)();
|
|
123
14
|
// --- STEP 2: VERCEL CLI VERIFICATION ---
|
|
124
|
-
|
|
125
|
-
let vercelCmd = 'vercel';
|
|
126
|
-
let useNpx = false;
|
|
127
|
-
if (!hasCommand('vercel')) {
|
|
128
|
-
console.log(`ā ${colors.yellow}Vercel CLI was not found on your system.${colors.reset}`);
|
|
129
|
-
const answer = await askQuestion(`š Would you like to install Vercel CLI globally? (Y/n): `);
|
|
130
|
-
if (answer.toLowerCase() === 'y' || answer === '') {
|
|
131
|
-
console.log(`\nš„ ${colors.cyan}Installing Vercel CLI globally... (npm install -g vercel)${colors.reset}`);
|
|
132
|
-
const success = runCommandSync('npm', ['install', '-g', 'vercel']);
|
|
133
|
-
if (success && hasCommand('vercel')) {
|
|
134
|
-
console.log(`ā ${colors.green}Vercel CLI installed successfully!${colors.reset}`);
|
|
135
|
-
}
|
|
136
|
-
else {
|
|
137
|
-
console.log(`\nā ļø ${colors.yellow}Global installation failed or permissions restricted.${colors.reset}`);
|
|
138
|
-
console.log(`ā¹ ${colors.dim}Falling back: Running Vercel dynamically via npx.${colors.reset}`);
|
|
139
|
-
vercelCmd = 'npx --yes vercel';
|
|
140
|
-
useNpx = true;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
console.log(`ā¹ ${colors.dim}Skipping global installation. Running Vercel dynamically via npx.${colors.reset}`);
|
|
145
|
-
vercelCmd = 'npx --yes vercel';
|
|
146
|
-
useNpx = true;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
console.log(`ā ${colors.green}Vercel CLI is installed!${colors.reset}`);
|
|
151
|
-
}
|
|
15
|
+
const { vercelCmd, useNpx } = await (0, vercelCliCheck_1.checkVercelCli)();
|
|
152
16
|
// --- STEP 3: VERCEL LOGIN CHECK ---
|
|
153
|
-
|
|
154
|
-
// Use VERCEL_TOKEN if available
|
|
155
|
-
const hasToken = !!process.env.VERCEL_TOKEN;
|
|
156
|
-
let loggedIn = false;
|
|
157
|
-
if (hasToken) {
|
|
158
|
-
console.log(`ā ${colors.green}VERCEL_TOKEN environment variable detected. Skipping login check.${colors.reset}`);
|
|
159
|
-
loggedIn = true;
|
|
160
|
-
}
|
|
161
|
-
else {
|
|
162
|
-
try {
|
|
163
|
-
// Execute vercel whoami to check active session
|
|
164
|
-
const checkCmd = useNpx ? 'npx --yes vercel whoami' : 'vercel whoami';
|
|
165
|
-
(0, child_process_1.execSync)(checkCmd, { stdio: 'ignore', shell: true });
|
|
166
|
-
loggedIn = true;
|
|
167
|
-
console.log(`ā ${colors.green}Logged in!${colors.reset}`);
|
|
168
|
-
}
|
|
169
|
-
catch {
|
|
170
|
-
loggedIn = false;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (!loggedIn) {
|
|
174
|
-
console.log(`š ${colors.yellow}Not logged in to Vercel.${colors.reset}`);
|
|
175
|
-
await askQuestion(`š Press [Enter] to login to Vercel... `);
|
|
176
|
-
const loginArgs = ['login'];
|
|
177
|
-
const loginCmd = useNpx ? 'npx' : 'vercel';
|
|
178
|
-
const finalArgs = useNpx ? ['--yes', 'vercel', ...loginArgs] : loginArgs;
|
|
179
|
-
const exitCode = await runCommandInteractive(loginCmd, finalArgs);
|
|
180
|
-
if (exitCode !== 0) {
|
|
181
|
-
throw new Error('Vercel login failed or was aborted.');
|
|
182
|
-
}
|
|
183
|
-
console.log(`\nā ${colors.green}Logged in successfully!${colors.reset}`);
|
|
184
|
-
}
|
|
17
|
+
const hasToken = await (0, vercelLoginCheck_1.checkVercelLogin)(useNpx);
|
|
185
18
|
// --- STEP 4: PRODUCTION DEPLOYMENT ---
|
|
186
|
-
|
|
187
|
-
const deployArgs = ['--prod', '--yes'];
|
|
188
|
-
if (hasToken) {
|
|
189
|
-
deployArgs.push('--token', process.env.VERCEL_TOKEN);
|
|
190
|
-
}
|
|
191
|
-
const deployCmd = useNpx ? 'npx' : 'vercel';
|
|
192
|
-
const finalDeployArgs = useNpx ? ['--yes', 'vercel', ...deployArgs] : deployArgs;
|
|
193
|
-
console.log(`${colors.cyan}ā” Running deployment in: ${process.cwd()}${colors.reset}\n`);
|
|
194
|
-
const deployExitCode = await runCommandInteractive(deployCmd, finalDeployArgs);
|
|
195
|
-
if (deployExitCode !== 0) {
|
|
196
|
-
throw new Error('Vercel deployment failed.');
|
|
197
|
-
}
|
|
198
|
-
console.log(`\n${colors.bold}${colors.green}š Deployment completed successfully!${colors.reset}\n`);
|
|
19
|
+
await (0, vercelDeploy_1.runVercelDeploy)(useNpx, hasToken);
|
|
199
20
|
}
|
|
200
21
|
//# sourceMappingURL=deploy.js.map
|
package/dist/cli/deploy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deploy.js","sourceRoot":"","sources":["../../src/cli/deploy.ts"],"names":[],"mappings":";;AAOA,sCAcC;AArBD,mCAAiC;AACjC,iDAAqD;AACrD,2DAAwD;AACxD,+DAA4D;AAC5D,uDAAuD;AAEvD,0BAA0B;AACnB,KAAK,UAAU,aAAa;IACjC,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,IAAI,GAAG,cAAM,CAAC,IAAI,uCAAuC,cAAM,CAAC,KAAK,IAAI,CAAC,CAAC;IAEnG,4DAA4D;IAC5D,IAAA,4BAAgB,GAAE,CAAC;IAEnB,0CAA0C;IAC1C,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,IAAA,+BAAc,GAAE,CAAC;IAErD,qCAAqC;IACrC,MAAM,QAAQ,GAAG,MAAM,IAAA,mCAAgB,EAAC,MAAM,CAAC,CAAC;IAEhD,wCAAwC;IACxC,MAAM,IAAA,8BAAe,EAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAC1C,CAAC"}
|
package/dist/cli/index.js
CHANGED
|
@@ -2,28 +2,26 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const deploy_1 = require("./deploy");
|
|
5
|
+
const const_1 = require("./const");
|
|
5
6
|
const args = process.argv.slice(2);
|
|
6
7
|
const command = args[0];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cyan: '\x1b[36m',
|
|
13
|
-
yellow: '\x1b[33m',
|
|
14
|
-
};
|
|
8
|
+
// When a user types a command like npx cfm-sdk deploy,
|
|
9
|
+
// Node receives the arguments as an array inside process.argv:
|
|
10
|
+
// ['/usr/bin/node', 'dist/cli/index.js', 'deploy']
|
|
11
|
+
// .slice(2) chops off the first two system paths, leaving only the user's custom commands: ['deploy'].
|
|
12
|
+
// args[0] picks the first command, which in this case is "deploy".
|
|
15
13
|
async function main() {
|
|
16
14
|
if (command === 'deploy') {
|
|
17
15
|
try {
|
|
18
16
|
await (0, deploy_1.runDeployment)();
|
|
19
17
|
}
|
|
20
18
|
catch (error) {
|
|
21
|
-
console.error(`\n${colors.red}ā Error: ${error.message || error}${colors.reset}`);
|
|
19
|
+
console.error(`\n${const_1.colors.red}ā Error: ${error.message || error}${const_1.colors.reset}`);
|
|
22
20
|
process.exit(1);
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
else {
|
|
26
|
-
console.log(`\n${colors.bold}${colors.cyan}CFM SDK CLI Tool${colors.reset}`);
|
|
24
|
+
console.log(`\n${const_1.colors.bold}${const_1.colors.cyan}CFM SDK CLI Tool${const_1.colors.reset}`);
|
|
27
25
|
console.log(`\nUsage:`);
|
|
28
26
|
console.log(` npx cfm-sdk deploy - Deploy the current project to Vercel`);
|
|
29
27
|
process.exit(0);
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAEA,qCAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;AAEA,qCAAyC;AACzC,mCAAiC;AAEjC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AACxB,wDAAwD;AACxD,gEAAgE;AAChE,mDAAmD;AACnD,uGAAuG;AACvG,mEAAmE;AAEnE,KAAK,UAAU,IAAI;IACjB,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC;YACH,MAAM,IAAA,sBAAa,GAAE,CAAC;QACxB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,KAAK,cAAM,CAAC,GAAG,YAAY,KAAK,CAAC,OAAO,IAAI,KAAK,GAAG,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YAClF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,IAAI,GAAG,cAAM,CAAC,IAAI,mBAAmB,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QAC7E,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACxB,OAAO,CAAC,GAAG,CAAC,+DAA+D,CAAC,CAAC;QAC7E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function hasCommand(cmd: string): boolean;
|
|
2
|
+
export declare function runCommandSync(cmd: string, args: string[]): boolean;
|
|
3
|
+
export declare function runCommandInteractive(cmd: string, args: string[]): Promise<number | null>;
|
|
4
|
+
//# sourceMappingURL=exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/exec.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQ/C;AAGD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAQnE;AAGD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWzF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasCommand = hasCommand;
|
|
4
|
+
exports.runCommandSync = runCommandSync;
|
|
5
|
+
exports.runCommandInteractive = runCommandInteractive;
|
|
6
|
+
const child_process_1 = require("child_process");
|
|
7
|
+
// Check if a shell executable is available in the user's system PATH
|
|
8
|
+
function hasCommand(cmd) {
|
|
9
|
+
try {
|
|
10
|
+
const checkCmd = process.platform === 'win32' ? `where ${cmd}` : `command -v ${cmd}`;
|
|
11
|
+
(0, child_process_1.execSync)(checkCmd, { stdio: 'ignore' });
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// Execute a command synchronously and capture output/return code
|
|
19
|
+
function runCommandSync(cmd, args) {
|
|
20
|
+
try {
|
|
21
|
+
const fullCmd = `${cmd} ${args.join(' ')}`;
|
|
22
|
+
(0, child_process_1.execSync)(fullCmd, { stdio: 'inherit', shell: true });
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Spawn an interactive command that inherits stdin/stdout/stderr
|
|
30
|
+
function runCommandInteractive(cmd, args) {
|
|
31
|
+
return new Promise((resolve) => {
|
|
32
|
+
const child = (0, child_process_1.spawn)(cmd, args, {
|
|
33
|
+
stdio: 'inherit',
|
|
34
|
+
shell: true,
|
|
35
|
+
});
|
|
36
|
+
child.on('close', (code) => {
|
|
37
|
+
resolve(code);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../../../src/cli/utils/exec.ts"],"names":[],"mappings":";;AAGA,gCAQC;AAGD,wCAQC;AAGD,sDAWC;AApCD,iDAAgD;AAEhD,qEAAqE;AACrE,SAAgB,UAAU,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,CAAC,CAAC,cAAc,GAAG,EAAE,CAAC;QACrF,IAAA,wBAAQ,EAAC,QAAQ,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,SAAgB,cAAc,CAAC,GAAW,EAAE,IAAc;IACxD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QAC3C,IAAA,wBAAQ,EAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAS,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,SAAgB,qBAAqB,CAAC,GAAW,EAAE,IAAc;IAC/D,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,IAAA,qBAAK,EAAC,GAAG,EAAE,IAAI,EAAE;YAC7B,KAAK,EAAE,SAAS;YAChB,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC;QAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACzB,OAAO,CAAC,IAAI,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeCheck.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/nodeCheck.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,IAAI,IAAI,CAqDvC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkNodeVersion = checkNodeVersion;
|
|
4
|
+
const const_1 = require("../const");
|
|
5
|
+
const exec_1 = require("./exec");
|
|
6
|
+
function checkNodeVersion() {
|
|
7
|
+
const majorVersion = parseInt(process.version.slice(1).split('.')[0], 10);
|
|
8
|
+
console.log(`${const_1.colors.dim}Step 1/4: Checking Node.js version (current: ${process.version})...${const_1.colors.reset}`);
|
|
9
|
+
if (majorVersion < 18) {
|
|
10
|
+
console.log(`ā ļø ${const_1.colors.yellow}Outdated Node.js version detected. v18.0.0 or higher is required.${const_1.colors.reset}`);
|
|
11
|
+
const isWin = process.platform === 'win32';
|
|
12
|
+
const isMac = process.platform === 'darwin';
|
|
13
|
+
if (isWin) {
|
|
14
|
+
if ((0, exec_1.hasCommand)('winget')) {
|
|
15
|
+
console.log(`\nš¦ ${const_1.colors.green}winget package manager found! Installing Node.js v18+ in background...${const_1.colors.reset}`);
|
|
16
|
+
const success = (0, exec_1.runCommandSync)('winget', ['upgrade', 'OpenJS.NodeJS', '--silent', '--accept-package-agreements', '--accept-source-agreements']);
|
|
17
|
+
if (success) {
|
|
18
|
+
console.log(`\nā ${const_1.colors.green}Node.js installation triggered successfully. Please restart your terminal/command-prompt for changes to take effect.${const_1.colors.reset}\n`);
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
console.log(`\nā ${const_1.colors.red}winget update failed. Please update Node.js manually at https://nodejs.org/${const_1.colors.reset}\n`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
console.log(`\nā ${const_1.colors.red}winget package manager is not installed on this system.${const_1.colors.reset}`);
|
|
28
|
+
console.log(`${const_1.colors.bold}š To proceed, please either:${const_1.colors.reset}`);
|
|
29
|
+
console.log(` 1. Install winget (App Installer) from the Microsoft Store.`);
|
|
30
|
+
console.log(` 2. Or manually download and install Node.js (v18+) from: https://nodejs.org/\n`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (isMac) {
|
|
35
|
+
if ((0, exec_1.hasCommand)('brew')) {
|
|
36
|
+
console.log(`\nš¦ ${const_1.colors.green}Homebrew package manager found! Installing Node.js v18+ in background...${const_1.colors.reset}`);
|
|
37
|
+
const success = (0, exec_1.runCommandSync)('brew', ['install', 'node']);
|
|
38
|
+
if (success) {
|
|
39
|
+
console.log(`\nā ${const_1.colors.green}Node.js installed successfully via Homebrew.${const_1.colors.reset}\n`);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
console.log(`\nā ${const_1.colors.red}Homebrew installation failed. Please install Node.js manually at https://nodejs.org/${const_1.colors.reset}\n`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log(`\nā ${const_1.colors.red}Homebrew package manager (brew) is not installed on this system.${const_1.colors.reset}`);
|
|
48
|
+
console.log(`${const_1.colors.bold}š To proceed, please either:${const_1.colors.reset}`);
|
|
49
|
+
console.log(` 1. Install Homebrew by running the following command in your terminal:`);
|
|
50
|
+
console.log(` ${const_1.colors.cyan}/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"${const_1.colors.reset}`);
|
|
51
|
+
console.log(` 2. Or manually download and install Node.js (v18+) from: https://nodejs.org/\n`);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
console.log(`\nā ${const_1.colors.red}Please install or update Node.js to v18+ using your system's package manager.${const_1.colors.reset}\n`);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.log(`ā ${const_1.colors.green}Node.js version (v${majorVersion}) is sufficient.${const_1.colors.reset}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=nodeCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeCheck.js","sourceRoot":"","sources":["../../../src/cli/utils/nodeCheck.ts"],"names":[],"mappings":";;AAGA,4CAqDC;AAxDD,oCAAkC;AAClC,iCAAoD;AAEpD,SAAgB,gBAAgB;IAC9B,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,GAAG,cAAM,CAAC,GAAG,gDAAgD,OAAO,CAAC,OAAO,OAAO,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAE/G,IAAI,YAAY,GAAG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ACN,OAAO,CAAC,GAAG,CAAC,OAAO,cAAM,CAAC,GAAG,gFAAgF,cAAM,CAAC,KAAK,IAAI,CAAC,CAAC;YAC/H,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,KAAK,qBAAqB,YAAY,mBAAmB,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IACnG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/prompts.ts"],"names":[],"mappings":"AAGA,wBAAsB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOhE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.askQuestion = askQuestion;
|
|
7
|
+
const promises_1 = __importDefault(require("readline/promises"));
|
|
8
|
+
const process_1 = require("process");
|
|
9
|
+
async function askQuestion(query) {
|
|
10
|
+
const rl = promises_1.default.createInterface({ input: process_1.stdin, output: process_1.stdout });
|
|
11
|
+
try {
|
|
12
|
+
return (await rl.question(query)).trim();
|
|
13
|
+
}
|
|
14
|
+
finally {
|
|
15
|
+
rl.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// rl.question(query): Prints the question (query) to the screen and waits.
|
|
19
|
+
// await: Pauses the program right here.
|
|
20
|
+
// The execution is frozen until the user types their answer and hits the [Enter] key.
|
|
21
|
+
// .trim(): Removes any accidental whitespace (spaces or tabs)
|
|
22
|
+
// from the beginning or end of the user's input (e.g., " yes " becomes "yes").
|
|
23
|
+
// rl.close() (Crucial Step):
|
|
24
|
+
// Closes the keyboard read stream and frees up system resources.
|
|
25
|
+
// Why it's in finally: If you do not close readline,
|
|
26
|
+
// Node.js will think you still want to listen to the keyboard,
|
|
27
|
+
// and the terminal process will freeze/hang forever even after your script finishes.
|
|
28
|
+
// Placing it in finally guarantees it closes even if an error occurs.
|
|
29
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/cli/utils/prompts.ts"],"names":[],"mappings":";;;;;AAGA,kCAOC;AAVD,iEAAyC;AACzC,qCAA2D;AAEpD,KAAK,UAAU,WAAW,CAAC,KAAa;IAC7C,MAAM,EAAE,GAAG,kBAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,EAAL,eAAK,EAAE,MAAM,EAAN,gBAAM,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3C,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AACD,2EAA2E;AAC3E,yCAAyC;AACzC,sFAAsF;AACtF,+DAA+D;AAC/D,iFAAiF;AACjF,6BAA6B;AAC7B,iEAAiE;AACjE,qDAAqD;AACrD,gEAAgE;AAChE,sFAAsF;AACtF,sEAAsE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercelCliCheck.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/vercelCliCheck.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAA;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAgChE"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.checkVercelCli = checkVercelCli;
|
|
4
|
+
const const_1 = require("../const");
|
|
5
|
+
const prompts_1 = require("./prompts");
|
|
6
|
+
const exec_1 = require("./exec");
|
|
7
|
+
async function checkVercelCli() {
|
|
8
|
+
console.log(`\n${const_1.colors.dim}Step 2/4: Checking Vercel CLI...${const_1.colors.reset}`);
|
|
9
|
+
let vercelCmd = 'vercel';
|
|
10
|
+
let useNpx = false;
|
|
11
|
+
if (!(0, exec_1.hasCommand)('vercel')) {
|
|
12
|
+
console.log(`ā ${const_1.colors.yellow}Vercel CLI was not found on your system.${const_1.colors.reset}`);
|
|
13
|
+
const answer = await (0, prompts_1.askQuestion)(`š Would you like to install Vercel CLI globally? (Y/n): `);
|
|
14
|
+
if (answer.toLowerCase() === 'y' || answer === '') {
|
|
15
|
+
console.log(`\nš„ ${const_1.colors.cyan}Installing Vercel CLI globally... (npm install -g vercel)${const_1.colors.reset}`);
|
|
16
|
+
const success = (0, exec_1.runCommandSync)('npm', ['install', '-g', 'vercel']);
|
|
17
|
+
if (success && (0, exec_1.hasCommand)('vercel')) {
|
|
18
|
+
console.log(`ā ${const_1.colors.green}Vercel CLI installed successfully!${const_1.colors.reset}`);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.log(`\nā ļø ${const_1.colors.yellow}Global installation failed or permissions restricted.${const_1.colors.reset}`);
|
|
22
|
+
console.log(`ā¹ ${const_1.colors.dim}Falling back: Running Vercel dynamically via npx.${const_1.colors.reset}`);
|
|
23
|
+
vercelCmd = 'npx --yes vercel';
|
|
24
|
+
useNpx = true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
console.log(`ā¹ ${const_1.colors.dim}Skipping global installation. Running Vercel dynamically via npx.${const_1.colors.reset}`);
|
|
29
|
+
vercelCmd = 'npx --yes vercel';
|
|
30
|
+
useNpx = true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
console.log(`ā ${const_1.colors.green}Vercel CLI is installed!${const_1.colors.reset}`);
|
|
35
|
+
}
|
|
36
|
+
return { vercelCmd, useNpx };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=vercelCliCheck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercelCliCheck.js","sourceRoot":"","sources":["../../../src/cli/utils/vercelCliCheck.ts"],"names":[],"mappings":";;AASA,wCAgCC;AAzCD,oCAAkC;AAClC,uCAAwC;AACxC,iCAAoD;AAO7C,KAAK,UAAU,cAAc;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,GAAG,mCAAmC,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9E,IAAI,SAAS,GAAG,QAAQ,CAAC;IACzB,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,IAAI,CAAC,IAAA,iBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,MAAM,2CAA2C,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;QACzF,MAAM,MAAM,GAAG,MAAM,IAAA,qBAAW,EAAC,2DAA2D,CAAC,CAAC;QAE9F,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;YAClD,OAAO,CAAC,GAAG,CAAC,QAAQ,cAAM,CAAC,IAAI,4DAA4D,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YAC3G,MAAM,OAAO,GAAG,IAAA,qBAAc,EAAC,KAAK,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;YACnE,IAAI,OAAO,IAAI,IAAA,iBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;gBACpC,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,KAAK,qCAAqC,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YACpF,CAAC;iBACI,CAAC;gBACJ,OAAO,CAAC,GAAG,CAAC,SAAS,cAAM,CAAC,MAAM,wDAAwD,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;gBAC1G,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,GAAG,oDAAoD,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;gBAC/F,SAAS,GAAG,kBAAkB,CAAC;gBAC/B,MAAM,GAAG,IAAI,CAAC;YAChB,CAAC;QACH,CAAC;aACI,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,GAAG,oEAAoE,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;YAC/G,SAAS,GAAG,kBAAkB,CAAC;YAC/B,MAAM,GAAG,IAAI,CAAC;QAChB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,KAAK,2BAA2B,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercelDeploy.d.ts","sourceRoot":"","sources":["../../../src/cli/utils/vercelDeploy.ts"],"names":[],"mappings":"AAGA,wBAAsB,eAAe,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAmBvF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runVercelDeploy = runVercelDeploy;
|
|
4
|
+
const const_1 = require("../const");
|
|
5
|
+
const exec_1 = require("./exec");
|
|
6
|
+
async function runVercelDeploy(useNpx, hasToken) {
|
|
7
|
+
console.log(`\n${const_1.colors.dim}Step 4/4: Deploying project to production...${const_1.colors.reset}`);
|
|
8
|
+
const deployArgs = ['--prod', '--yes'];
|
|
9
|
+
if (hasToken) {
|
|
10
|
+
deployArgs.push('--token', process.env.VERCEL_TOKEN);
|
|
11
|
+
}
|
|
12
|
+
const deployCmd = useNpx ? 'npx' : 'vercel';
|
|
13
|
+
const finalDeployArgs = useNpx ? ['--yes', 'vercel', ...deployArgs] : deployArgs;
|
|
14
|
+
console.log(`${const_1.colors.cyan}ā” Running deployment in: ${process.cwd()}${const_1.colors.reset}\n`);
|
|
15
|
+
const deployExitCode = await (0, exec_1.runCommandInteractive)(deployCmd, finalDeployArgs);
|
|
16
|
+
if (deployExitCode !== 0) {
|
|
17
|
+
throw new Error('Vercel deployment failed.');
|
|
18
|
+
}
|
|
19
|
+
console.log(`\n${const_1.colors.bold}${const_1.colors.green}š Deployment completed successfully!${const_1.colors.reset}\n`);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=vercelDeploy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vercelDeploy.js","sourceRoot":"","sources":["../../../src/cli/utils/vercelDeploy.ts"],"names":[],"mappings":";;AAGA,0CAmBC;AAtBD,oCAAkC;AAClC,iCAA+C;AAExC,KAAK,UAAU,eAAe,CAAC,MAAe,EAAE,QAAiB;IACtE,OAAO,CAAC,GAAG,CAAC,KAAK,cAAM,CAAC,GAAG,+CAA+C,cAAM,CAAC,KAAK,EAAE,CAAC,CAAC;IAE1F,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACvC,IAAI,QAAQ,EAAE,CAAC;QACb,UAAU,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,YAAa,CAAC,CAAC;IACxD,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC5C,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC,CAAC,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