Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const baseOutputConfig = { format: 'iife', globals: globalModules };
// -- Build shared artifacts -----------------------------------------------------
if (!fs.existsSync(engineModeFile)) {
throw new Error(
'Compat version of engine not generated in expected location: ' +
engineModeFile +
'.\nGenerate artifacts from the top-level Lightning Web Components project first'
);
}
// copy static files
fs.copySync(engineModeFile, path.join(testSharedOutput, 'engine.js'));
fs.copySync(shadowModeFile, path.join(testSharedOutput, 'shadow.js'));
fs.writeFileSync(path.join(testSharedOutput, 'downgrade.js'), compatPolyfills.loadDowngrade());
fs.writeFileSync(path.join(testSharedOutput, 'polyfills.js'), compatPolyfills.loadPolyfills());
fs.copySync(wireServicePath, path.join(testSharedOutput, 'wire.js'));
fs.copySync(todoPath, path.join(testSharedOutput, 'todo.js'));
// -- Build component tests -----------------------------------------------------=
testEntries
.reduce(async (promise, test) => {
await promise;
const { name: testName, path: testEntry, namespace: testNamespace } = test;
console.log(`Building integration test: ${testName}`);
const bundle = await rollup.rollup({ ...baseInputConfig, input: testEntry });
await bundle.write({
...baseOutputConfig,
testCaseComponentResolverPlugin(),
].filter(Boolean)
};
const baseOutputConfig = { format: 'iife', globals: globalModules };
// -- Build shared artifacts -----------------------------------------------------
if (!fs.existsSync(engineModeFile)) {
throw new Error("Compat version of engine not generated in expected location: " + engineModeFile
+ ".\nGenerate artifacts from the top-level Raptor project first");
}
// copy static files
fs.copySync(engineModeFile, path.join(testSharedOutput,'engine.js'));
fs.writeFileSync(path.join(testSharedOutput,'downgrade.js'), compatPolyfills.loadDowngrade());
fs.writeFileSync(path.join(testSharedOutput,'polyfills.js'), compatPolyfills.loadPolyfills());
fs.copySync(wireServicePath, path.join(testSharedOutput, 'wire.js'));
fs.copySync(todoPath, path.join(testSharedOutput, 'todo.js'));
// -- Build component tests -----------------------------------------------------=
testEntries.reduce(async (promise, test) => {
await promise;
const { name: testName, path: testEntry, namespace: testNamespace } = test;
console.log(`Building integration test: ${testName}`);
const bundle = await rollup.rollup({ ...baseInputConfig, input: testEntry });
const result = await bundle.write({
...baseOutputConfig,
file: `${testOutput}/${testNamespace}/${testName}/${testName}.js`
module.exports = (options = {}) => {
const { isCompat } = options;
const outputDir = path.join(__dirname, './../build/engine');
const engine = getModulePath('engine', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
const wire = getModulePath('wire-service', 'umd', isCompat ? 'es5' : 'es2017', 'dev');
fs.ensureDirSync(outputDir);
fs.copyFileSync(engine, path.join(outputDir, 'engine.js'));
fs.copyFileSync(wire, path.join(outputDir, 'wire.js'));
fs.writeFileSync(
path.join(outputDir, 'downgrade.js'),
compatPolyfills.loadDowngrade()
);
fs.writeFileSync(
path.join(outputDir, 'polyfills.js'),
compatPolyfills.loadPolyfills()
);
};