fs.access(triagePath) .catch(e => { if (e.code === 'ENOENT') { console.log('Creating triage folder...') return fs.mkdir(triagePath) } throw e })
/** * Install function for the package, it set up all the settings details */ (async () => { try { await fs.access(settings.settingsPath); await settings.load(); } catch (e) { settings.update(); } })();
/** * Obtain the destination path for the project * @method getDestPath * @param {String} arg The param used when the initializer runs * @return {Promise} * @throws if the path is not valid */ static async getDestPath(arg) { const destPath = utils.files.resolvePath(arg); if (!destPath) { throw new Error('A path for the new project is required'); } // TODO Include here a way to get "options" for the other args // Do not continue if the project folder already exists. return new Promise((resolve, reject) => { fs.access(destPath) .then(() => reject(new Error(`The project folder '${destPath} already exists. You need to specify a different path.`))) .catch(() => resolve(destPath)); }); }
/** * Load the settings values from the settings file * @method load * @param {String} [filePath=this.settingsPath] The path for the settings file * @return {Promise} */ async load(filePath = this.settingsPath) { fs.access(filePath); const json = await utils.files.readJsonFile(filePath); this.defaults = json.defaults; this.githubAuth = json.githubAuth; this.lintPkgs = json.lintPkgs; this.testingPkgs = json.testingPkgs; this.licenses = json.licenses; this.settingsPath = json.settingsPath; this.templatesPath = json.templatesPath; this.templates = json.templates; this.licensesPath = json.licensesPath; }
await fs.access(dest); } catch (e) { await fs.mkdir(dest, { recursive: true });
await fs.promises.access(this.data.path, fs.constants.R_OK);
let newDir = path.resolve(cwd.innerText, dir.trim()); try { await fs.access(newDir); cwd.innerText = newDir; } catch (e) {
return fs.access(path.join(folderPath, '.git')).should.not.eventually.be.rejectedWith(Error); });
await fs.access(dirPath); } catch (e) { console.error(`Folder ${dirPath} not deleted: Not found`);
let user; try { await fs.access(settings.settingsPath); await settings.load(); } catch (e) {
await fs.promises.access(path.resolve(hexoRootDir, 'source', '_posts', req.params.name + '.md')); } catch (e) { console.error(e); await fs.promises.access(folder) await fs.promises.access(path.resolve(hexoRootDir, 'source', req.params.name, 'index.md')); } catch (e) { console.error(e); await fs.promises.access(folder)
fs.access(triagePath) .catch(e => { if (e.code === 'ENOENT') { console.log('Creating triage folder...') return fs.mkdir(triagePath) } throw e })