Skip to content

Commit 3a437cb

Browse files
authored
chore: move tests to root folder, extract global types (#56)
* chore: change outDir to dist * chore: rename source file * chore: extract global types to ambient type file * chore: move tests to root folder * chore(examples): bump deps * chore: delete CODEOWNERS * chore: simplify gitignore * chore: create prettierignore * chore: format changelog * chore: delete v0.3.0 docs * docs: add npm, pnpm install commands
1 parent 05410ba commit 3a437cb

29 files changed

Lines changed: 561 additions & 550 deletions

.gitignore

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
.DS_Store
2-
/.vscode
3-
/lib
4-
/node_modules
5-
/src/tests/__fixtures__/processed
6-
yarn-debug.log*
7-
yarn-error.log*
2+
dist
3+
node_modules
4+
tests/__fixtures__/processed

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
original
2+
processed

CHANGELOG.md

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [1.2.2](https://github.com/metonym/posthtml-hash/releases/tag/v1.2.2) - 2020-11-25
1111

12-
- republish
12+
- Republish
1313

1414
## [1.2.1](https://github.com/metonym/posthtml-hash/releases/tag/v1.2.1) - 2020-11-25
1515

16-
- fix: use previously hashed file name if it exists
16+
- Use previously hashed file name if it exists
1717

1818
## [1.2.0](https://github.com/metonym/posthtml-hash/releases/tag/v1.2.0) - 2020-11-25
1919

@@ -22,21 +22,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222

2323
## [1.1.1](https://github.com/metonym/posthtml-hash/releases/tag/v1.1.1) - 2020-07-16
2424

25-
- Update README, add custom hash to the `examples` folder
26-
27-
- Bump development dependencies
25+
- Update README, add custom hash example
2826

2927
## [1.1.0](https://github.com/metonym/posthtml-hash/releases/tag/v1.1.0) - 2020-07-16
3028

3129
- Add custom `pattern` option for matching file names
32-
3330
- Add `hashLength` option to override default hash length
3431

3532
## [1.0.0](https://github.com/metonym/posthtml-hash/releases/tag/v1.0.0) - 2020-05-09
3633

37-
- Refactor API to only hash files with `[hash]` in the file name (hash length is adjustable with the pattern `[hash:${length}]`)
38-
39-
- Replace `jest` with Node.js native `assert` (removes ~250k sub-dependencies)
34+
- Refactor API to only hash files with `[hash]` in the file name; hash length is adjustable with the pattern `[hash:${length}]`
4035

4136
## [0.3.0](https://github.com/metonym/posthtml-hash/releases/tag/v0.3.0) - 2020-05-04
4237

@@ -49,17 +44,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4944

5045
## [0.2.2](https://github.com/metonym/posthtml-hash/releases/tag/v0.2.2) - 2019-10-17
5146

52-
- Upgrade posthtml version from 0.11.16 to 0.12.0
53-
54-
- Upgrade hasha from 5.0.0 to 5.1.0
55-
56-
- Upgrade development dependencies (@types/jest, husky, prett-quick)
47+
- Upgrade `posthtml` from 0.11.16 to 0.12.0
48+
- Upgrade `hasha` from 5.0.0 to 5.1.0
5749

5850
## [0.2.1](https://github.com/metonym/posthtml-hash/releases/tag/v0.2.1) - 2019-09-21
5951

60-
- Upgrade posthtml version from 0.11.15 to 0.11.16
61-
62-
- Refactor typings
52+
- Upgrade `posthtml` from 0.11.15 to 0.11.16
53+
- Refactor type definitions
6354

6455
## [0.2.0](https://github.com/metonym/posthtml-hash/releases/tag/v0.2.0) - 2019-08-26
6556

CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@
2020
## Install
2121

2222
```bash
23+
# Yarn
2324
yarn add -D posthtml-hash
24-
# OR
25+
26+
# npm
2527
npm i -D posthtml-hash
28+
29+
# pnpm
30+
pnpm i -D posthtml-hash
2631
```
2732

2833
## Usage

docs/v0.3.0.md

Lines changed: 0 additions & 97 deletions
This file was deleted.

examples/basic/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

examples/basic/clean.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fs = require('fs-extra');
1+
const fs = require("fs-extra");
22

3-
fs.removeSync('processed');
4-
fs.copySync('original', 'processed');
3+
fs.removeSync("processed");
4+
fs.copySync("original", "processed");

examples/basic/package.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
{
2-
"name": "basic",
3-
"version": "1.0.0",
4-
"main": "script.js",
52
"private": true,
63
"scripts": {
74
"clean": "node clean.js",
85
"hash": "node script.js"
96
},
107
"devDependencies": {
11-
"fs-extra": "^9.0.0",
12-
"posthtml": "^0.13.0",
13-
"posthtml-hash": "../../"
8+
"fs-extra": "^10.1.0",
9+
"posthtml": "^0.16.6",
10+
"posthtml-hash": "^1.2.2"
1411
}
1512
}

examples/basic/script.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
const fs = require('fs');
2-
const posthtml = require('posthtml');
3-
const { hash } = require('posthtml-hash');
1+
const fs = require("fs");
2+
const posthtml = require("posthtml");
3+
const { hash } = require("posthtml-hash");
44

5-
const html = fs.readFileSync('./processed/index.html');
5+
const html = fs.readFileSync("./processed/index.html");
66

77
posthtml()
8-
.use(hash({ path: 'processed' }))
8+
.use(hash({ path: "processed" }))
99
.process(html)
10-
.then(result => fs.writeFileSync('./processed/index.html', result.html));
10+
.then((result) => fs.writeFileSync("./processed/index.html", result.html));

0 commit comments

Comments
 (0)