Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it( 'should return fileDescriptor for all the passed files', function () {
cache = fileEntryCache.create( 'testCache' );
var files = expand( path.resolve( __dirname, '../fixtures/*.txt' ) );
var oFiles = cache.normalizeEntries( files );
cache.reconcile();
// modify a file
write( path.resolve( fixturesDir, fixtureFiles[ 2 ].name ), fixtureFiles[ 2 ].content + 'modified!!!' );
oFiles = cache.normalizeEntries( files );
expect( oFiles.length ).to.equal( 4 );
var changedFile = oFiles.filter( function ( entry ) {
return entry.changed;
} );
expect( changedFile[ 0 ].key ).to.contains( fixtureFiles[ 2 ].name );
} );
.catch(err => {
// if installation failed, ensure that package.json is not modified
if (err.code !== 0) {
write.sync(app.pkg.path, pkgBuffer);
console.log(err);
process.exit(err.code);
}
err.installer = app.installer;
throw err;
});
};
new OnBuildPlugin(function (stats) {
// Save manifest file
write.sync(path.resolve(cfg.appRoot, 'www/build-' + app.version, 'manifest.json'), JSON.stringify(manifest))
// Save browserconfig file
let xml = '' +
'' +
'' +
'' +
'' +
'#da532c' +
'' +
'' +
''
write.sync(path.resolve(cfg.appRoot, 'www/build-' + app.version, 'browserconfig.xml'), xml)
// Copy icon files (see http://realfavicongenerator.net/faq for details)
copy(path.resolve(cfg.packageRoot, 'icons/favicon-*'), path.resolve(cfg.appRoot, 'www/build-' + app.version))
copy(path.resolve(cfg.packageRoot, 'icons/android-chrome-*'), path.resolve(cfg.appRoot, 'www/build-' + app.version))
copy(path.resolve(cfg.packageRoot, 'icons/mstile-*'), path.resolve(cfg.appRoot, 'www/build-' + app.version))
copy(path.resolve(cfg.packageRoot, 'icons/apple-touch-icon-*'), path.resolve(cfg.appRoot, 'www/build-' + app.version))
// Rename Apple touch icon
rename(path.resolve(cfg.appRoot, 'www/build-' + app.version, 'apple-touch-icon-180x180.png'), path.resolve(cfg.appRoot, 'www/build-' + app.version, 'apple-touch-icon.png'))
// Compress images
let images = list(path.resolve(cfg.appRoot, 'www/build-' + app.version + '/img'))
for (let i = 0; i < images.length; i++) {
console.log('Compress ' + images[i])
}
$('h2,table').each(function(i, ele) {
if (ele.name === 'h2') {
stack.push('mozilla-html-' + dashcase($(this).text().trim()) + '');
} else {
var name = stack.pop();
var expected = cwd('../expected', name + '.md');
var fixture = cwd('../fixtures', name + '.html');
var html = $.html(this);
write.sync(fixture, html);
write.sync(expected, breakdance(html));
console.log('wrote:', name);
}
});
var fixtures = exports.files(__dirname, '../fixtures');
var comments = extract(fixtures[name]).filter(function(comment) {
return comment.type === 'BlockComment';
});
var res = '';
for (var i = 0; i < comments.length; i++) {
var raw = '\n\n/*' + comments[i].raw + '*/\n';
var tok = stringify(tokenize(raw), {indent: ' '});
tok = tok.replace(/\s*Node\s*/g, '');
res += raw;
res += `\nassert.deepEqual(tokenize(comments[${i}].raw), ${tok});`;
}
writeFile.sync(dest, res.trim());
};
.then(function(stats) {
write.sync(path.join(__dirname, 'stats.json'), JSON.stringify(stats, null, 2))
write.sync(path.join(__dirname, 'stats.md'), suite.render(stats));
})
.catch(console.error);
.then(function(stats) {
write.sync(path.join(__dirname, 'stats.json'), JSON.stringify(stats, null, 2))
write.sync(path.join(__dirname, 'stats.md'), suite.render(stats));
})
.catch(console.error);
if (editor == 'atom') {
languageExtension = getExtensionFromAtomLanguageScope(languageScope)
} else if (editor == 'vscode') {
languageExtension = getExtensionFromVSCodeLanguageScope(languageScope)
} else if (editor == 'sublime') {
languageExtension = getExtensionFromSublimeLanguageScope(languageScope)
}
for (let snippet in preSnipsterMap[languageScope]) {
let filename = preSnipsterMap[languageScope][snippet].prefix + '.' + languageExtension
snippetFilesSynced.push(filename)
try {
if (editor == 'vscode') {
let body = preSnipsterMap[languageScope][snippet].body.join('\n')
write.sync(userDirectory + '/' + editor + '/' + filename, body)
} else {
write.sync(userDirectory + '/' + editor + '/' + filename, preSnipsterMap[languageScope][snippet].body)
}
} catch(e) {
if (e) { console.log(chalk.red(e))}
}
}
}
}
return snippetFilesSynced
}
.then(function(stats) {
write.sync(dir('stats.json'), JSON.stringify(stats, null, 2));
write.sync(dir('stats.md'), suite.render(stats));
})
.catch(console.error);
writeJSON: function ( filePath, data ) {
write.sync( filePath, flatted.stringify( data ) );
}
};