Skip to content

Commit

Permalink
fix directory paths (#3440)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaskikutis authored Apr 20, 2020
1 parent cc1cc53 commit d2a5d32
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tasks/compile-translations-po-to-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var fs = require('fs');
var path = require('path');
var execSync = require('child_process').execSync;
var _ = require('lodash');
var {getModuleDir} = require('./get-module-directory');

function isDirectory(path) {
try {
Expand Down Expand Up @@ -82,7 +83,7 @@ function compileTranslationsPoToJson(grunt) {
return;
}

var po2json = path.join(clientCoreRoot, 'node_modules/gettext.js/bin/po2json');
var po2json = `${getModuleDir('gettext.js')}/bin/po2json`;
var poFile = `${translationsPoDir}/${filename}`;
var jsonFile = `${translationsJsonDir}/${filename.replace('.po', '.json')}`;

Expand Down
9 changes: 9 additions & 0 deletions tasks/get-module-directory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var path = require('path');

function getModuleDir(moduleName) {
return path.join(require.resolve(moduleName + '/package.json'), '../');
}

module.exports = {
getModuleDir: getModuleDir,
};
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var path = require('path');
var webpack = require('webpack');
var lodash = require('lodash');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
var {getModuleDir} = require('./tasks/get-module-directory');

function countOccurences(_string, substring) {
return _string.split(substring).length - 1;
Expand All @@ -25,7 +26,7 @@ module.exports = function makeConfig(grunt) {
// include only 'superdesk-core' and valid modules inside node_modules
let validModules = ['superdesk-core'].concat(apps);

const jQueryModule = `${__dirname}/node_modules/jquery`;
const jQueryModule = getModuleDir('jquery');

return {
entry: {
Expand Down

0 comments on commit d2a5d32

Please sign in to comment.