@explorer02/cfm-survey-sdk 0.0.1 → 0.0.3
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 +24 -0
- package/dist/cli/const.d.ts.map +1 -0
- package/dist/cli/const.js +31 -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 +19 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +405 -0
- package/dist/cli/init.js.map +1 -0
- 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 +45 -0
- package/templates/AGENT.md +1281 -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,24 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
reset: string;
|
|
3
|
+
bold: string;
|
|
4
|
+
dim: string;
|
|
5
|
+
italic: string;
|
|
6
|
+
underline: string;
|
|
7
|
+
black: string;
|
|
8
|
+
red: string;
|
|
9
|
+
green: string;
|
|
10
|
+
yellow: string;
|
|
11
|
+
blue: string;
|
|
12
|
+
magenta: string;
|
|
13
|
+
cyan: string;
|
|
14
|
+
white: string;
|
|
15
|
+
bgBlack: string;
|
|
16
|
+
bgRed: string;
|
|
17
|
+
bgGreen: string;
|
|
18
|
+
bgYellow: string;
|
|
19
|
+
bgBlue: string;
|
|
20
|
+
bgMagenta: string;
|
|
21
|
+
bgCyan: string;
|
|
22
|
+
bgWhite: string;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.d.ts","sourceRoot":"","sources":["../../src/cli/const.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;CA0BlB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.colors = void 0;
|
|
4
|
+
exports.colors = {
|
|
5
|
+
// Reset
|
|
6
|
+
reset: '\x1b[0m',
|
|
7
|
+
// Styles
|
|
8
|
+
bold: '\x1b[1m',
|
|
9
|
+
dim: '\x1b[2m',
|
|
10
|
+
italic: '\x1b[3m',
|
|
11
|
+
underline: '\x1b[4m',
|
|
12
|
+
// Foreground colors
|
|
13
|
+
black: '\x1b[30m',
|
|
14
|
+
red: '\x1b[31m',
|
|
15
|
+
green: '\x1b[32m',
|
|
16
|
+
yellow: '\x1b[33m',
|
|
17
|
+
blue: '\x1b[34m',
|
|
18
|
+
magenta: '\x1b[35m',
|
|
19
|
+
cyan: '\x1b[36m',
|
|
20
|
+
white: '\x1b[37m',
|
|
21
|
+
// Background colors
|
|
22
|
+
bgBlack: '\x1b[40m',
|
|
23
|
+
bgRed: '\x1b[41m',
|
|
24
|
+
bgGreen: '\x1b[42m',
|
|
25
|
+
bgYellow: '\x1b[43m',
|
|
26
|
+
bgBlue: '\x1b[44m',
|
|
27
|
+
bgMagenta: '\x1b[45m',
|
|
28
|
+
bgCyan: '\x1b[46m',
|
|
29
|
+
bgWhite: '\x1b[47m',
|
|
30
|
+
};
|
|
31
|
+
//# 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,QAAQ;IACR,KAAK,EAAE,SAAS;IAChB,SAAS;IACT,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,SAAS;IACpB,oBAAoB;IACpB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IACjB,oBAAoB;IACpB,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;CACpB,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,29 +2,38 @@
|
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
const deploy_1 = require("./deploy");
|
|
5
|
+
const init_1 = require("./init");
|
|
6
|
+
const const_1 = require("./const");
|
|
5
7
|
const args = process.argv.slice(2);
|
|
6
8
|
const command = args[0];
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
cyan: '\x1b[36m',
|
|
13
|
-
yellow: '\x1b[33m',
|
|
14
|
-
};
|
|
9
|
+
// When a user types a command like npx cfm-sdk deploy,
|
|
10
|
+
// Node receives the arguments as an array inside process.argv:
|
|
11
|
+
// ['/usr/bin/node', 'dist/cli/index.js', 'deploy']
|
|
12
|
+
// .slice(2) chops off the first two system paths, leaving only the user's custom commands: ['deploy'].
|
|
13
|
+
// args[0] picks the first command, which in this case is "deploy".
|
|
15
14
|
async function main() {
|
|
16
15
|
if (command === 'deploy') {
|
|
17
16
|
try {
|
|
18
17
|
await (0, deploy_1.runDeployment)();
|
|
19
18
|
}
|
|
20
19
|
catch (error) {
|
|
21
|
-
console.error(`\n${colors.red}❌ Error: ${error.message || error}${colors.reset}`);
|
|
20
|
+
console.error(`\n${const_1.colors.red}❌ Error: ${error.message || error}${const_1.colors.reset}`);
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
else if (command === 'init') {
|
|
25
|
+
try {
|
|
26
|
+
await (0, init_1.runInit)();
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
console.error(`\n${const_1.colors.red}❌ Error: ${error.message || error}${const_1.colors.reset}`);
|
|
22
30
|
process.exit(1);
|
|
23
31
|
}
|
|
24
32
|
}
|
|
25
33
|
else {
|
|
26
|
-
console.log(`\n${colors.bold}${colors.cyan}CFM SDK CLI Tool${colors.reset}`);
|
|
34
|
+
console.log(`\n${const_1.colors.bold}${const_1.colors.cyan}CFM SDK CLI Tool${const_1.colors.reset}`);
|
|
27
35
|
console.log(`\nUsage:`);
|
|
36
|
+
console.log(` npx cfm-sdk init - Interactively configure survey theme/settings`);
|
|
28
37
|
console.log(` npx cfm-sdk deploy - Deploy the current project to Vercel`);
|
|
29
38
|
process.exit(0);
|
|
30
39
|
}
|
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,iCAAiC;AACjC,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,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,MAAM,IAAA,cAAO,GAAE,CAAC;QAClB,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,wEAAwE,CAAC,CAAC;QACtF,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 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/cli/init.ts"],"names":[],"mappings":"AAiMA,wBAAsB,OAAO,kBAiQ5B"}
|