(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
_(files) .flatMap(file => traverseUp(path.resolve(startFrom, file))) .sortBy().reverse() .filter(file => fs.existsSync(file) && path.isAbsolute(file)) .thru(files => _.isEmpty(files) ? [] : [_.first(files)]) .flatMap(dirFile => _.map(files, file => path.join(path.dirname(dirFile), file))) .filter(file => fs.existsSync(file)) .value()
_(files) .map(file => (path.isAbsolute(file) ? file : path.join(base, file))) .filter(file => fs.existsSync(file)) .value()
let importResolver = async function (srcId, idsToFind) { let luObjects = [] let parentFilePath = path.parse(path.resolve(srcId)).dir for (let idx = 0; idx < idsToFind.length; idx++) { let file = idsToFind[idx] if (!path.isAbsolute(file.filePath)) { file.filePath = path.resolve(parentFilePath, file.filePath) } if (file.filePath.endsWith("common.lu")) { luObjects.push(new luObject(`# common_intent${NEWLINE}- this is common utterance`, new luOptions(file.filePath, file.includeInCollate))) } else if (file.filePath.endsWith("common.qna")) { luObjects.push(new luObject(`# ? common_question${NEWLINE}\`\`\`${NEWLINE}this is common answer${NEWLINE}\`\`\``, new luOptions(file.filePath, file.includeInCollate))) } } return luObjects }
const resolveLuFileContent = function(file, luObjects, srcId) { let parentFilePath = srcId === 'stdin' ? process.cwd() : path.parse(path.resolve(srcId)).dir // Support wild cards at the end of a relative .LU file path. // './bar/*' should look for all .lu files under the specified folder. // './bar/**' should recursively look for .lu files under sub-folders as well. if(file.filePath.endsWith('*')) { const isRecursive = file.filePath.endsWith('**') const rootFolder = file.filePath.replace(/\*/g, '') let rootPath = rootFolder; if(!path.isAbsolute(rootFolder)) { rootPath = path.resolve(parentFilePath, rootFolder); } // Get LU files in this location const luFilesToAdd = helpers.findLUFiles(rootPath, isRecursive); // add these to filesToParse for(let f = 0; f < luFilesToAdd.length; f++){ const opts = new luOptions(luFilesToAdd[f], file.includeInCollate) luObjects.push(new luObject(readLuFile(luFilesToAdd[f]), opts)) } return } if(!path.isAbsolute(file.filePath)) { file.filePath = path.resolve(parentFilePath, file.filePath) } // find matching parsed files and ensure includeInCollate is updated if needed. luObjects.push(new luObject(readLuFile(file.filePath), new luOptions(file.filePath, file.includeInCollate))) }
for (let idx = 0; idx < idsToFind.length; idx++) { let file = idsToFind[idx] if (!path.isAbsolute(file.filePath)) { file.filePath = path.resolve(parentFilePath, file.filePath)
expect(path.isAbsolute(normalized)).to.equal(true); }); });
for (let idx = 0; idx < idsToFind.length; idx++) { let file = idsToFind[idx] if (!path.isAbsolute(file.filePath)) { file.filePath = path.resolve(parentFilePath, file.filePath)
it('npmconfig is always absolute', () => { results = makeCreateContext(argv, { npmconfig: '~/.npmconfig', presets: ['nextjs'] }); assume(results.npmconfig).includes('/.npmconfig'); assume(path.isAbsolute(results.npmconfig)).true(); });
su.flattenDeep([sumanOpts.reporter_paths || []]).filter(v => { !v && _suman.log.warning('warning: a supposed filesystem path to a reporter was falsy.'); return v; }) .forEach(function (item: string) { if (!path.isAbsolute(item)) (item = path.resolve(projectRoot + '/' + item)); loadReporterViaPath(item); });
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)
(process.env.NODE_PATH || '') .split(path.delimiter) .filter(folder => folder && !path.isAbsolute(folder)) .map(folder => path.resolve(appDirectory, folder)) .join(path.delimiter)