Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

electron-packager-languages

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

electron-packager-languages - npm Package Compare versions

Comparing version 0.1.0 to 0.3.0

75

dist/index.js

@@ -7,35 +7,62 @@ 'use strict';

function getResourcePath(givenPath) {
return path.resolve(givenPath, '..');
function getLanguageFolderPath(givenPath, platform) {
switch (platform) {
case 'darwin':
case 'mas':
return path.resolve(givenPath, '..');
case 'win32':
case 'linux':
return path.resolve(givenPath, '..', '..', 'locales');
default:
return path.resolve(givenPath);
}
}
function walkDir(dir) {
var regex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : /./g;
return fs.readdirSync(dir).filter(function (currentPath) {
return fs.statSync(path.resolve(dir, currentPath)).isDirectory() && regex.test(currentPath);
});
function getLanguageFileExtension(platform) {
switch (platform) {
case 'darwin':
case 'mas':
return 'lproj';
case 'win32':
case 'linux':
return 'pak';
default:
return '';
}
}
// eslint-disable-next-line max-params
module.exports = function languages(languages) {
return function (buildPath, electronVersion, platform, arch, callback) {
// eslint-disable-next-line
if (['darwin', 'mas'].includes(platform)) {
var resourcePath = getResourcePath(buildPath);
var excludedLanguages = languages.map(function (l) {
return l + '.lproj';
});
var languageFolderFilter = new RegExp('.(lproj)$');
function walkLanguagePaths(dir, platform) {
var regex = new RegExp('.(' + getLanguageFileExtension(platform) + ')$');
var paths = fs.readdirSync(dir);
var languageFolders = walkDir(resourcePath, languageFolderFilter);
languageFolders.filter(function (langFolder) {
return !excludedLanguages.includes(langFolder);
}).forEach(function (langFolder) {
rimraf.sync(path.resolve(resourcePath, langFolder));
switch (platform) {
case 'darwin':
case 'mas':
return paths.filter(function (currentPath) {
return fs.statSync(path.resolve(dir, currentPath)).isDirectory() && regex.test(currentPath);
});
}
case 'win32':
case 'linux':
return paths;
default:
return [];
}
}
module.exports = function setLanguages(languages) {
return function electronPackagerLanguages(buildPath, electronVersion, platform, arch, callback) {
var resourcePath = getLanguageFolderPath(buildPath, platform);
var excludedLanguages = languages.map(function (l) {
return l + '.' + getLanguageFileExtension(platform);
});
var languageFolders = walkLanguagePaths(resourcePath, platform);
languageFolders.filter(function (langFolder) {
return !excludedLanguages.includes(langFolder);
}).forEach(function (langFolder) {
return rimraf.sync(path.resolve(resourcePath, langFolder));
});
callback();
};
};
{
"name": "electron-packager-languages",
"version": "0.1.0",
"version": "0.3.0",
"main": "dist/index.js",

@@ -10,13 +10,24 @@ "repository": "git@github.com:barinali/electron-packager-languages.git",

"author": "Ali BARIN <ali.barin53@gmail.com>",
"license": "BSD-2-Clause",
"license": "MIT",
"engines": {
"node": ">=4.0.0"
},
"scripts": {
"build": "babel src --out-dir dist",
"test": "node test/specs/main"
"lint": "eslint .",
"prepublish": "npm run build",
"test": "babel-node test/specs/main"
},
"dependencies": {
"rimraf": "^2.6.2"
},
"devDependencies": {
"babel": "^6.23.0",
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"electron-packager": "^10.1.0",
"rimraf": "^2.6.2"
"eslint": "^4.19.1",
"eslint-config-airbnb-base": "^12.1.0",
"eslint-plugin-import": "^2.10.0",
"husky": "^0.15.0-rc.13"
},

@@ -27,6 +38,14 @@ "files": [

"babel": {
"plugins": [
"transform-object-rest-spread"
],
"presets": [
"es2015"
"env"
]
},
"husky": {
"hooks": {
"pre-commit": "npm run lint"
}
}
}
Electron Packager Plugin: Languages
---------------------------
[![GitHub license](https://img.shields.io/github/license/barinali/electron-packager-languages.svg)](https://github.com/barinali/electron-packager-languages/blob/master/LICENSE)
[![Travis CI](https://img.shields.io/travis/barinali/electron-packager-languages.svg)](https://travis-ci.org/barinali/electron-packager-languages/)
[![NPM Download Count](https://img.shields.io/npm/dt/electron-packager-languages.svg)](https://www.npmjs.com/package/electron-packager-languages)
[![Known Vulnerabilities](https://snyk.io/test/github/barinali/electron-packager-languages/badge.svg?targetFile=package.json)](https://snyk.io/test/github/barinali/electron-packager-languages?targetFile=package.json)
# Reason

@@ -20,2 +24,2 @@

})
```
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc