Skip to content

Commit 733c237

Browse files
committed
release: v0.0.4
1 parent bc8152c commit 733c237

File tree

6 files changed

+65
-19
lines changed

6 files changed

+65
-19
lines changed

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ jobs:
2828
node-version: 14
2929
registry-url: https://registry.npmjs.org/
3030
- run: npm ci
31-
- run: npm run build
32-
- run: npm publish --access public
31+
- run: npm publish dist --access public
3332
env:
3433
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,34 @@
11
# @nkp/error
22

3-
Coerce an unknown error into an instance of the Error class
3+
[![npm version](https://badge.fury.io/js/%40nkp%2Ferror.svg)](https://badge.fury.io/js/%40nkp%2Ferror)
4+
[![Node.js Package](https://github.com/NickKelly1/nkp-error/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/NickKelly1/nkp-error/actions/workflows/npm-publish.yml)
5+
![snyk](https://snyk-widget.herokuapp.com/badge/npm/%40nkp%2Ferror/badge.svg)
46

5-
## Examples
7+
Coerce an unknown error into an instance of the Error class.
8+
9+
## Installation
10+
11+
This package exports as CommonJS (default), ES Modules, and UMD.
12+
13+
For ES Modules and tree shaking use a bundler that supports ES modules such as [rollup](https://rollupjs.org/guide/en/) or [webpack](https://webpack.js.org/).
14+
15+
### With npm
16+
17+
```sh
18+
npm install @nkp/error
19+
```
20+
21+
### With script tags
22+
23+
```html
24+
<head>
25+
<!-- insert your desired version -->
26+
<script src="https://unpkg.com/browse/@nkp/[email protected]/"></script>
27+
</head>
28+
29+
```
30+
31+
## Usage
632

733
```ts
834
try {
@@ -26,12 +52,12 @@ catch(error) { assert(typeof error === 'string')
2652
2753
in this case, since a `string` is thrown and not an `Error` instance, there is no way to obtain the stack trace from the thrown point. Instead, `coerceError` will start the stack trace in the `catch` block.
2854
29-
## Releasing a new version
55+
## Publishing
3056
3157
To a release a new version:
3258
3359
1. Update the version number in package.json
3460
2. Push the new version to the `master` branch on GitHub
3561
3. Create a `new release` on GitHub for the latest version
3662
37-
This will trigger a GitHub action that tests and publishes the npm package.
63+
A GitHub action will test and publishes the npm package. Note, the `dist` folder is published.

changelog.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## 0.0.4 - 2021-06-29
4+
5+
### Added
6+
7+
- UMD exports
8+
9+
### Changed
10+
11+
- Instead of the root folder, the `dist` folder is now published. The published project structure is now:
12+
- d: dist (published)
13+
- f: LICENSE
14+
- f: package.json
15+
- d: es (project as es modules)
16+
- d: cjs (project as cjs)
17+
- d: umd (project as umd)
18+
- Updated readme with badges and more information.
19+
- Temporarily disabled terser rollup plugin. Builds will temporarily not minified.
20+
321
## 0.0.2 - 2021-06-29
422

523
Re-release

config/rollup.config.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,29 @@ export default [
1212
input: 'src/index.ts',
1313
output: [
1414
{
15-
file: packageJson.main,
15+
file: `dist/${packageJson.main}`,
1616
format: 'cjs',
1717
sourcemap: true,
1818
},
1919
{
20-
file: packageJson.module,
20+
file: `dist/${packageJson.module}`,
2121
format: 'es',
2222
exports: 'named',
2323
sourcemap: true,
2424
},
25+
{
26+
name: '$nkp',
27+
file: `dist/${packageJson.umd}`,
28+
format: 'umd',
29+
sourcemap: true,
30+
},
2531
],
2632
plugins: [
2733
peerDepsExternal(),
2834
resolve(),
2935
commonjs(),
3036
typescript({ tsconfig: 'config/tsconfig.build.json', }),
31-
terser(),
37+
// terser(),
3238
],
3339
},
3440
];

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "@nkp/error",
3-
"version": "0.0.2",
3+
"version": "0.0.4",
44
"description": "Coerce an unknown error into an instance of the JavaScript Error class",
5-
"main": "dist/index.js",
6-
"module": "dist/index.es.js",
5+
"main": "cjs/index.js",
6+
"module": "es/index.js",
7+
"umd": "umd/index.js",
78
"author": "Nick Kelly",
89
"homepage": "https://github.com/NickKelly1/nkp-error#readme",
910
"readme": "https://github.com/NickKelly1/nkp-error#readme",
@@ -20,15 +21,11 @@
2021
"TypeScript",
2122
"JavaScript"
2223
],
23-
"files": [
24-
"dist",
25-
"LICENSE"
26-
],
2724
"scripts": {
2825
"test": "jest -c config/jest.config.ts",
2926
"build": "rimraf dist && rollup -c config/rollup.config.js",
3027
"test:watch": "jest -c config/jest.config.ts --watch",
31-
"prepublishOnly": "npm run build"
28+
"prepublishOnly": "npm run build && cp package.json dist/ && cp LICENSE dist/"
3229
},
3330
"devDependencies": {
3431
"@jest/types": "^26.6.2",

0 commit comments

Comments
 (0)