ExLibrisGroup/primo-explore-devenv

gulp task app-css does not work for november 2018 release

Closed this issue · 4 comments

hi,

in primo november release 2018 the structure of /primo-explore/lib/scsss.tar.gz changed and colors.json is at new location:

src/main/webapp/styles/colors.json

before it was at

www/styles/colors.json

This yields to the following error for task app-css

[07:36:22] Using gulpfile /app/primo-explore-devenv/gulpfile.js
[07:36:22] Starting 'app-css'...
[07:36:22] Starting 'extract-scss-files'...
http://search.obvsg.at:80/primo-explore/lib/scsss.tar.gz
[07:36:23] Finished 'extract-scss-files' after 288 ms
[07:36:23] Starting 'color-variables'...
[07:36:23] 'color-variables' errored after 591 μs
[07:36:23] Error: ENOENT: no such file or directory, open 'www/styles/partials/../colors.json'
    at Error (native)
    at Object.fs.openSync (fs.js:642:18)
    at Object.fs.readFileSync (fs.js:510:33)
    at Gulp.gulp.task (/app/primo-explore-devenv/gulp/tasks/build-scss.js:47:42)
    at module.exports (/app/primo-explore-devenv/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/app/primo-explore-devenv/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/app/primo-explore-devenv/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/app/primo-explore-devenv/node_modules/orchestrator/index.js:134:8)
    at runNextSet (/app/primo-explore-devenv/node_modules/run-sequence/index.js:86:16)
    at Gulp.onTaskEnd (/app/primo-explore-devenv/node_modules/run-sequence/index.js:75:5)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone (/app/primo-explore-devenv/node_modules/orchestrator/index.js:264:8)
    at /app/primo-explore-devenv/node_modules/orchestrator/index.js:275:23
    at finish (/app/primo-explore-devenv/node_modules/orchestrator/lib/runTask.js:21:8)
    at /app/primo-explore-devenv/node_modules/orchestrator/lib/runTask.js:52:4
[07:36:23] 'app-css' errored after 296 ms
[07:36:23] Error in plugin 'run-sequence(color-variables)'
Message:
    color-variables catch

Here is my bugfix, please pick it

uleodolter/primo-explore-devenv@77b43db

It looks line PrimoStudio has an updated gulp task which renames src/main/webapp to www while scsss.tar.gz is extracted. this would be another option backport ExLibrisGroup/Primo-Studio/gulp/tasks/build-scss.js function extractScssFiles()

@ShoulM I would be great if PrimoStudio and primo-explore-devenv are in sync for these types of tasks.

gilax commented

@uleodolter, looks like your solution is good for those who already have the November 2018 release. I'll commit a solution soon for both who have it and who doesn't have it yet, based on Primo-Studio's solution.

@gilax your fix does not work as expected, because rename is done in wrong direction for backwards compatibility. this patch would fix the problem:

diff --git a/gulp/tasks/build-scss.js b/gulp/tasks/build-scss.js
index 562322e..2916307 100644
--- a/gulp/tasks/build-scss.js
+++ b/gulp/tasks/build-scss.js
@@ -41,8 +41,8 @@ gulp.task('extract-scss-files', ()=> {
     return request({url:url, 'headers': headers})
         .pipe(zlib.createGunzip()) // unzip
         .pipe(tar.extract('.', {map: (header)=>{
-                if (header.name.indexOf('src/main/webapp') > -1){
-                    header.name = header.name.replace('src/main/webapp', 'www');
+                if (header.name.indexOf('www/') > -1){
+                    header.name = header.name.replace('www/', 'src/main/webapp/');
                 }
                 return header;
             }}));