Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
name: local,
source: data,
});
// Sync create all necessary files
for (const remoteFile of remoteFiles) {
createFile(remoteFile);
}
// If there was no file specified to pull we will do a cleanup
if (!fileName) {
// Remove all .gs, .js, .html and appsscript.json files that were not in remote.json unless they are in .gasignore
const toDelete = [];
for (const localFileName of localFiles) {
const localExtension = path.parse(localFileName).ext;
const fileNameWithoutExtension = path.join(path.parse(localFileName).dir, path.parse(localFileName).name);
if (eaft.isPushable(localExtension, fileNameWithoutExtension, extensions, ignoreRegexes) &&
!remoteNames.includes(localFileName) && localFileName !== constants.INCLUDE_FILE) {
toDelete.push(path.join(rootFolder, localFileName));
}
}
// Delete files
for (const fileToDelete of toDelete) {
fs.removeSync(fileToDelete);
}
// Remove all empty folders
const allFolders = getAllFolders(rootFolder).sort().reverse();
for (const emptyFolder of allFolders) {
const files = fs.readdirSync(emptyFolder);
if (files.length === 0) {
exports.onCreateNode = (
{ node, boundActionCreators, getNode } /* : NodeParams */
) => {
const { createNodeField } = boundActionCreators;
if (node.internal.type === 'MarkdownRemark') {
const fileNode = getNode(node.parent);
const parsedFilePath = path.parse(fileNode.relativePath);
let section = parsedFilePath.dir;
let slug;
if (
parsedFilePath.name.match(/Readme/i)
&& fileNode.dir.match(/\/fields\/types\//)
) {
section = 'api/field'; // fake the path for slug consistency
slug = `/${section}/${kebabify(parsedFilePath.dir)}`;
} else {
if (parsedFilePath.name === 'index') {
slug = `/${kebabify(parsedFilePath.dir)}`;
} else {
slug = `/${kebabify(parsedFilePath.dir)}/${kebabify(
parsedFilePath.name
)}`;
module.exports.updateH=(root,file,json)=>{
var h=inFile(file);
return h
.then(mc.h2json)
.then(addNumber)
.then(loadConfig(Promise.resolve(json)))
.then(onlyChanged)
.then(extendFrom(h))
.then(array2text)
.then(outFile(path.join(root,'Marlin',path.parse(file).base)))
.then(a=>(console.log('updated h: ',path.relative(root,file)),a))
.catch(a=>{ console.log('fail h: ',file,a); throw a;})
}
public static fromFile (
path: string,
name?: string,
): FileBox {
if (!name) {
name = nodePath.parse(path).base
}
const options: FileBoxOptions = {
name,
path,
type : FileBoxType.File,
}
return new FileBox(options)
}
sources.forEach(src => {
const dest = path.join(outputPath, path.parse(src).base);
fs.copyFileSync(src, dest);
});
};
const outputFileName = (input, output) => {
const outputIsDirectory = isDirectory(output)
const { ext, name } = path.parse((!output || outputIsDirectory) ? input : output)
let dir = outputIsDirectory ? output : './'
if (output && !outputIsDirectory) {
const { dir: outDir } = path.parse(output)
dir = outDir == '' ? dir : outDir
}
return path.format({
dir: dir,
name: name.replace('.mjml', ''),
ext: ext == ".mjml" ? '.html' : ext
})
}
const fixtureInfo = fs.readdirSync(absoluteFixtures).map(file => {
const {ext, name: nameWithType} = path.parse(file);
const {ext: type, name} = path.parse(nameWithType);
const fixture = path.join(absoluteFixtures, file);
invariant(
ext !== '' && (type === '.input' || type === '.golden'),
`toMatchGolden: "${file}" must be named ` +
'"*.input.$EXTENSION" or "*.golden.$EXTENSION".',
);
invariant(
fs.statSync(fixture).isFile(),
`toMatchGolden: "${file}" must be a regular file.`,
);
return {
ext: ext.slice(1),
fixture,
name,
type: type.slice(1),
.map((name) => path.parse(name).name);
}
const fixtures = fs.readdirSync(directory).map(filename => {
return {
name: path.parse(filename).name,
geojson: load.sync(directory + filename)
};
});
fs.readdirSync(join(__dirname, iconFolder)).forEach(filename => {
const imageType = {
'.svg': 'svg+xml',
'.png': 'png'
}[parse(filename).ext]
if (!imageType) return
const key = parse(filename).name
const iconFile = join(__dirname, iconFolder, filename)
const svgSource = fs.readFileSync(iconFile, 'utf8')
const svg = whiten ? whitenSVG(svgSource) : svgSource
const b64 = Buffer.from(svg).toString('base64')
icons[key] = `data:image/${imageType};base64,${b64}`
})