Skip to content

Commit

Permalink
fix more erros
Browse files Browse the repository at this point in the history
  • Loading branch information
weltongbi committed Mar 13, 2021
1 parent ae72063 commit cf08201
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 2,502 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,8 @@ dist

# Mac Folder
.DS_Store

# locks for packages
package-lock.json
yarn.lock

3 changes: 2 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ README.md
tsconfig.json
example
.babelrc
.nyrc.json
.nyrc
.nyc_output
.vscode
yarn.lock
8 changes: 0 additions & 8 deletions .nyrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"git.ignoreLimitWarning": true,
"[typescript, javascript]": {
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true
},
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"scripts": {
"dev": "ts-node-dev --respawn --transpile-only ./src/index.ts",
"build": "rollup -c",
"test": "nyc mocha --config .mocharc.json",
"coverage": "nyc --reporter html npm test"
"test": "mocha --config .mocharc.json",
"coverage": "nyc --reporter=lcov npm test"
},
"browser": "dist/index-browser.js",
"repository": {
Expand All @@ -33,6 +33,9 @@
],
"homepage": "https://postalcode.ws",
"devDependencies": {
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-node-resolve": "^11.2.0",
"@types/chai": "^4.2.15",
"@types/chai-subset": "^1.3.3",
"@types/mocha": "^8.2.1",
Expand All @@ -45,12 +48,10 @@
"nock": "13.0.2",
"nyc": "^15.1.0",
"rollup": "^2.40.0",
"rollup-plugin-commonjs": "10.1.0",
"rollup-plugin-dts": "^3.0.1",
"rollup-plugin-node-resolve": "5.2.0",
"rollup-plugin-replace": "2.2.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"rollup-plugin-uglify": "^6.0.4",
"ts-node": "^9.1.1",
"ts-node-dev": "^1.1.6",
"typescript": "^4.2.3"
Expand Down
30 changes: 23 additions & 7 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import commonjs from "rollup-plugin-commonjs";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import dts from "rollup-plugin-dts";
import resolve from "rollup-plugin-node-resolve";
import replace from "rollup-plugin-replace";
import { terser } from "rollup-plugin-terser";
import typescript from "rollup-plugin-typescript2";
import { uglify } from "rollup-plugin-uglify";

// this override is needed because Module format cjs does not support top-level await
// eslint-disable-next-line @typescript-eslint/no-var-requires
Expand All @@ -30,7 +30,6 @@ export default [
exclude: "node_modules",
ignoreGlobal: true,
}),
uglify(),
],
output: [
{
Expand All @@ -40,6 +39,13 @@ export default [
name: "viacep",
exports: "named",
},
{
file: packageJson.main.replace(".js", ".min.js"),
format: "cjs",
exports: "named",
sourcemap: true,
plugins: [terser()],
},
],
external: Object.keys(globals),
},
Expand All @@ -63,19 +69,29 @@ export default [
resolve({
browser: true,
}),
uglify({}),
],
context: "window",
output: [
{
file: packageJson.browser,
format: "umd", // commonJS
sourcemap: true,
name: "cep",
name: "viacep",
globals: {
unfetch: "fetch",
},
exports: 'named'
exports: "named",
},
{
file: packageJson.browser.replace(".js", ".min.js"),
format: "umd", // commonJS
name: "viacep",
sourcemap: true,
globals: {
unfetch: "fetch",
},
exports: "named",
plugins: [terser()],
},
],
external: Object.keys(globals),
Expand Down

0 comments on commit cf08201

Please sign in to comment.