at-builder 1.4.4 → 1.5.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/README.md +38 -0
- package/bin/constants/config.js +1 -1
- package/bin/index.js +153 -66
- package/bin/services/telemetry.js +320 -0
- package/package.json +12 -1
- package/.claude/settings.local.json +0 -77
- package/.plop/index.js +0 -5
- package/.vscode/settings.json +0 -6
- package/CustomWrapperPlugin.js +0 -61
- package/DEVELOPMENT.md +0 -164
- package/at-builder-0.0.2.vsix +0 -0
- package/package/package.json +0 -86
- package/src/constants/config.ts +0 -321
- package/src/index.ts +0 -387
- package/src/services/doctor.ts +0 -724
- package/src/services/logger.ts +0 -84
package/README.md
CHANGED
|
@@ -270,6 +270,44 @@ console.log(getHelpInfo());
|
|
|
270
270
|
|
|
271
271
|
---
|
|
272
272
|
|
|
273
|
+
## **🔒 Telemetry & Privacy**
|
|
274
|
+
|
|
275
|
+
`atb` sends anonymous usage telemetry to help improve the tool. The following is collected on each command invocation:
|
|
276
|
+
|
|
277
|
+
- **User**: git `user.email`, git `user.name`, OS username (read from your local environment)
|
|
278
|
+
- **Project**: project folder name, absolute project path, `ADOBE_TENANT` (if set)
|
|
279
|
+
- **Command**: command name and sanitized arguments (values for any arg containing `secret` / `token` / `key` / `password` are redacted)
|
|
280
|
+
- **Execution**: status (`started` / `success` / `failed`), duration, error message
|
|
281
|
+
- **System**: platform, Node.js version, CLI version
|
|
282
|
+
- **Identifier**: a persistent random `clientId` stored at `~/.atb-builder/client_id`
|
|
283
|
+
|
|
284
|
+
Events are appended to a local log at `~/.atb-builder/telemetry.jsonl` and sent to Google Analytics 4. Every event has a 500–800 ms timeout, so telemetry never blocks CLI execution.
|
|
285
|
+
|
|
286
|
+
### How to disable
|
|
287
|
+
|
|
288
|
+
Set either of these to `false`:
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
# In your project .env
|
|
292
|
+
TELEMETRY_ENABLED=false
|
|
293
|
+
|
|
294
|
+
# Or as a shell environment variable
|
|
295
|
+
export TELEMETRY_ENABLED=false
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Redirect to your own endpoint
|
|
299
|
+
|
|
300
|
+
To collect telemetry to your own server instead of (or in addition to) the default GA4 destination:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
TELEMETRY_URL="https://your-endpoint.example.com/events"
|
|
304
|
+
TELEMETRY_USER="custom-user-id" # override the identifier
|
|
305
|
+
GA_MEASUREMENT_ID="G-XXXXXXX" # override GA4 destination
|
|
306
|
+
GA_API_SECRET="your-api-secret"
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
273
311
|
## **📄 License**
|
|
274
312
|
|
|
275
313
|
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
package/bin/constants/config.js
CHANGED
|
@@ -119,7 +119,7 @@ var setupEnv = function (basePath) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
119
119
|
envPath = path_1.default.join(basePath, '.env');
|
|
120
120
|
// Check if the .env file exists
|
|
121
121
|
if (!fs_1.default.existsSync(envPath)) {
|
|
122
|
-
envContent = "\nACTIVITIES_BASE_FOLDER=\"Activities\"\nACTIVITY_FOLDER_NAME=\"\"\nPUPPETEER_LANDING_PAGE=\"\"\nTARGET_URL=\"\"\nLOGIN_URL=\"\"\n\n# Dev-server selection (used by `atb dev --browser`).\n# Edit and save while puppeteer is running to hot-swap the previewed bundle.\n# PAGE is only meaningful for multi-page activities \u2014 leave empty otherwise.\nVARIATION=\"Variation-1\"\nPAGE=\"\"\n\nNODE_ENV=\"development\"\nVERBOSE=false\n\n# Build wrapper config.\n# TARGET_BUILD_PREFIX customizes the window flag baked into each build \u2014\n# rendered as window.${TARGET_BUILD_PREFIX}_${contentHash}_${hash}. Defaults\n# to \"TargetBuild\" when empty. Useful when multiple at-builder activities\n# end up loaded on the same page and you want each project's flag namespaced.\nTARGET_BUILD_PREFIX=\"\"\n\n# Adobe Target Deployment Configuration\n# ADOBE_TENANT is your AT tenant slug \u2014 find it in the AT URL after \"mc.adobe.io/\".\nADOBE_TENANT=\"\"\nADOBE_CLIENT_ID=\"\"\nADOBE_CLIENT_SECRET=\"\"\n ";
|
|
122
|
+
envContent = "\nACTIVITIES_BASE_FOLDER=\"Activities\"\nACTIVITY_FOLDER_NAME=\"\"\nPUPPETEER_LANDING_PAGE=\"\"\nTARGET_URL=\"\"\nLOGIN_URL=\"\"\n\n# Dev-server selection (used by `atb dev --browser`).\n# Edit and save while puppeteer is running to hot-swap the previewed bundle.\n# PAGE is only meaningful for multi-page activities \u2014 leave empty otherwise.\nVARIATION=\"Variation-1\"\nPAGE=\"\"\n\nNODE_ENV=\"development\"\nVERBOSE=false\n\n# Build wrapper config.\n# TARGET_BUILD_PREFIX customizes the window flag baked into each build \u2014\n# rendered as window.${TARGET_BUILD_PREFIX}_${contentHash}_${hash}. Defaults\n# to \"TargetBuild\" when empty. Useful when multiple at-builder activities\n# end up loaded on the same page and you want each project's flag namespaced.\nTARGET_BUILD_PREFIX=\"\"\n\n# Adobe Target Deployment Configuration\n# ADOBE_TENANT is your AT tenant slug \u2014 find it in the AT URL after \"mc.adobe.io/\".\nADOBE_TENANT=\"\"\nADOBE_CLIENT_ID=\"\"\nADOBE_CLIENT_SECRET=\"\"\n\n# Telemetry / Usage Tracking\n# Set to false to disable CLI usage tracking\nTELEMETRY_ENABLED=true\n# Set to your analytics backend URL to POST telemetry events\nTELEMETRY_URL=\"\"\n# Google Analytics 4 configuration (falls back to hardcoded project values)\nGA_MEASUREMENT_ID=\"\"\nGA_API_SECRET=\"\"\n ";
|
|
123
123
|
// Write the content to the .env file
|
|
124
124
|
fs_1.default.writeFileSync(envPath, envContent.trim(), 'utf8');
|
|
125
125
|
console.log('.env file created successfully!');
|
package/bin/index.js
CHANGED
|
@@ -67,6 +67,7 @@ var commander_1 = require("commander");
|
|
|
67
67
|
var config_1 = require("./constants/config");
|
|
68
68
|
var doctor_1 = require("./services/doctor");
|
|
69
69
|
var logger_1 = __importDefault(require("./services/logger"));
|
|
70
|
+
var telemetry_1 = require("./services/telemetry");
|
|
70
71
|
/**
|
|
71
72
|
* Checks if the .env file exists at the current working directory
|
|
72
73
|
*
|
|
@@ -89,6 +90,46 @@ var checkEnvFile = function () {
|
|
|
89
90
|
};
|
|
90
91
|
// Prepare environment for spawning processes
|
|
91
92
|
var productionEnv = __assign(__assign({}, process.env), { executionPath: process.cwd() });
|
|
93
|
+
/**
|
|
94
|
+
* Helper utility to wrap Commander subcommand actions with telemetry logging.
|
|
95
|
+
*
|
|
96
|
+
* Automatically tracks when a command starts, succeeds, or fails with an error.
|
|
97
|
+
*/
|
|
98
|
+
var wrapAction = function (commandName, actionFn) {
|
|
99
|
+
return function () {
|
|
100
|
+
var args = [];
|
|
101
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
102
|
+
args[_i] = arguments[_i];
|
|
103
|
+
}
|
|
104
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
105
|
+
var error_1;
|
|
106
|
+
return __generator(this, function (_a) {
|
|
107
|
+
switch (_a.label) {
|
|
108
|
+
case 0: return [4 /*yield*/, (0, telemetry_1.trackTelemetry)(commandName, "started")];
|
|
109
|
+
case 1:
|
|
110
|
+
_a.sent();
|
|
111
|
+
_a.label = 2;
|
|
112
|
+
case 2:
|
|
113
|
+
_a.trys.push([2, 5, , 7]);
|
|
114
|
+
return [4 /*yield*/, actionFn.apply(void 0, args)];
|
|
115
|
+
case 3:
|
|
116
|
+
_a.sent();
|
|
117
|
+
return [4 /*yield*/, (0, telemetry_1.trackTelemetry)(commandName, "success")];
|
|
118
|
+
case 4:
|
|
119
|
+
_a.sent();
|
|
120
|
+
return [3 /*break*/, 7];
|
|
121
|
+
case 5:
|
|
122
|
+
error_1 = _a.sent();
|
|
123
|
+
return [4 /*yield*/, (0, telemetry_1.trackTelemetry)(commandName, "failed", error_1 instanceof Error ? error_1 : new Error(String(error_1)))];
|
|
124
|
+
case 6:
|
|
125
|
+
_a.sent();
|
|
126
|
+
throw error_1;
|
|
127
|
+
case 7: return [2 /*return*/];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
};
|
|
92
133
|
// Commander setup with proper subcommands
|
|
93
134
|
var setupCommander = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
94
135
|
var version, program;
|
|
@@ -109,7 +150,7 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
109
150
|
program
|
|
110
151
|
.command('init')
|
|
111
152
|
.description('Initialize project with .env configuration and templates')
|
|
112
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
153
|
+
.action(wrapAction('init', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
154
|
var globalOpts;
|
|
114
155
|
return __generator(this, function (_a) {
|
|
115
156
|
switch (_a.label) {
|
|
@@ -121,11 +162,11 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
121
162
|
return [2 /*return*/];
|
|
122
163
|
}
|
|
123
164
|
});
|
|
124
|
-
}); });
|
|
165
|
+
}); }));
|
|
125
166
|
program
|
|
126
167
|
.command('new')
|
|
127
168
|
.description('Create a new Adobe Target activity with variations')
|
|
128
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
169
|
+
.action(wrapAction('new', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
170
|
var globalOpts;
|
|
130
171
|
return __generator(this, function (_a) {
|
|
131
172
|
switch (_a.label) {
|
|
@@ -137,12 +178,12 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
137
178
|
return [2 /*return*/];
|
|
138
179
|
}
|
|
139
180
|
});
|
|
140
|
-
}); });
|
|
181
|
+
}); }));
|
|
141
182
|
program
|
|
142
183
|
.command('build')
|
|
143
184
|
.description('Build activity for development or production')
|
|
144
185
|
.option('--prod', 'Build for production deployment')
|
|
145
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
186
|
+
.action(wrapAction('build', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
146
187
|
var globalOpts;
|
|
147
188
|
return __generator(this, function (_a) {
|
|
148
189
|
switch (_a.label) {
|
|
@@ -155,12 +196,12 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
155
196
|
return [2 /*return*/];
|
|
156
197
|
}
|
|
157
198
|
});
|
|
158
|
-
}); });
|
|
199
|
+
}); }));
|
|
159
200
|
program
|
|
160
201
|
.command('dev')
|
|
161
202
|
.description('Start development server with file watching')
|
|
162
203
|
.option('--browser', 'Open in browser automatically')
|
|
163
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
204
|
+
.action(wrapAction('dev', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
164
205
|
var globalOpts;
|
|
165
206
|
return __generator(this, function (_a) {
|
|
166
207
|
switch (_a.label) {
|
|
@@ -173,13 +214,13 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
173
214
|
return [2 /*return*/];
|
|
174
215
|
}
|
|
175
216
|
});
|
|
176
|
-
}); });
|
|
217
|
+
}); }));
|
|
177
218
|
program
|
|
178
219
|
.command('deploy')
|
|
179
220
|
.description('Deploy activity to Adobe Target using at-deploy.js')
|
|
180
221
|
.option('--dry-run', 'Run deployment in dry-run mode without actual deployment')
|
|
181
222
|
.option('--force', 'Override the 60s post-deploy cooldown lock')
|
|
182
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
223
|
+
.action(wrapAction('deploy', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
183
224
|
var globalOpts;
|
|
184
225
|
return __generator(this, function (_a) {
|
|
185
226
|
switch (_a.label) {
|
|
@@ -192,12 +233,12 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
192
233
|
return [2 /*return*/];
|
|
193
234
|
}
|
|
194
235
|
});
|
|
195
|
-
}); });
|
|
236
|
+
}); }));
|
|
196
237
|
program
|
|
197
238
|
.command('sync')
|
|
198
239
|
.description('Sync build.config.json with the Adobe Target activity definition')
|
|
199
240
|
.option('--scaffold', 'Auto-create missing variation folders with boilerplate')
|
|
200
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
241
|
+
.action(wrapAction('sync', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
201
242
|
var globalOpts;
|
|
202
243
|
return __generator(this, function (_a) {
|
|
203
244
|
switch (_a.label) {
|
|
@@ -210,12 +251,12 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
210
251
|
return [2 /*return*/];
|
|
211
252
|
}
|
|
212
253
|
});
|
|
213
|
-
}); });
|
|
254
|
+
}); }));
|
|
214
255
|
program
|
|
215
256
|
.command('doctor')
|
|
216
257
|
.description('Diagnose and fix project configuration issues')
|
|
217
258
|
.option('--fix', 'Automatically fix detected issues')
|
|
218
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
259
|
+
.action(wrapAction('doctor', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
219
260
|
var globalOpts;
|
|
220
261
|
return __generator(this, function (_a) {
|
|
221
262
|
switch (_a.label) {
|
|
@@ -227,12 +268,12 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
227
268
|
return [2 /*return*/];
|
|
228
269
|
}
|
|
229
270
|
});
|
|
230
|
-
}); });
|
|
271
|
+
}); }));
|
|
231
272
|
program
|
|
232
273
|
.command('install-extension')
|
|
233
274
|
.description('Install the at-builder VSCode extension from the Marketplace')
|
|
234
275
|
.option('--editor <bin>', 'Editor CLI to use (e.g. code, agy, cursor, codium)', 'code')
|
|
235
|
-
.action(function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
276
|
+
.action(wrapAction('install-extension', function (options, command) { return __awaiter(void 0, void 0, void 0, function () {
|
|
236
277
|
var globalOpts;
|
|
237
278
|
return __generator(this, function (_a) {
|
|
238
279
|
switch (_a.label) {
|
|
@@ -244,7 +285,7 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
244
285
|
return [2 /*return*/];
|
|
245
286
|
}
|
|
246
287
|
});
|
|
247
|
-
}); });
|
|
288
|
+
}); }));
|
|
248
289
|
return [4 /*yield*/, program.parseAsync(process.argv)];
|
|
249
290
|
case 2:
|
|
250
291
|
_a.sent();
|
|
@@ -259,6 +300,11 @@ var setupCommander = function () { return __awaiter(void 0, void 0, void 0, func
|
|
|
259
300
|
* Any entries in `scriptArgs` are forwarded to the underlying script via npm's
|
|
260
301
|
* `--` passthrough (e.g. `npm run foo -- --dry-run`).
|
|
261
302
|
*
|
|
303
|
+
* Returns a Promise that resolves when the child process exits successfully,
|
|
304
|
+
* or rejects with an Error when it exits with a non-zero code. This allows
|
|
305
|
+
* callers (and the telemetry wrapAction) to accurately capture success/failure
|
|
306
|
+
* and measure real execution duration.
|
|
307
|
+
*
|
|
262
308
|
* @param commandArr - The array of command strings to pass to `npm`.
|
|
263
309
|
* @param env - The environment object to pass to the spawned process.
|
|
264
310
|
* @param scriptArgs - Optional flags/args to forward to the npm script itself.
|
|
@@ -269,11 +315,25 @@ var runCommand = function (commandArr, env, scriptArgs) {
|
|
|
269
315
|
? __spreadArray(__spreadArray(__spreadArray([], commandArr, true), ["--"], false), scriptArgs, true) : commandArr;
|
|
270
316
|
logger_1.default.info("runCommand", "Running npm command [".concat(fullArgs.join(", "), "]"));
|
|
271
317
|
logger_1.default.info("runCommand", "Current working directory: ".concat(process.cwd()));
|
|
272
|
-
(
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
318
|
+
return new Promise(function (resolve, reject) {
|
|
319
|
+
var child = (0, child_process_1.spawn)("npm", fullArgs, {
|
|
320
|
+
cwd: path_1.default.join(__dirname, "../"),
|
|
321
|
+
env: env,
|
|
322
|
+
shell: true,
|
|
323
|
+
stdio: "inherit",
|
|
324
|
+
});
|
|
325
|
+
child.on("error", function (err) {
|
|
326
|
+
logger_1.default.error("runCommand", "Spawn error: ".concat(err.message));
|
|
327
|
+
reject(err);
|
|
328
|
+
});
|
|
329
|
+
child.on("exit", function (code) {
|
|
330
|
+
if (code === 0 || code === null) {
|
|
331
|
+
resolve();
|
|
332
|
+
}
|
|
333
|
+
else {
|
|
334
|
+
reject(new Error("Command [".concat(fullArgs.join(" "), "] exited with code ").concat(code)));
|
|
335
|
+
}
|
|
336
|
+
});
|
|
277
337
|
});
|
|
278
338
|
};
|
|
279
339
|
/**
|
|
@@ -306,10 +366,15 @@ var handleInit = function (verbose) { return __awaiter(void 0, void 0, void 0, f
|
|
|
306
366
|
*/
|
|
307
367
|
var handleNew = function (verbose) { return __awaiter(void 0, void 0, void 0, function () {
|
|
308
368
|
return __generator(this, function (_a) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
369
|
+
switch (_a.label) {
|
|
370
|
+
case 0:
|
|
371
|
+
if (verbose)
|
|
372
|
+
logger_1.default.info("verbose", "Creating new activity");
|
|
373
|
+
return [4 /*yield*/, runCommand(["run", "atb:plop:new:activity"], productionEnv)];
|
|
374
|
+
case 1:
|
|
375
|
+
_a.sent();
|
|
376
|
+
return [2 /*return*/];
|
|
377
|
+
}
|
|
313
378
|
});
|
|
314
379
|
}); };
|
|
315
380
|
/**
|
|
@@ -317,18 +382,25 @@ var handleNew = function (verbose) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
317
382
|
*/
|
|
318
383
|
var handleBuild = function (prod, verbose) { return __awaiter(void 0, void 0, void 0, function () {
|
|
319
384
|
return __generator(this, function (_a) {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
385
|
+
switch (_a.label) {
|
|
386
|
+
case 0:
|
|
387
|
+
if (verbose)
|
|
388
|
+
logger_1.default.info("verbose", "Building in ".concat(prod ? 'production' : 'development', " mode"));
|
|
389
|
+
if (!prod) return [3 /*break*/, 2];
|
|
390
|
+
process.env['NODE_ENV'] = 'production';
|
|
391
|
+
logger_1.default.info("handleBuild", "Running build with production environment");
|
|
392
|
+
return [4 /*yield*/, runCommand(['run', 'atb:build:prod'], productionEnv)];
|
|
393
|
+
case 1:
|
|
394
|
+
_a.sent();
|
|
395
|
+
return [3 /*break*/, 4];
|
|
396
|
+
case 2:
|
|
397
|
+
logger_1.default.info("handleBuild", "Running build with development environment");
|
|
398
|
+
return [4 /*yield*/, runCommand(['run', 'atb:build:dev'], productionEnv)];
|
|
399
|
+
case 3:
|
|
400
|
+
_a.sent();
|
|
401
|
+
_a.label = 4;
|
|
402
|
+
case 4: return [2 /*return*/];
|
|
330
403
|
}
|
|
331
|
-
return [2 /*return*/];
|
|
332
404
|
});
|
|
333
405
|
}); };
|
|
334
406
|
/**
|
|
@@ -337,12 +409,17 @@ var handleBuild = function (prod, verbose) { return __awaiter(void 0, void 0, vo
|
|
|
337
409
|
var handleDev = function (browser, verbose) { return __awaiter(void 0, void 0, void 0, function () {
|
|
338
410
|
var commandArr;
|
|
339
411
|
return __generator(this, function (_a) {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
412
|
+
switch (_a.label) {
|
|
413
|
+
case 0:
|
|
414
|
+
if (verbose)
|
|
415
|
+
logger_1.default.info("verbose", "Starting development server with browser=".concat(browser));
|
|
416
|
+
commandArr = ['run', browser ? 'atb:build:dev:puppeteer' : 'atb:build:dev'];
|
|
417
|
+
logger_1.default.info("handleDev", "Running command: ".concat(commandArr.join(', ')));
|
|
418
|
+
return [4 /*yield*/, runCommand(commandArr, productionEnv)];
|
|
419
|
+
case 1:
|
|
420
|
+
_a.sent();
|
|
421
|
+
return [2 /*return*/];
|
|
422
|
+
}
|
|
346
423
|
});
|
|
347
424
|
}); };
|
|
348
425
|
/**
|
|
@@ -351,16 +428,21 @@ var handleDev = function (browser, verbose) { return __awaiter(void 0, void 0, v
|
|
|
351
428
|
var handleDeploy = function (dryRun, force, verbose) { return __awaiter(void 0, void 0, void 0, function () {
|
|
352
429
|
var scriptArgs;
|
|
353
430
|
return __generator(this, function (_a) {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
431
|
+
switch (_a.label) {
|
|
432
|
+
case 0:
|
|
433
|
+
if (verbose)
|
|
434
|
+
logger_1.default.info("verbose", "Deploying to Adobe Target with dry-run=".concat(dryRun, " force=").concat(force));
|
|
435
|
+
logger_1.default.info("handleDeploy", "Running Adobe Target deployment");
|
|
436
|
+
scriptArgs = [];
|
|
437
|
+
if (dryRun)
|
|
438
|
+
scriptArgs.push('--dry-run');
|
|
439
|
+
if (force)
|
|
440
|
+
scriptArgs.push('--force');
|
|
441
|
+
return [4 /*yield*/, runCommand(['run', 'atb:build:deploy'], productionEnv, scriptArgs)];
|
|
442
|
+
case 1:
|
|
443
|
+
_a.sent();
|
|
444
|
+
return [2 /*return*/];
|
|
445
|
+
}
|
|
364
446
|
});
|
|
365
447
|
}); };
|
|
366
448
|
/**
|
|
@@ -369,14 +451,19 @@ var handleDeploy = function (dryRun, force, verbose) { return __awaiter(void 0,
|
|
|
369
451
|
var handleSync = function (scaffold, verbose) { return __awaiter(void 0, void 0, void 0, function () {
|
|
370
452
|
var scriptArgs;
|
|
371
453
|
return __generator(this, function (_a) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
454
|
+
switch (_a.label) {
|
|
455
|
+
case 0:
|
|
456
|
+
if (verbose)
|
|
457
|
+
logger_1.default.info("verbose", "Syncing build.config.json with scaffold=".concat(scaffold));
|
|
458
|
+
logger_1.default.info("handleSync", "Running Adobe Target sync");
|
|
459
|
+
scriptArgs = [];
|
|
460
|
+
if (scaffold)
|
|
461
|
+
scriptArgs.push('--scaffold');
|
|
462
|
+
return [4 /*yield*/, runCommand(['run', 'atb:build:sync'], productionEnv, scriptArgs)];
|
|
463
|
+
case 1:
|
|
464
|
+
_a.sent();
|
|
465
|
+
return [2 /*return*/];
|
|
466
|
+
}
|
|
380
467
|
});
|
|
381
468
|
}); };
|
|
382
469
|
/**
|
|
@@ -444,7 +531,7 @@ var handleInstallExtension = function (editor, verbose) { return __awaiter(void
|
|
|
444
531
|
* Handles the doctor command
|
|
445
532
|
*/
|
|
446
533
|
var handleDoctor = function (autoFix, verbose) { return __awaiter(void 0, void 0, void 0, function () {
|
|
447
|
-
var issues, fixed,
|
|
534
|
+
var issues, fixed, error_2;
|
|
448
535
|
return __generator(this, function (_a) {
|
|
449
536
|
switch (_a.label) {
|
|
450
537
|
case 0:
|
|
@@ -484,8 +571,8 @@ var handleDoctor = function (autoFix, verbose) { return __awaiter(void 0, void 0
|
|
|
484
571
|
_a.label = 5;
|
|
485
572
|
case 5: return [3 /*break*/, 7];
|
|
486
573
|
case 6:
|
|
487
|
-
|
|
488
|
-
logger_1.default.error("handleDoctor", "Doctor command failed: ".concat(
|
|
574
|
+
error_2 = _a.sent();
|
|
575
|
+
logger_1.default.error("handleDoctor", "Doctor command failed: ".concat(error_2.message));
|
|
489
576
|
process.exit(1);
|
|
490
577
|
return [3 /*break*/, 7];
|
|
491
578
|
case 7: return [2 /*return*/];
|
|
@@ -527,7 +614,7 @@ var printCommandHelp = function () { return __awaiter(void 0, void 0, void 0, fu
|
|
|
527
614
|
* Main program flow
|
|
528
615
|
*/
|
|
529
616
|
var main = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
530
|
-
var
|
|
617
|
+
var error_3;
|
|
531
618
|
return __generator(this, function (_a) {
|
|
532
619
|
switch (_a.label) {
|
|
533
620
|
case 0:
|
|
@@ -537,8 +624,8 @@ var main = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
|
537
624
|
_a.sent();
|
|
538
625
|
return [3 /*break*/, 3];
|
|
539
626
|
case 2:
|
|
540
|
-
|
|
541
|
-
logger_1.default.error("main",
|
|
627
|
+
error_3 = _a.sent();
|
|
628
|
+
logger_1.default.error("main", error_3.message);
|
|
542
629
|
process.exit(1);
|
|
543
630
|
return [3 /*break*/, 3];
|
|
544
631
|
case 3: return [2 /*return*/];
|