Skip to content

Commit

Permalink
fix: peer-depend on any version of typescript
Browse files Browse the repository at this point in the history
Closes #604.
  • Loading branch information
mightyiam committed Aug 31, 2021
1 parent bbf7c26 commit 3446e30
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1 || ^5.0.0",
"typescript": "^3.9 || ^4.0.0"
"typescript": "*"
},
"devDependencies": {
"@arkweid/lefthook": "0.7.6",
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ because your decisions regarding version ranges and range specifiers may vary.

```
npm install --save-dev \
typescript@^4 \
typescript@\* \
eslint@^7.12.1 \
eslint-plugin-promise@^5.0.0 \
eslint-plugin-import@^2.22.1 \
Expand Down
12 changes: 9 additions & 3 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,12 @@ test('Dependencies range types', async (t) => {
t.true(range.startsWith(specifier), `Regular dependency ${name} starts with \`${specifier}\`.`)
}
for (const [name, range] of Object.entries(ourPeerDeps)) {
const specifier = '^'
t.true(range.startsWith(specifier), `Peer dependency ${name} starts with \`${specifier}\`.`)
if (name === 'typescript') {
t.is(range, '*', 'Peer dependency typescript is `*`')
} else {
const specifier = '^'
t.true(range.startsWith(specifier), `Peer dependency ${name} starts with \`${specifier}\`.`)
}
}
for (const [name, range] of Object.entries(ourDevDeps)) {
t.regex(range, /^\d/, `Dev dependency ${name} is exact`)
Expand Down Expand Up @@ -247,7 +251,9 @@ test('npm install args in readme satisfy peerDeps', async (t) => {
if (match.length > 2) throw new Error('matched multiple code blocks')
const installArgRanges = Object.fromEntries(
match[1]
.split('\\')
.replace(/\\/g, '')
.trim()
.split('\n')
.slice(1)
.map(arg => {
const { name, fetchSpec: range } = npmPkgArg(arg.trim())
Expand Down

0 comments on commit 3446e30

Please sign in to comment.