Skip to content

Commit

Permalink
feat(all packages): start shipping an unminified UMD for each package
Browse files Browse the repository at this point in the history
AFFECTS PACKAGES:
@esri/arcgis-rest-auth
@esri/arcgis-rest-feature-service
@esri/arcgis-rest-geocoder
@esri/arcgis-rest-groups
@esri/arcgis-rest-items
@esri/arcgis-rest-request

ISSUES CLOSED: #135
  • Loading branch information
jgravois committed Mar 3, 2018
1 parent b22a262 commit 52043f5
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 15 deletions.
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
14 changes: 5 additions & 9 deletions rollup.config.umd.js → umd-base-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ 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");
Expand Down Expand Up @@ -60,23 +58,21 @@ const globals = packageNames.reduce((globals, p) => {
*/
export default {
input: "./src/index.ts",
output: [{
file: `./dist/umd/${name.replace("@esri/", "")}.umd.js`,
sourcemap: `./dist/umd/${name.replace("@esri/", "")}.umd.js.map`,
output: {
file: `./dist/umd/${name.replace("@esri/", "")}.debug.umd.js`,
sourcemap: `./dist/umd/${name.replace("@esri/", "")}.debug.umd.js.map`,
banner: copyright,
format: "umd",
name: moduleName,
globals,
extend: true // causes this module to extend the global specified by `moduleName`
}],
},
context: "window",
external: packageNames,
plugins: [
typescript(),
json(),
resolve(),
commonjs(),
uglify({ output: {comments: /Institute, Inc/} }),
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(".debug.umd.", ".umd.");
config.output.sourcemap = config.output.sourcemap.replace(".debug.umd.", ".umd.");

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

export default config;

0 comments on commit 52043f5

Please sign in to comment.