-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbuild-html-bundles.js
More file actions
33 lines (31 loc) · 978 Bytes
/
build-html-bundles.js
File metadata and controls
33 lines (31 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const peritextConfig = require( './app/src/peritextConfig.render' );
const buildBundler = require( './services/htmlBuildBundler' );
const buildBundle = ( { templateId, generatorId } ) => {
return buildBundler( {
templateId,
generatorId,
} )
};
/**
* Resolve based on config
*/
if ( peritextConfig.htmlBuilds ) {
Object.keys( peritextConfig.htmlBuilds )
.reduce( ( cur, generatorId ) => {
return cur.then( () => {
return new Promise( ( resolve, reject ) => {
const templates = peritextConfig.htmlBuilds[generatorId];
Object.keys( templates )
.reduce( ( cur2, templateId ) => {
return cur2.then( () =>
buildBundle( { templateId, generatorId } )
);
}, Promise.resolve() )
.then( resolve )
.catch( reject );
} );
} );
}, Promise.resolve() )
.then(() => console.log('done'))
.catch(console.log)
}