Socket
Socket
Sign inDemoInstall

@geoapps/libbuilder

Package Overview
Dependencies
271
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.2 to 0.3.0

5

bin/cli.js

@@ -61,2 +61,6 @@ #!/usr/bin/env node

})
.option('external-file-name', {
describe: 'Relative path to JSON file describing external modules for Rollup',
type: 'string'
})
.option('watch', {

@@ -82,2 +86,3 @@ describe: 'Watch and rebuild on changes',

.default('globals-file-name', 'rollup.globals.json')
.default('external-file-name', 'rollup.external.json')
.default('watch', false)

@@ -84,0 +89,0 @@ .default('verbose', false);

4

CHANGELOG.md
## Changelog
### 0.3.0 (2019-02-19)
- JSON file with custom external modules for ES is supported.
### 0.2.2 (2019-02-18)

@@ -4,0 +8,0 @@

33

lib/getRollupConfig.js
const path = require('path');
const fs = require('fs');
const jsonfile = require('jsonfile');

@@ -28,2 +29,3 @@ const babel = require('rollup-plugin-babel');

* @param {String} [options.globalsFileName=rollup.globals.json] Relative path to JSON file describing globals for Rollup
* @param {String} [options.externalFileName=rollup.external.json] Relative path to JSON file describing external modules for Rollup
* @returns {Promise<Object>}

@@ -50,3 +52,4 @@ */

formats = ['es', 'umd'],
globalsFileName = 'rollup.globals.json'
globalsFileName = 'rollup.globals.json',
externalFileName = 'rollup.external.json'
} = options;

@@ -61,2 +64,3 @@

const globalsFilePath = path.resolve(baseDirPath, globalsFileName);
const externalFilePath = path.resolve(baseDirPath, externalFileName);

@@ -71,8 +75,20 @@ let packageJson;

let globals;
try {
globals = await jsonfile.readFile(globalsFilePath);
let globals = {};
if (fs.existsSync(globalsFilePath)) {
try {
globals = await jsonfile.readFile(globalsFilePath);
}
catch (e) {
return Promise.reject(`Unable to parse "${globalsFilePath}".`);
}
}
catch (e) {
return Promise.reject(`Unable to parse "${globalsFilePath}".`);
let customExternal = [];
if (fs.existsSync(externalFilePath)) {
try {
customExternal = await jsonfile.readFile(externalFilePath);
}
catch (e) {
return Promise.reject(`Unable to parse "${externalFilePath}".`);
}
}

@@ -122,3 +138,6 @@

outputFilePath = path.resolve(outputDirPath, `${packageName}${outputEsExtensionPrefix}.js`);
external = [].concat(Object.keys(packageDependencies)).concat(Object.keys(packagePeerDependencies));
external = []
.concat(Object.keys(packageDependencies))
.concat(Object.keys(packagePeerDependencies))
.concat(customExternal);
break;

@@ -125,0 +144,0 @@ }

@@ -29,2 +29,3 @@ const path = require('path');

* @param {String} [options.globalsFileName=rollup.globals.json] Relative path to JSON file describing globals for Rollup
* @param {String} [options.externalFileName=rollup.external.json] Relative path to JSON file describing external modules for Rollup
* @param {Boolean} [options.transpile=true]

@@ -142,3 +143,5 @@ * @param {Boolean} [options.watch=false] Watch and rebuild on changes

console.error(`${chalk.red.bold(`[ ${buildName} ]:`)} Error is occurred.`);
console.error(`${chalk.red(`[ ${buildName} ]:`)} ${JSON.stringify(event.error)}.`);
const stringified = JSON.stringify(event.error);
const message = stringified !== '{}' ? stringified : event.error;
console.error(`${chalk.red(`[ ${buildName} ]:`)} ${message}.`);
}

@@ -145,0 +148,0 @@ });

{
"name": "@geoapps/libbuilder",
"version": "0.2.2",
"version": "0.3.0",
"description": "Build application ES compatible library with Rollup",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -56,3 +56,5 @@ # @geoapps/libbuilder

- `--globals-file-name` (`globalsFileName`) Relative path to JSON file describing globals for Rollup (default is
`rollup.globals.json`).
`rollup.globals.json`).
- `--external-file-name` (`externalFileName`) Relative path to JSON file describing external modules for Rollup
(default is `rollup.external.json`).
- `--watch` (`watch`) Watch and rebuild on changes (default is `false`).

@@ -59,0 +61,0 @@ - `--verbose` (`verbose`) Verbose mode (default is `false`).

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc