UNPKG

create-node-template

Version:

Create node.js or express boilerplate with one command

38 lines (37 loc) 1.08 kB
import * as fs from 'node:fs/promises'; import updateNotifier from 'update-notifier'; import packageJson from '../../../../package.json' with { type: 'json' }; // prettier cant handle this export const onPromptState = (state) => { if (state.aborted) { // If we don't re-enable the terminal cursor before exiting // the program, the cursor will remain hidden process.stdout.write('\x1B[?25h'); process.stdout.write('\n'); process.exit(1); } }; export const formatOptionDescription = (description) => { return ` ${description} `; }; export const notifyUpdate = () => { try { updateNotifier({ pkg: packageJson }).notify(); // this shoud be enpugh in itself. check npm docs. process.exit(); } catch (error) { const a = 22; // ignore error } }; export async function isWriteable(directory) { try { await fs.access(directory, (fs.constants || fs).W_OK); return true; } catch (err) { return false; } } //# sourceMappingURL=misc.js.map