Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function pageFinder(dir, webpack_config, minifyOutput) {
// Look at all sub-directories of dir and if a directory contains
// both a -demo.html and -demo.js file then add the corresponding
// entry points and Html plugins to the config.
// Find all the dirs below 'dir'.
const pagesDir = path.resolve(dir, 'pages');
// Look for all *.js files, for each one look for a matching .html file.
// Emit into config.
//
const pagesJS = glob.sync(pagesDir + '/*.js');
pagesJS.forEach(pageJS => {
// Look for both a .js and .html file in the directory.
// Strip off ".js" from end and replace with ".html".
let pageHTML = pageJS.replace(/\.js$/, '.html');
if (!fs.existsSync(pageHTML)) {
console.log("WARNING: A page needs both a *.js and a *.html file.");
return
}
let baseHTML = basename(pageHTML);
let name = basename(pageJS, '.js');
webpack_config.entry[name] = pageJS;
let opts = {
filename: baseHTML,
template: pageHTML,
function pageFinder(dir, webpack_config) {
// Look at all sub-directories of dir and if a directory contains
// both a -demo.html and -demo.js file then add the corresponding
// entry points and Html plugins to the config.
// Find all the dirs below 'dir'.
const pagesDir = path.resolve(dir, 'pages');
// Look for all *.js files, for each one look for a matching .html file.
// Emit into config.
//
const pagesJS = glob.sync(pagesDir + '/*.js');
pagesJS.forEach(pageJS => {
// Look for both a .js and .html file in the directory.
// Strip off ".js" from end and replace with ".html".
let pageHTML = pageJS.replace(/\.js$/, '.html');
if (!fs.existsSync(pageHTML)) {
console.log("WARNING: A page needs both a *.js and a *.html file.");
return
}
let baseHTML = basename(pageHTML);
let name = basename(pageJS, '.js');
webpack_config.entry[name] = pageJS;
webpack_config.plugins.push(
new HtmlWebpackPlugin({
filename: baseHTML,
export function optimizeBuild(
options: AbstractBuilderSchema | RollupBuilderSchema | ClosureBuilderSchema,
context: BuilderContext
): Observable<{}> {
// TODO: convert to Observable pattern
const files = glob.sync(normalize('out-tsc/**/*.component.js'));
return of(Promise.all(files.map((file) => {
return new Promise((res, rej) => {
readFile(file, 'utf-8', (err, data) => {
if (err) rej(err);
writeFile(file, buildOptimizer({ content: data }).content, (err) => {
if (err) rej(err);
res(file);
});
});
})
})));
}
module.exports = (env, argv) => {
let config = commonBuilder(env, argv, __dirname);
config.entry.tests = glob.sync('./modules/**/*_test.js');
return config;
}
const { commonBuilder } = require('./webpack.common.js');
const { demoFinder } = require('./webpack.demo-finder.js')
const { glob } = require('glob');
let common = demoFinder(__dirname, commonBuilder(__dirname));
common.entry.tests = glob.sync('./tests/*.js');
module.exports = common;
? _.flatten(rootConfig.workspaces.map((ws: string) => glob.sync(ws))).map((ws: string) => path.join(this.cwd, ws))
: [this.cwd];
? _.flatten(rootConfig.workspaces.map((ws: string) => glob.sync(ws))).map((ws: string) => path.join(this.cwd, ws))
: [this.cwd];
? _.flatten(rootConfig.workspaces.map((ws: string) => glob.sync(ws))).map((ws: string) => path.join(this.cwd, ws))
: [this.cwd];