You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2019/07/05 17:21:54 UTC

[GitHub] [cordova-windows] Jahrenski commented on issue #341: WinJS is not copied when adding windows platform

Jahrenski commented on issue #341: WinJS is not copied when adding windows platform
URL: https://github.com/apache/cordova-windows/issues/341#issuecomment-508820573
 
 
   > Temporarily fix via cordova hook when using unfixed version 7.0.0:
   > 
   > config.xml:
   > 
   > ```
   > <platform name="windows">
   >         <hook type="before_prepare" src="hooks/win_winjs_fix.js" />
   > </platform>
   > ```
   > 
   > hooks/win_winjs_fix.js:
   > 
   > ```js
   > const path = require('path');
   > const shell = require('shelljs');
   > const fs = require('fs');
   > 
   > module.exports = function (ctx)
   > {
   > 
   >     if (!ctx.opts.platforms.includes('windows'))
   >         return;
   > 
   > 
   >     return new Promise(function (resolve, reject)
   >     {
   >         const root = ctx.opts.projectRoot;
   >         const projectPath = path.join(root, 'platforms', 'windows');
   >         const destinationDirectory = path.join(projectPath, 'platform_www', 'WinJS', 'js');
   >         const destBaseJsPath = path.join(destinationDirectory, 'base.js');
   >         //var srcBaseJsPath = path.join(root, 'node_modules', 'winjs', 'js', 'base.js');
   >         const srcBaseJsPath = require.resolve('winjs/js/base');
   >         fs.mkdirSync(destinationDirectory, { recursive: true });
   >         shell.cp('-f', srcBaseJsPath, destBaseJsPath);
   >         resolve();
   >     });
   > 
   > };
   > ```
   
   I suggest you put the mkdir in a try catch otherwise it will be blocking the compile most of the time.
   `
   try {
      fs.mkdirSync(destinationDirectory, { recursive: true });
   } catch (err) {
      if (err.code !== 'EEXIST') throw err;
   }
   `

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org