Skip to content

Commit

Permalink
Merge pull request #141 from Esri/patch135
Browse files Browse the repository at this point in the history
chore(rollup): bump to the latest version of rollup
  • Loading branch information
jgravois authored Mar 3, 2018
2 parents 1da932d + 302fa85 commit f4411c3
Show file tree
Hide file tree
Showing 10 changed files with 315 additions and 174 deletions.
410 changes: 263 additions & 147 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@
"prettier": "^1.9.2",
"resolve": "^1.5.0",
"rimraf": "^2.6.2",
"rollup": "^0.45.2",
"rollup": "^0.53.4",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-filesize": "^1.5.0",
"rollup-plugin-json": "^2.3.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-node-resolve": "^3.0.3",
"rollup-plugin-typescript2": "^0.4.6",
"rollup-plugin-uglify": "^2.0.1",
"rollup-plugin-uglify": "^3.0.0",
"shelljs": "^0.7.8",
"slug": "^0.9.1",
"ts-node": "^3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"prebuild": "rimraf dist",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc --module commonjs --outDir ./dist/node"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-feature-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"prepare": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-geocoder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"prepare": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-groups/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"prepare": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-items/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"prepare": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc -p ./tsconfig.json --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc -p ./tsconfig.json --module commonjs --outDir ./dist/node"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/arcgis-rest-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"prepare": "npm run build",
"build": "npm run build:node && npm run build:umd && npm run build:esm",
"build:esm": "tsc --module es2015 --outDir ./dist/esm --declaration",
"build:umd": "rollup -c ../../rollup.config.umd.js",
"build:umd": "rollup -c ../../umd-base-profile.js && rollup -c ../../umd-production-profile.js",
"build:node": "tsc --module commonjs --outDir ./dist/node"
},
"publishConfig": {
Expand Down
47 changes: 29 additions & 18 deletions rollup.config.umd.js → umd-base-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,34 @@ import typescript from "rollup-plugin-typescript2";
import resolve from "rollup-plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import json from "rollup-plugin-json";
import uglify from "rollup-plugin-uglify";
import filesize from "rollup-plugin-filesize";

const path = require("path");
const fs = require("fs");
const _ = require("lodash");

/**
* The module name will be the name of the global variable used in UMD builds.
* All exported members of each package will be attached to this global.
* Since Rollup runs inside each package we can just get the current
* package we are bundling.
*/
const moduleName = "arcgisRest";
const pkg = require(path.join(process.cwd(), "package.json"));

/**
* Since Rollup runs inside each package we can just get the name of the current
* package we are bundling.
* and dig out its name.
*/
const { name } = pkg;

/**
* to construct a copyright banner
*/
const { name } = require(path.join(process.cwd(), "package.json"));
const copyright = '/* ' + pkg.name + ' - v' + pkg.version + ' - ' + new Date().toString() + '\n' +
' * Copyright (c) ' + new Date().getFullYear() + ' Environmental Systems Research Institute, Inc.\n' +
' * ' + pkg.license + ' */';

/**
* The module name will be the name of the global variable used in UMD builds.
* All exported members of each package will be attached to this global.
*/
const moduleName = "arcgisRest";

/**
* Now we need to discover all the `@esri/arcgis-rest-*` package names so we can create
Expand Down Expand Up @@ -47,21 +57,22 @@ const globals = packageNames.reduce((globals, p) => {
* Now we can export the Rollup config!
*/
export default {
entry: "./src/index.ts",
dest: `./dist/umd/${name.replace("@esri/", "")}.umd.js`,
format: "umd",
sourceMap: true,
input: "./src/index.ts",
output: {
file: `./dist/umd/${name.replace("@esri/", "")}.umd.js`,
sourcemap: `./dist/umd/${name.replace("@esri/", "")}.umd.js.map`,
banner: copyright,
format: "umd",
name: moduleName,
globals,
extend: true // causes this module to extend the global specified by `moduleName`
},
context: "window",
extend: true, // causes this module to extend the global specified by `moduleName`
moduleName,
external: packageNames,
globals,
plugins: [
typescript(),
json(),
resolve(),
commonjs(),
uglify(),
filesize()
commonjs()
]
};
14 changes: 14 additions & 0 deletions umd-production-profile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import config from './umd-base-profile.js';
import uglify from "rollup-plugin-uglify";
import filesize from "rollup-plugin-filesize";

// remove 'debug' from the unminified UMD filename and sourcemap
config.output.file = config.output.file.replace(".umd.", ".umd.min.");
config.output.sourcemap = config.output.sourcemap.replace(".umd.", ".umd.min.");

config.plugins.push(filesize())
config.plugins.push(uglify({
output: {comments: /Institute, Inc/}
}))

export default config;

0 comments on commit f4411c3

Please sign in to comment.