Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('is rejected when a watched source directory does not exist', function() {
setUpBuilderAndWatcher(new WatchedDir('doesnotexist'))
return expect(watchPromise).to.be.rejected
})
})
packages.forEach(pkg => {
const pkgLib = path.join(this.packagesPath, pkg.name, 'lib');
const pkgTemplates = path.join(pkgLib, 'templates');
if (!existsSync(pkgLib)) {
return;
}
addonJS.push(new WatchedDir(pkgLib));
if(pkg.hasTemplates){
addonHbs.push(new Funnel(pkgTemplates, {
include: [
'*.hbs',
'**/*.hbs'
],
exclude: ['*.gitkeep'],
srcDir: '/',
destDir: 'modules/ember-shell/templates/'+ pkg.module
}));
}
});
function package(tree, options) {
options = options || {};
options.configPath = options.configPath || 'system.config.js';
options.inputFileName = options.inputFileName || 'index.js';
options.outputFileName = options.outputFileName || 'index.js';
options.format = options.format || 'global';
return new SystemBuilder(tree, '/', options.configPath, function (builder) {
return builder.buildStatic(options.inputFileName, options.outputFileName, {
format: options.format,
runtime: false,
});
});
}
var src = new WatchedTree('src');
var transpiledSrc = babel(src);
var transpiledLib = new Funnel(transpiledSrc, {
exclude: ['**/*-test.js'],
});
var outputNodes = [
package(transpiledLib, {
format: 'global',
inputFileName: 'index.js',
outputFileName: 'spanan.global.js'
}),
package(transpiledLib, {
format: 'esm',
inputFileName: 'index.js',
'use strict';
let broccoliSource = require('broccoli-source'),
mergeTrees = require('broccoli-merge-trees'),
concat = require('broccoli-concat'),
funnel = require('broccoli-funnel'),
browserify = require('broccoli-fast-browserify'),
sassCompiler = require('broccoli-sass-source-maps'),
extractSourceMaps = require('broccoli-source-map').extract,
babelify = require('babelify'),
omit = require('lodash.omit'),
merge = require('lodash.merge'),
findup = require('findup'),
path = require('path'),
appDir = broccoliSource.WatchedDir('app'),
babelOptions = {
filterExtensions: ['js', 'jsx', 'es6'],
browserPolyfill: true
};
class ReactApp {
constructor(options) {
this.options = options;
this.otherJavascriptFiles = [];
this.otherCssFiles = [];
}
index() {
return funnel('app/static', {
files: ['index.html'],
annotation: 'Funnel: index.html'
let packageTrees = packageDirs.map(dir => {
let testsDir = join(dir, 'tests');
if (existsSync(testsDir)) {
return new Funnel(new WatchedDir(testsDir), {
exclude: ['dummy', 'index.html'],
destDir: basename(dir)
});
}
}).filter(Boolean);
buildTrees(): Trees {
const srcPath = this.resolveLocal('src');
const srcTree = existsSync(srcPath) ? new WatchedDir(srcPath) : null;
const nodeModulesPath = this.resolveLocal('node_modules');
const nodeModulesTree = existsSync(srcPath) ? new UnwatchedDir(nodeModulesPath) : null;
return {
srcTree,
nodeModulesTree
}
}
let buildTreeFor = (defaultPath, specified, shouldWatch) => {
if (specified !== null && specified !== undefined && typeof specified !== 'string') {
return specified;
}
let tree = null;
let resolvedPath = resolvePathFor(defaultPath, specified);
if (fs.existsSync(resolvedPath)) {
if (shouldWatch !== false) {
tree = new WatchedDir(resolvedPath);
} else {
tree = new UnwatchedDir(resolvedPath);
}
}
return tree;
};
let trees = (options && options.trees) || {};
constructor(codeGenUrl) {
quickTemp.makeOrRemake(this, '_triggerDir', 'cardstack-hub');
this._trigger = new WatchedDir(this._triggerDir, {
annotation: '@cardstack/hub',
});
this.tree = new CodeWriter(codeGenUrl, this._trigger);
this._buildCounter = 0;
}
triggerRebuild() {
get indexTree() {
let indexFilePath = this.app.options.outputPaths.app.html;
let index: Tree = new Funnel(this.app.trees.app, {
allowEmpty: true,
include: [`index.html`],
getDestinationPath: () => indexFilePath,
annotation: 'app/index.html',
});
if (this.isModuleUnification) {
let srcIndex = new Funnel(new WatchedDir(join(this.root, 'src')), {
files: ['ui/index.html'],
getDestinationPath: () => indexFilePath,
annotation: 'src/ui/index.html',
});
index = mergeTrees([index, srcIndex], {
overwrite: true,
annotation: 'merge classic and MU index.html',
});
}
let patterns = this.configReplacePatterns;
return new this.configReplace(index, this.configTree, {
configPath: join('environments', `${this.app.env}.json`),
files: [indexFilePath],