Skip to content

Commit

Permalink
Introduce hoisted builds using Rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
beheh committed Jul 26, 2017
1 parent 25358ff commit ffd317b
Show file tree
Hide file tree
Showing 6 changed files with 1,361 additions and 43 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Webpack configuration for standalone scripts
### Changed
- Hoisted builds using Rollup

## [0.2.0] - 2017-05-31
### Added
Expand Down
24 changes: 16 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,33 @@
"license": "ISC",
"author": "Benedict Etzel <[email protected]>",
"main": "lib/index.js",
"browser": "lib/deckstrings.js",
"repository": {
"type": "git",
"url": "git+https://github.com/HearthSim/npm-deckstrings.git"
},
"scripts": {
"prepublishOnly": "tsc",
"build": "tsc",
"dev": "tsc --watch",
"test": "tsc && mocha"
"prepublishOnly": "rollup -c",
"build": "rollup -c",
"dev": "rollup -cw",
"test": "rollup -c && mocha"
},
"devDependencies": {
"@types/node": "^7.0.22",
"atob": "^2.0.3",
"btoa": "^1.1.2",
"chai": "^4.0.0",
"mocha": "^3.4.2",
"typescript": "^2.3.3"
"rollup": "^0.45.2",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-typescript": "^0.8.1",
"rollup-watch": "^4.3.1",
"typescript": "^2.3.3",
"varint": "^5.0.0"
},
"dependencies": {
"atob": "^2.0.3",
"btoa": "^1.1.2",
"varint": "^5.0.0"
"rollup-plugin-jscc": "^0.3.3"
}
}
44 changes: 44 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import typescript from "rollup-plugin-typescript";
import jscc from "rollup-plugin-jscc";
import pkg from "./package.json";

const plugins = [
typescript({
typescript: require("typescript"),
}),
resolve(),
commonjs(),
];

export default [
{
entry: "src/index.ts",
moduleName: "deckstrings",
dest: pkg.main,
format: "cjs",
plugins: [
jscc({
values: {
_PLATFORM: "node",
},
extensions: [".js", ".ts"],
})
].concat(plugins),
},
{
entry: "src/index.ts",
moduleName: "deckstrings",
dest: pkg.browser,
format: "iife",
plugins: [
jscc({
values: {
_PLATFORM: "web",
},
extensions: [".js", ".ts"],
})
].concat(plugins),
},
];
8 changes: 5 additions & 3 deletions src/buffer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import * as varint from "varint";
import * as atob from "atob";
import * as btoa from "btoa";
import varint from "varint";
//#if _PLATFORM == "node"
import atob from "atob";
import btoa from "btoa";
//#endif

/** @internal */
export class Iterator {
Expand Down
13 changes: 0 additions & 13 deletions webpack.config.js

This file was deleted.

Loading

0 comments on commit ffd317b

Please sign in to comment.