Skip to content

Commit

Permalink
Update rollup, rollup.config.js and typescript.
Browse files Browse the repository at this point in the history
  • Loading branch information
NaridaL committed Dec 16, 2020
1 parent 56be5f6 commit 2539ff7
Show file tree
Hide file tree
Showing 4 changed files with 195 additions and 240 deletions.
2 changes: 1 addition & 1 deletion gendoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ function Type(type: any) {
const sig = type.declaration.signatures[0]
return (
<>
{type.inUnion && "("}(<Parameters of={sig.parameters} />) =>{" "}
{type.inUnion && "("}(<Parameters of={sig.parameters} />) =&gt;{" "}
<Type {...sig.type} />
{type.inUnion && ")"}
</>
Expand Down
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "serializr",
"version": "2.0.4",
"description": "Serialize and deserialize complex object graphs to JSON",
"main": "lib/serializr.js",
"module": "lib/es/serializr.js",
"main": "lib/serializr.umd.js",
"module": "lib/serializr.es.js",
"typings": "lib/serializr.d.ts",
"scripts": {
"test": "nyc --reporter lcov tape test/*.js",
Expand Down Expand Up @@ -52,8 +52,7 @@
"@babel/plugin-proposal-class-properties": "^7.3.0",
"@babel/plugin-proposal-decorators": "^7.3.0",
"@babel/preset-env": "^7.3.1",
"@rollup/plugin-commonjs": "^11.0.2",
"@rollup/plugin-node-resolve": "^7.1.0",
"@rollup/plugin-typescript": "^8.1.0",
"@types/react": "^16.9.19",
"@types/react-dom": "^16.9.5",
"@types/tape": "^4.2.33",
Expand All @@ -71,15 +70,14 @@
"react-dom": "^16.12.0",
"react-markdown": "^4.3.1",
"rimraf": "^3.0.1",
"rollup": "^1.1.2",
"rollup-plugin-terser": "^5.2.0",
"rollup-plugin-typescript2": "^0.25.3",
"rollup": "^2.35.1",
"rollup-plugin-terser": "^7.0.2",
"tape": "^4.9.2",
"ts-node": "^8.6.2",
"turndown": "^5.0.3",
"turndown-plugin-gfm": "^1.0.2",
"typedoc": "^0.17.0-3",
"typescript": "^3.3.3",
"typedoc": "0.17.0-3",
"typescript": "^4.1.3",
"unescape": "^1.0.1"
},
"dependencies": {}
Expand Down
68 changes: 27 additions & 41 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,25 @@
import typescriptPlugin from "rollup-plugin-typescript2"
import typescriptPlugin from "@rollup/plugin-typescript"
import typescript from "typescript"
import { terser } from "rollup-plugin-terser"

const LICENSE = "/** serializr - (c) Michel Weststrate 2016 - MIT Licensed */"

function config(format /* : "umd" | "es" */, compress /*: boolean */) {
return {
input: "src/serializr.ts",
output: [
{
format: format,
file:
"lib/" +
(format === "umd" ? "" : "es/") +
"serializr" +
(compress ? ".min" : "") +
".js",
sourcemap: true,
name: "serializr",
exports: "named"
}
],
plugins: [
typescriptPlugin({
typescript,
tsconfig: __dirname + "/tsconfig.json",
abortOnError: false,
exclude: [], // don't exclude .d.ts files
tsconfigOverride: {
compilerOptions: {
}
},
useTsconfigDeclarationDir: true
}),
compress &&
export default {
input: "src/serializr.ts",
output: [
["es", false],
["es", true],
["umd", false],
["umd", true],
].map(([format, compress]) => ({
format: format,
entryFileNames: "[name].[format]" + (compress ? ".min" : "") + ".js",
sourcemap: true,
dir: "lib",
name: "serializr",
exports: "named",
plugins: compress
? [
terser({
compress: {
passes: 3,
Expand All @@ -48,14 +34,14 @@ function config(format /* : "umd" | "es" */, compress /*: boolean */) {
output: {
preamble: LICENSE
}
})
].filter(x => x),
onwarn: function(warning, warn) {
if ("THIS_IS_UNDEFINED" === warning.code) return
// if ('CIRCULAR_DEPENDENCY' === warning.code) return
warn(warning)
}
}
}),
]
: [],
})),
plugins: [typescriptPlugin({ typescript })],
onwarn: function (warning, warn) {
if ("THIS_IS_UNDEFINED" === warning.code) return
// if ('CIRCULAR_DEPENDENCY' === warning.code) return
warn(warning)
},
}

export default [config("es", false), config("es", true), config("umd", false), config("umd", true)]
Loading

0 comments on commit 2539ff7

Please sign in to comment.