Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (typeof modernizrConfig.shouldParseFiles !== 'boolean') {
modernizrConfig.shouldParseFiles = true;
}
this.setOptions(modernizrConfig, environment);
/* By default, we want all the fixtures */
if (modernizrConfig && modernizrConfig.tree) {
this.currentFixturesTree = modernizrConfig.tree;
} else {
this.currentFixturesTree = 'tests/fixtures';
}
this.builder = new broccoli.Builder(this.parseTree());
return this.builder.build();
},
module.exports = function runEslint(path, _options) {
const options = _options || {};
const buildLog = [];
// default options
// eslint-disable-next-line global-require, newline-after-var
const formatter = require(options.format || 'eslint/lib/cli-engine/formatters/compact');
options.format = function spyFormatter(results) {
buildLog.push(formatter(results));
// prevent console spew
return '';
};
options.options = options.options || {};
const node = eslintValidationFilter.create(path, options);
const builder = new broccoli.Builder(node);
const promise = builder.build().then(() => ({
buildLog: buildLog.join('\n'),
outputPath: node.outputPath,
}));
pFinally(promise, () => builder.cleanup());
return promise;
};
console.log('Starting build');
const version = await getExtensionVersion(options.version);
process.env.PACKAGE_VERSION = version;
process.env.EXTENSION_VERSION = version;
if (!process.env.VERSION) {
process.env.VERSION = version;
}
const builder = getBroccoliBuilder(OUTPUT_PATH);
try {
await builder.build();
syncBuildFolder(builder, OUTPUT_PATH);
onBuildSuccess(builder, new UI()); // display slow-trees
} catch (ex) {
console.error(ex);
process.exit(1);
} finally {
await builder.cleanup();
}
// It seems that on fresh builds, process hangs here. Looking at upstream
// source-code of broccoli project, they also explicitely call
// `process.exit(0)` at the end of build. It would be nice to know why
// this is needed though.
process.exit(0);
});
};
// Make sure we clean-up on exit
function cleanupAndExit() {
return watcher.quit();
}
process.on('SIGINT', cleanupAndExit);
process.on('SIGTERM', cleanupAndExit);
// Sync build directory on build success
watcher.on('buildSuccess', () => {
syncBuildFolder(builder, outputDir);
onSuccess();
});
// Start serving!
broccoli.server.serve(
watcher,
'127.0.0.1',
port || 4300,
undefined,
undefined,
new UI(),
);
return watcher;
}
// cwd into the Brocfile's dir so its deps are loaded correctly.
process.chdir(path.dirname(brocfile));
return require(brocfile);
}
if (typeof dest !== 'string') {
grunt.fatal('Target must be configured with a `dest` dir path.');
}
if (grunt.file.isDir(dest)) {
grunt.warn('Directory "' + dest + '" already exists.');
}
var tree = loadBrocfile(this.data.brocfile);
var builder = new broccoli.Builder(tree);
grunt.log.writeln('Broccoli building to "' + dest + '"');
builder.build().then(function (results) {
// Deal with differences in Broccoli versions.
var dir = typeof results === 'string' ? results : results.directory;
var buildTime = results.totalTime;
ncp(dir, dest, {dereference: true}, function (err) {
if (err) { throw err; }
if (buildTime) {
grunt.log.ok('built (' + Math.floor(buildTime / 1e6) + 'ms)');
} else {
grunt.log.ok('built');
walker.on('end', () => {
const timerEnd = new Date().getTime()
const initialBuild = parseInt(timerEnd - timerStart, 10) * 1000000
const tree = broccoli.loadBrocfile()
const builder = new broccoli.Builder(tree)
builder.build().then(results => {
const dir = typeof results === 'string' ? results : results.directory
let buildTime = results.totalTime
// Copy files from tmp folder to the destination directory
// And make sure to follow symlinks while doing so
ncp(dir, config.outputDir + '/assets', {dereference: true}, err => {
if (err) {
throw err
}
if (buildTime) {
// The original built time is in nanoseconds, so we need to convert it to milliseconds
buildTime += initialBuild
export default function docify(options = {}) {
let port = options.port || 3000;
let docsPath = options.src || 'docs';
let pkgPath = options.pkg || process.cwd();
let themePath = options.theme
|| fs.existsSync('docs/theme') && 'docs/theme'
|| path.join(__dirname, '../themes/minimal');
let builder = new broccoli.Builder(docsTree({ docsPath, pkgPath, themePath }));
let server = broccoli.server.serve(builder, { host: 'localhost', port });
// Start a livereload server
let lrserver = tinylr();
lrserver.listen(35729, () => {
setTimeout(() => {
// Trigger a reload on first start
lrserver.changed({ body: { files: [ 'livereload files' ] } });
}, 1000);
});
// Notify it on changes
server.watcher.on('change', function() {
lrserver.changed({ body: { files: [ 'livereload files' ] } });
});
}
it('creates a simple clone of index.html', function () {
appTree = new EmberAddon({
'ember-index': {
output: 'index.jsp'
}
}).toTree();
builder = new broccoli.Builder(appTree);
return builder.build()
.then(function (results) {
var indexHtml, indexJsp,
outputPath = results.directory,
indexJspPath = path.join(outputPath, 'index.jsp'),
indexHtmlPath = path.join(outputPath, 'index.html');
expect(fs.existsSync(indexJspPath)).to.be.equal(true);
indexJsp = fs.readFileSync(indexJspPath).toString();
indexHtml = fs.readFileSync(indexHtmlPath).toString();
dummyVar = expect(indexJsp).not.to.be.empty;
expect(indexHtml).to.be.equal(indexJsp);
});
it('should not throw an error when failBuild option is passed for correct files', function() {
var node = new TSLint('./tests/fixtures/lintedFiles', {
logError: function(message) {
loggerOutput.push(message);
},
failBuild: true
});
builder = new broccoli.Builder(node);
return builder.build().then(function() {
assert.equal(loggerOutput.length, 0);
}, function(error) {
});
});
});
it("accepts an array of globs as exclude parameter", function() {
var sourcePath = 'tests/fixtures/exclude';
var node = new AssetRev(sourcePath + '/input', {
extensions: ['js', 'css', 'png', 'jpg', 'gif', 'map', 'ttf'],
exclude: ['assets/fonts/**/*'],
replaceExtensions: ['html', 'js', 'css']
});
builder = new broccoli.Builder(node);
return builder.build().then(function(graph) {
confirmOutput(graph.directory, sourcePath + '/output');
});
});