Skip to content

Commit

Permalink
build: set up and document build and release scripts
Browse files Browse the repository at this point in the history
Since we have a build step now we must point the package.json file
reference to the dist folder and must explicitly list all files that we
want to be included in the npm tarball.

The initial idea was to prepare the contents of the final npm tarball
all in the dist directory (including a copy of the package.json) but
that turns out not to work particularly well with standard-version which
is used to manage the version numbers and changelog.

Unfortunately this change also required a small workaround to allow
local installation of the uuid module in the examples (see .local/).

Also instructions for relasing a new version have not yet been
documented which is finally done here.

Since we now explicitly list all files to be included in the tarball
through the files property of package.json we no longer need the
.npmignore file.
  • Loading branch information
ctavan committed Jan 21, 2020
1 parent 06436a7 commit fd69d1b
Show file tree
Hide file tree
Showing 17 changed files with 242 additions and 190 deletions.
9 changes: 9 additions & 0 deletions .local/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Local Fake Module for Testing

This is a local fake module for use in the [examples](../examples) and browser tests (that are
based on the examples) where we reference the `uuid` module with a local `file:` path in the
respective `package.json` files.

We must ensure that the local module does not contain locally installed dev dependencies in a
`node_modules` hence this "fake module" that just consists of symbolic links and imitates the final
contents of the npm tarball.
1 change: 1 addition & 0 deletions .local/dist
1 change: 1 addition & 0 deletions .local/package.json
7 changes: 0 additions & 7 deletions .npmignore

This file was deleted.

20 changes: 20 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Contributing

Please feel free to file GitHub Issues or propose Pull Requests. We're always happy to discuss
improvements to this library!

## Testing

```shell
npm test
```

## Releasing

Releases are supposed to be done from master, version bumping is automated through
[`standard-version`](https://github.com/conventional-changelog/standard-version):

```shell
npm run release -- --dry-run # verify output manually
npm run release # follow the instructions from the output of this command
```
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,5 @@ $ uuid v1

Type `uuid --help` for usage details

## Testing

```shell
npm test
```

----
Markdown generated from [README_js.md](README_js.md) by [![RunMD Logo](http://i.imgur.com/h0FVyzU.png)](https://github.com/broofa/runmd)
6 changes: 0 additions & 6 deletions README_js.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,3 @@ $ uuid v1
```

Type `uuid --help` for usage details

## Testing

```shell
npm test
```
2 changes: 1 addition & 1 deletion examples/browser-esmodules/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/browser-esmodules/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"start": "npm run build && npx http-server . -o"
},
"dependencies": {
"uuid": "file:../../dist"
"uuid": "file:../../.local"
}
}
26 changes: 13 additions & 13 deletions examples/browser-rollup/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/browser-rollup/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start": "npm run build && npx http-server . -o"
},
"dependencies": {
"uuid": "file:../../dist"
"uuid": "file:../../.local"
},
"devDependencies": {
"rollup": "^1.24.0",
Expand Down

0 comments on commit fd69d1b

Please sign in to comment.