Skip to content

Commit b1ce74c

Browse files
committed
Enhance logging messages for clarity and consistency.
1 parent 944f56c commit b1ce74c

File tree

16 files changed

+38
-38
lines changed

16 files changed

+38
-38
lines changed

dist/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const createWebSocketServer = (...args_1) => __awaiter(void 0, [...args_1], void
8585
wss.on('close', () => {
8686
clearInterval(pingInterval);
8787
});
88-
logger_1.Logger.success(`WebSocket server started on ws://localhost:${port}`);
88+
logger_1.Logger.success(`WebSocket server listening on ws://localhost:${port}`);
8989
// Return a function to broadcast a message to all connected clients
9090
return (message) => {
9191
logger_1.Logger.success(`Broadcasting message to ${wss.clients.size} client(s)`);
@@ -323,7 +323,7 @@ const watchApp = (handoff) => __awaiter(void 0, void 0, void 0, function* () {
323323
process.exit(1);
324324
})
325325
.listen(port, () => {
326-
logger_1.Logger.log(`> Ready on http://${hostname}:${port}`);
326+
logger_1.Logger.log(`Ready on http://${hostname}:${port}`);
327327
});
328328
});
329329
const wss = yield createWebSocketServer((_d = (_c = handoff.config.app.ports) === null || _c === void 0 ? void 0 : _c.websocket) !== null && _d !== void 0 ? _d : 3001);

dist/cli/eject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const ejectConfig = (handoff) => __awaiter(void 0, void 0, void 0, function* ()
2424
const configPath = path_1.default.resolve(path_1.default.join(handoff.workingPath, 'handoff.config.js'));
2525
if (fs_extra_1.default.existsSync(configPath)) {
2626
if (!handoff.force) {
27-
logger_1.Logger.error(`A config already exists in the working directory. Use the --force flag to overwrite.`);
27+
logger_1.Logger.error(`Config file already exists. Use "--force" to overwrite.`);
2828
}
2929
}
3030
// load the template as a string

dist/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ const initRuntimeConfig = (handoff) => {
385385
result.entries.js = path_1.default.resolve(handoff.workingPath, (_d = handoff.config.entries) === null || _d === void 0 ? void 0 : _d.js);
386386
}
387387
else {
388-
logger_1.Logger.error('No js entry found in config');
388+
logger_1.Logger.error('No JavaScript entry point found in configuration.');
389389
}
390390
if ((_f = (_e = handoff.config.entries) === null || _e === void 0 ? void 0 : _e.components) === null || _f === void 0 ? void 0 : _f.length) {
391391
const componentPaths = handoff.config.entries.components.flatMap(getComponentsForPath);
@@ -489,12 +489,12 @@ const validateConfig = (config) => {
489489
// TODO: Check to see if the exported folder exists before we run start
490490
if (!config.figma_project_id && !process.env.HANDOFF_FIGMA_PROJECT_ID) {
491491
// check to see if we can get this from the env
492-
logger_1.Logger.error('Figma project id not found in config or env. Please run `handoff-app fetch` first.');
492+
logger_1.Logger.error('Figma Project ID missing. Please set HANDOFF_FIGMA_PROJECT_ID or run "handoff-app fetch".');
493493
throw new Error('Cannot initialize configuration');
494494
}
495495
if (!config.dev_access_token && !process.env.HANDOFF_DEV_ACCESS_TOKEN) {
496496
// check to see if we can get this from the env
497-
logger_1.Logger.error('Dev access token not found in config or env. Please run `handoff-app fetch` first.');
497+
logger_1.Logger.error('Figma Access Token missing. Please set HANDOFF_DEV_ACCESS_TOKEN or run "handoff-app fetch".');
498498
throw new Error('Cannot initialize configuration');
499499
}
500500
return config;

dist/pipeline.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const validateHandoffRequirements = (handoff) => __awaiter(void 0, void 0, void
248248
// couldn't find the right version, but ...
249249
}
250250
if (!requirements) {
251-
logger_1.Logger.error('Handoff Installation failed');
251+
logger_1.Logger.error('Handoff installation failed.');
252252
logger_1.Logger.warn('- Please update node to at least Node 16 https://nodejs.org/en/download. \n- You can read more about installing handoff at https://www.handoff.com/docs/');
253253
throw new Error('Could not run handoff');
254254
}
@@ -281,7 +281,7 @@ your id would be IGYfyraLDa0BpVXkxHY2tE\n`);
281281
logger_1.Logger.warn(`\n\nYou supplied at least one required variable. We can write these variables to a local env file for you to make it easier to run the pipeline in the future.\n`);
282282
const writeEnvFile = yield (0, prompt_1.prompt)(chalk_1.default.green('Write environment variables to .env file? (y/n): '));
283283
if (writeEnvFile !== 'y') {
284-
logger_1.Logger.success(`Skipping .env file creation. You will need to supply these variables in the future.\n`);
284+
logger_1.Logger.success(`Skipped .env file creation. Please provide these variables manually.`);
285285
}
286286
else {
287287
const envFilePath = path_1.default.resolve(handoff.workingPath, '.env');

dist/transformers/plugins/ssr-render.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ const react_1 = __importDefault(require("react"));
2020
const server_1 = __importDefault(require("react-dom/server"));
2121
const vite_1 = require("vite");
2222
const logger_1 = require("../../utils/logger");
23-
const vite_logger_1 = require("../utils/vite-logger");
2423
const docgen_1 = require("../docgen");
2524
const build_1 = require("../utils/build");
2625
const html_1 = require("../utils/html");
2726
const module_1 = require("../utils/module");
2827
const schema_loader_1 = require("../utils/schema-loader");
2928
const string_1 = require("../utils/string");
29+
const vite_logger_1 = require("../utils/vite-logger");
3030
/**
3131
* Constants for the SSR render plugin
3232
*/
@@ -68,7 +68,7 @@ function loadComponentSchemaAndModule(componentData, componentPath, handoff) {
6868
}
6969
}
7070
catch (error) {
71-
logger_1.Logger.warn(`Failed to load component file ${componentPath}: ${error}`);
71+
logger_1.Logger.warn(`Failed to load component file "${componentPath}": ${error}`);
7272
}
7373
}
7474
// Step 3: Load component for rendering (if not already loaded)
@@ -78,7 +78,7 @@ function loadComponentSchemaAndModule(componentData, componentPath, handoff) {
7878
component = moduleExports.exports.default;
7979
}
8080
catch (error) {
81-
logger_1.Logger.error(`Failed to load component for rendering: ${componentPath}`, error);
81+
logger_1.Logger.error(`Failed to load component for rendering "${componentPath}":`, error);
8282
return [null, null];
8383
}
8484
}

dist/transformers/preview/component/css.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ const buildCssBundle = (_a) => __awaiter(void 0, [_a], void 0, function* ({ entr
7373
yield (0, vite_1.build)(viteConfig);
7474
}
7575
catch (e) {
76-
logger_1.Logger.error(`Error building CSS for ${entry}`);
76+
logger_1.Logger.error(`Failed to build CSS for "${entry}"`);
7777
throw e;
7878
}
7979
finally {
@@ -144,7 +144,7 @@ const buildComponentCss = (data, handoff, sharedStyles) => __awaiter(void 0, voi
144144
}
145145
}
146146
catch (e) {
147-
logger_1.Logger.error(`Error building CSS for ${id}`);
147+
logger_1.Logger.error(`Failed to build CSS for "${id}"`);
148148
throw e;
149149
}
150150
return data;
@@ -160,7 +160,7 @@ const buildMainCss = (handoff) => __awaiter(void 0, void 0, void 0, function* ()
160160
const stat = yield fs_extra_1.default.stat(runtimeConfig.entries.scss);
161161
const entryPath = stat.isDirectory() ? path_1.default.resolve(runtimeConfig.entries.scss, 'main.scss') : runtimeConfig.entries.scss;
162162
if (entryPath === runtimeConfig.entries.scss || fs_extra_1.default.existsSync(entryPath)) {
163-
logger_1.Logger.success(`Building main CSS file`);
163+
logger_1.Logger.success(`Building main CSS file...`);
164164
try {
165165
// Setup SASS load paths
166166
const loadPaths = [
@@ -180,7 +180,7 @@ const buildMainCss = (handoff) => __awaiter(void 0, void 0, void 0, function* ()
180180
});
181181
}
182182
catch (e) {
183-
logger_1.Logger.error(`Error building main CSS`, e);
183+
logger_1.Logger.error(`Failed to build main CSS:`, e);
184184
}
185185
}
186186
}

dist/transformers/preview/component/javascript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const buildJsBundle = (_a, handoff_1) => __awaiter(void 0, [_a, handoff_1], void
5151
yield (0, vite_1.build)(viteConfig);
5252
}
5353
catch (e) {
54-
logger_1.Logger.error(`Error building ${outputFilename}`, e);
54+
logger_1.Logger.error(`Failed to build JS for "${outputFilename}":`, e);
5555
}
5656
finally {
5757
// Restore the original NODE_ENV value after vite build completes
@@ -93,7 +93,7 @@ const buildComponentJs = (data, handoff) => __awaiter(void 0, void 0, void 0, fu
9393
data['jsCompiled'] = compiled;
9494
}
9595
catch (e) {
96-
logger_1.Logger.error(`[Component JS Build Error] ${id}:`, e);
96+
logger_1.Logger.error(`JS build failed for component "${id}":`, e);
9797
}
9898
return data;
9999
});

dist/transformers/utils/schema-loader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const loadSchemaFromFile = (schemaPath, handoff) => __awaiter(void 0, void 0, vo
2828
var _a, _b;
2929
const ext = path_1.default.extname(schemaPath);
3030
if (ext !== '.ts' && ext !== '.tsx') {
31-
logger_1.Logger.warn(`Schema file has unsupported extension: ${ext}`);
31+
logger_1.Logger.warn(`Unsupported schema file extension: ${ext}`);
3232
return null;
3333
}
3434
try {
@@ -49,7 +49,7 @@ const loadSchemaFromFile = (schemaPath, handoff) => __awaiter(void 0, void 0, vo
4949
return null;
5050
}
5151
catch (error) {
52-
logger_1.Logger.warn(`Failed to load separate schema file ${schemaPath}: ${error}`);
52+
logger_1.Logger.warn(`Failed to load schema file "${schemaPath}": ${error}`);
5353
return null;
5454
}
5555
});

src/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const createWebSocketServer = async (port: number = 3001) => {
5959
clearInterval(pingInterval);
6060
});
6161

62-
Logger.success(`WebSocket server started on ws://localhost:${port}`);
62+
Logger.success(`WebSocket server listening on ws://localhost:${port}`);
6363

6464
// Return a function to broadcast a message to all connected clients
6565
return (message: string) => {
@@ -332,7 +332,7 @@ export const watchApp = async (handoff: Handoff): Promise<void> => {
332332
process.exit(1);
333333
})
334334
.listen(port, () => {
335-
Logger.log(`> Ready on http://${hostname}:${port}`);
335+
Logger.log(`Ready on http://${hostname}:${port}`);
336336
});
337337
});
338338

src/cli/eject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const ejectConfig = async (handoff: Handoff) => {
1111
const configPath = path.resolve(path.join(handoff.workingPath, 'handoff.config.js'));
1212
if (fs.existsSync(configPath)) {
1313
if (!handoff.force) {
14-
Logger.error(`A config already exists in the working directory. Use the --force flag to overwrite.`);
14+
Logger.error(`Config file already exists. Use "--force" to overwrite.`);
1515
}
1616
}
1717
// load the template as a string

0 commit comments

Comments
 (0)