Skip to content

Commit 9fee16e

Browse files
sverweijpzavolinsky
authored andcommitted
Makes TypeScript a peer dependency
- Moves typescript from a regular to a development dependency - Declares typescript as a (mandatory) peer dependency, taking the current ^-version as the minimum - Expands the travis ci config so it runs against typescript 3 and 4 - Updates the Dockerfile so it installs typescript (latest) after the npm ci. - Also: adds an .npmrc to make sure the current npm installation & upgrade policies (^, package-lock, if I inferred correctly) are respected on machines that have a global override for these.
1 parent 33cb0f7 commit 9fee16e

7 files changed

+29
-6
lines changed

.npmrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package-lock=true
2+
save-exact=false
3+
save-prefix=^

.travis.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ node_js:
44
- 12
55
- 14
66
# TODO - 16 when it is released
7+
env:
8+
- TYPESCRIPT_VERSION=3
9+
- TYPESCRIPT_VERSION=4
710
notifications:
8-
email: false
11+
email: false
912
script:
13+
- npm install --development typescript@$TYPESCRIPT_VERSION
1014
- npm test
1115
after_success:
1216
- npm run report-coverage-to-coveralls

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
- if 0 issues (0 modules with unused exports) then use the default color. (Issue #164)
1616
- Add an option to stop writing to stdout on success: --silent
17+
- BREAKING CHANGE: Makes TypeScript a peer dependency (Issue #159)
18+
Migration path:
19+
If you already have a version of the TypeScript compiler installed in the same spot as ts-unused-exports no migration steps are necessary (it will work out of the box).
20+
Otherwise you'll have to install the TypeScript compiler there yourself (e.g. with `npm i -D typescript`).
1721

1822
## [6.2.4] - 14 Sep 2020
1923

@@ -52,7 +56,7 @@
5256
### Added
5357

5458
- Handle dynamic imports within a TSX div or fragment
55-
- Add basic support for export * as namespace.
59+
- Add basic support for export \* as namespace.
5660

5761
## [6.1.2] - 1 Apr 2020
5862

Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ RUN apk add bash
77
COPY ["package.json", "package-lock.json", "/usr/src/"]
88

99
RUN CI=1 npm ci
10+
RUN npm install --development typescript
1011

1112
COPY [".*", "*.json", "/usr/src/"]
1213
COPY ["bin/", "/usr/src/bin/"]

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Note that if `ts-unused-exports` is called without files, the files will be read
7373

7474
`ts-unused-exports` also resolves path aliases specified in tsconfig's `paths` object.
7575

76+
As of version 7.0.0 the TypeScript compiler is a _peer dependency_ of `ts-unused-exports`. This means that if the TypeScript compiler is not already in the same spot as `ts-unused-exports`, you have to install it yourself (e.g. with `npm i -D typescript`).
77+
7678
## Why should I use this?
7779

7880
If you've ever used `tslint`'s [no-unused-variable](http://palantir.github.io/tslint/rules/no-unused-variable/) rule you already known how awesome it is. What this rule does is detect code in your modules that is not being used so that you can remove it.

package-lock.json

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+11-3
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,19 @@
5050
"nyc": "^15.0.0",
5151
"pickled-cucumber": "^2.0.14",
5252
"prettier": "^1.19.1",
53-
"ts-node": "^8.8.1"
53+
"ts-node": "^8.8.1",
54+
"typescript": "^3.8.3"
5455
},
5556
"dependencies": {
5657
"chalk": "^3.0.0",
57-
"tsconfig-paths": "^3.9.0",
58-
"typescript": "^3.8.3"
58+
"tsconfig-paths": "^3.9.0"
59+
},
60+
"peerDependencies": {
61+
"typescript": ">=3.8.3"
62+
},
63+
"peerDependenciesMeta": {
64+
"typescript": {
65+
"optional": false
66+
}
5967
}
6068
}

0 commit comments

Comments
 (0)