Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map((name, i) => {
const normalizedName = path.normalize(name);
let type = getAPIFileType(name);
// File source
let source = fs.readFileSync(name).toString();
if (type === 'TS') {
// Transpile TypeScript to Google Apps Script
// @see github.com/grant/ts2gas
source = ts2gas(source, userConf);
type = 'SERVER_JS';
}
// Formats rootDir/appsscript.json to appsscript.json.
// Preserves subdirectory names in rootDir
// (rootDir/foo/Code.js becomes foo/Code.js)
const formattedName = getAppsScriptFileName(rootDir, name);
// If the file is valid, return the file in a format suited for the Apps Script API.
if (isValidFileName(name, type, rootDir, normalizedName, filesToIgnore)) {
nonIgnoredFilePaths.push(name);
const file: AppsScriptFile = {
name: formattedName, // the file base name
type, // the file extension
source, // the file contents
};