oc-generic-template-compiler
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -43,3 +43,6 @@ type Callback<T = unknown> = (err: Error | null, data: T) => void; | ||
type CompileView = (options: CompilerOptions, cb: Callback<CompiledViewInfo>) => void; | ||
type CompileView = ( | ||
options: CompilerOptions, | ||
cb: Callback<CompiledViewInfo> | ||
) => void; | ||
type CompileServer = ( | ||
@@ -46,0 +49,0 @@ options: CompilerOptions & { compiledViewInfo: CompiledViewInfo }, |
@@ -20,31 +20,13 @@ 'use strict'; | ||
// watch, | ||
module.exports = ({ compileServer, compileView, compileStatics, getInfo }) => ( | ||
options, | ||
callback | ||
) => { | ||
const componentPackage = _.cloneDeep(options.componentPackage); | ||
const ocPackage = options.ocPackage; | ||
async.waterfall( | ||
[ | ||
// Compile view | ||
function(cb) { | ||
// compiledViewInfo, bundleInfo | ||
compileView(options, (error, compiledViewInfo) => { | ||
if (error) { | ||
return cb(error); | ||
} | ||
// USE COMPILATION INFO TO MASSAGE COMPONENT'S PACKAGE | ||
componentPackage.oc.files.template = compiledViewInfo.template; | ||
delete componentPackage.oc.files.client; | ||
cb(error, { componentPackage, compiledViewInfo }); | ||
}); | ||
}, | ||
// Compile dataProvider | ||
function({ componentPackage, compiledViewInfo }, cb) { | ||
if (!componentPackage.oc.files.data) { | ||
return cb(null, componentPackage); | ||
} | ||
compileServer( | ||
Object.assign({}, options, { compiledViewInfo }), | ||
(error, compiledServerInfo) => { | ||
module.exports = | ||
({ compileServer, compileView, compileStatics, getInfo }) => | ||
(options, callback) => { | ||
const componentPackage = _.cloneDeep(options.componentPackage); | ||
const ocPackage = options.ocPackage; | ||
async.waterfall( | ||
[ | ||
// Compile view | ||
function (cb) { | ||
// compiledViewInfo, bundleInfo | ||
compileView(options, (error, compiledViewInfo) => { | ||
if (error) { | ||
@@ -54,35 +36,54 @@ return cb(error); | ||
// USE COMPILATION INFO TO MASSAGE COMPONENT'S PACKAGE | ||
componentPackage.oc.files.dataProvider = compiledServerInfo; | ||
delete componentPackage.oc.files.data; | ||
cb(error, componentPackage); | ||
componentPackage.oc.files.template = compiledViewInfo.template; | ||
delete componentPackage.oc.files.client; | ||
cb(error, { componentPackage, compiledViewInfo }); | ||
}); | ||
}, | ||
// Compile dataProvider | ||
function ({ componentPackage, compiledViewInfo }, cb) { | ||
if (!componentPackage.oc.files.data) { | ||
return cb(null, componentPackage); | ||
} | ||
); | ||
}, | ||
// Compile package.json | ||
function(componentPackage, cb) { | ||
componentPackage.oc.files.template.version = getInfo().version; | ||
componentPackage.oc.version = ocPackage.version; | ||
componentPackage.oc.packaged = true; | ||
componentPackage.oc.date = getUnixUtcTimestamp(); | ||
if (!componentPackage.oc.files.static) { | ||
componentPackage.oc.files.static = []; | ||
compileServer( | ||
Object.assign({}, options, { compiledViewInfo }), | ||
(error, compiledServerInfo) => { | ||
if (error) { | ||
return cb(error); | ||
} | ||
// USE COMPILATION INFO TO MASSAGE COMPONENT'S PACKAGE | ||
componentPackage.oc.files.dataProvider = compiledServerInfo; | ||
delete componentPackage.oc.files.data; | ||
cb(error, componentPackage); | ||
} | ||
); | ||
}, | ||
// Compile package.json | ||
function (componentPackage, cb) { | ||
componentPackage.oc.files.template.version = getInfo().version; | ||
componentPackage.oc.version = ocPackage.version; | ||
componentPackage.oc.packaged = true; | ||
componentPackage.oc.date = getUnixUtcTimestamp(); | ||
if (!componentPackage.oc.files.static) { | ||
componentPackage.oc.files.static = []; | ||
} | ||
if (!_.isArray(componentPackage.oc.files.static)) { | ||
componentPackage.oc.files.static = [ | ||
componentPackage.oc.files.static | ||
]; | ||
} | ||
fs.writeJson( | ||
path.join(options.publishPath, 'package.json'), | ||
componentPackage, | ||
error => { | ||
cb(error, componentPackage); | ||
} | ||
); | ||
}, | ||
// Compile statics | ||
function (componentPackage, cb) { | ||
compileStatics(options, error => cb(error, componentPackage)); | ||
} | ||
if (!_.isArray(componentPackage.oc.files.static)) { | ||
componentPackage.oc.files.static = [componentPackage.oc.files.static]; | ||
} | ||
fs.writeJson( | ||
path.join(options.publishPath, 'package.json'), | ||
componentPackage, | ||
error => { | ||
cb(error, componentPackage); | ||
} | ||
); | ||
}, | ||
// Compile statics | ||
function(componentPackage, cb) { | ||
compileStatics(options, error => cb(error, componentPackage)); | ||
} | ||
], | ||
callback | ||
); | ||
}; | ||
], | ||
callback | ||
); | ||
}; |
{ | ||
"name": "oc-generic-template-compiler", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "OC-Generic-Template-Compiler", | ||
@@ -32,3 +32,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"async": "^2.4.1", | ||
"async": "3.1.1", | ||
"fs-extra": "8.1.0", | ||
@@ -38,3 +38,3 @@ "lodash": "^4.17.4", | ||
}, | ||
"gitHead": "24ad81a2692832b389c36503d31e9016d4e17417" | ||
"gitHead": "a28de7210094eb958ad17e06fd6c964f53c6d45a" | ||
} |
6465
154
+ Addedasync@3.1.1(transitive)
- Removedasync@2.6.4(transitive)
Updatedasync@3.1.1