Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const rollup = rollupPackage(compiled, workspace);
const distPath = `${workspace}/dist`;
const dist = new Funnel(rollup, {
getDestinationPath(relativePath) {
return relativePath.slice(distPath.length + 1);
},
annotation: `mv ${distPath} to .`,
});
if (isProduction() || addTestVendor !== true) {
return debugTree(dist, `packageDist/${workspace}/output`);
}
let vendor = new Funnel(new UnwatchedDir(rootPath), {
include: [`packages/@simple-dom/*/dist/amd/es5/index.*`],
exclude: [`${workspace}/**`, `**/node_modules/**`, `**/tmp/**`]
});
vendor = mergeTrees([vendor, rollup]);
// place vendored package sources at root
vendor = new FixupSources(vendor, '../..');
vendor = debugTree(vendor, `packageDist/${workspace}/test-vendor-before-concat`);
vendor = concat(vendor, {
outputFile: '/test/amd/vendor.js',
inputFiles: ['packages/**/dist/amd/es5/index.js'],
sourceMapConfig: { enabled: true }
});
}),
new Funnel('ember-electron', {
srcDir: `resources-${platform}`,
destDir: 'ember-electron/resources',
allowEmpty: true,
}),
new Funnel(inputNode, {
destDir: 'ember',
}),
];
if (process.env.EMBER_ENV === 'test') {
// Overwrite main.js with test main.js
trees.push(new Funnel(new UnwatchedDir('.'), {
destDir: 'ember-electron',
include: [
'tests/ember-electron/main.js',
'ember-electron/test-main.js',
],
getDestinationPath() {
return 'main.js';
},
}));
}
return mergeTrees(trees, {
overwrite: true,
});
};
let testsPath = typeof trees.tests === 'string' ? resolvePathFor('tests', trees.tests) : null;
let testsTree = buildTreeFor('tests', trees.tests, options.tests);
// these are contained within app/ no need to watch again
// (we should probably have the builder or the watcher dedup though)
if (isExperimentEnabled('MODULE_UNIFICATION')) {
let srcStylesPath = `${resolvePathFor('src', trees.src)}/ui/styles`;
this._stylesPath = fs.existsSync(srcStylesPath) ? srcStylesPath : resolvePathFor('app/styles', trees.styles);
} else {
this._stylesPath = resolvePathFor('app/styles', trees.styles);
}
let stylesTree = null;
if (fs.existsSync(this._stylesPath)) {
stylesTree = new UnwatchedDir(this._stylesPath);
}
let templatesTree = buildTreeFor('app/templates', trees.templates, false);
// do not watch bower's default directory by default
let bowerTree = buildTreeFor(this.bowerDirectory, null, !!this.project._watchmanInfo.enabled);
// Set the flag to make sure:
//
// - we do not blow up if there is no bower_components folder
// - we do not attempt to merge bower and vendor together if they are the
// same tree
this._bowerEnabled = this.bowerDirectory !== 'vendor' && fs.existsSync(this.bowerDirectory);
let vendorTree = buildTreeFor('vendor', trees.vendor);
let publicTree = buildTreeFor('public', trees.public);
it('is rejected when a watched source directory does not exist', function() {
setUpBuilderAndWatcher(new WatchedDir('doesnotexist'))
return expect(watchPromise).to.be.rejected
})
})
packageTestApplicationConfig() {
let files = ['app-config.js'];
let patterns = configReplacePatterns({
addons: this.project.addons,
autoRun: this.autoRun,
storeConfigInMeta: this.storeConfigInMeta,
isModuleUnification: this.isModuleUnificationEnabled,
});
let configPath = path.join(this.name, 'config', 'environments', `test.json`);
let emberCLITree = new ConfigReplace(new UnwatchedDir(__dirname), this.packageConfig(), {
configPath,
files,
patterns,
});
return new Funnel(emberCLITree, {
files,
srcDir: '/',
destDir: '/vendor/ember-cli/',
annotation: 'Funnel (test-app-config-tree)',
});
}
module.exports = function(jsTree) {
let definitionsTree = funnel(new UnwatchedDir('packages/@glimmer'), {
include: ['**/*.d.ts'],
destDir: '@glimmer',
});
return merge([jsTree, definitionsTree]);
};
get legacyAppTree(): Tree {
if (this.isNativeV2) {
let appDir = this.packageJSON['ember-addon']['app-js'];
if (appDir) {
return new UnwatchedDir(join(this.originalRoot, appDir));
}
} else {
return new ChooseTree(this.vanillaTree, {
annotation: `vanilla-choose-app-tree.${this.name}`,
srcDir: (_: string) => {
return this.packageJSON['ember-addon']['app-js'];
}
});
}
}
overwrite: true,
});
let testJs = concat(baseMergedTree, {
headerFiles,
inputFiles,
footerFiles,
outputFile: testSupportPath,
annotation: 'Concat: Test Support JS',
allowNone: true,
sourceMapConfig: this.sourcemaps,
});
let testemPath = path.join(__dirname, 'testem');
testemPath = path.dirname(testemPath);
let testemTree = new Funnel(new UnwatchedDir(testemPath), {
files: ['testem.js'],
annotation: 'Funnel (testem)',
});
let sourceTrees = [testemTree, testJs];
if (this.vendorTestStaticStyles.length > 0) {
sourceTrees.push(
concat(tree, {
headerFiles: this.vendorTestStaticStyles,
outputFile: this.distPaths.testSupportCssFile,
annotation: 'Concat: Test Support CSS',
sourceMapConfig: this.sourcemaps,
})
);
}
function npmTree(parent, packageName, packageTreeOptions) {
var packageRoot = path.dirname(resolve.sync(packageName + '/package.json', { basedir: parent.root }));
var packageTree = new UnwatchedDir(packageRoot);
debug('creating funnel for %s at %s %o', packageName, packageRoot, packageTreeOptions);
return new Funnel(packageTree, packageTreeOptions);
}
treeForVendor(tree) {
let popperPath = this.findModulePath(this.project.root, 'popper.js');
let popperTree = funnel(new UnwatchedDir(popperPath), {
include: ['popper.js']
});
let tooltipPath = this.findModulePath(this.project.root, 'tooltip.js');
let tooltipTree = funnel(new UnwatchedDir(tooltipPath), {
include: ['tooltip.js']
});
const mergedTree = new MergedTrees([tree, popperTree, tooltipTree]);
return funnel(this.removeSourcemapAnnotation(mergedTree), {
getDestinationPath(relativePath) {
if (relativePath === 'popper.js' || relativePath === 'tooltip.js') {
return `ember-tooltips--${relativePath}`;
}