Skip to content

Commit

Permalink
Rewrite index.js in TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Mar 21, 2019
1 parent 7cecf07 commit 5dac30d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -51,21 +51,21 @@
"to-readable-stream": "^2.0.0"
},
"devDependencies": {
"@sindresorhus/tsconfig": "^0.2.1",
"@sindresorhus/tsconfig": "^0.3.0",
"@types/duplexer3": "^0.1.0",
"@types/node": "^11.11.0",
"@typescript-eslint/eslint-plugin": "1.4.2",
"@typescript-eslint/eslint-plugin": "^1.5.0",
"ava": "^1.3.1",
"coveralls": "^3.0.0",
"del-cli": "^1.1.0",
"delay": "^4.1.0",
"eslint-config-xo-typescript": "^0.8.0",
"eslint-config-xo-typescript": "^0.9.0",
"form-data": "^2.3.3",
"get-port": "^4.0.0",
"nock": "^10.0.6",
"np": "^4.0.2",
"nyc": "^13.1.0",
"p-event": "^3.0.0",
"p-event": "^4.0.0",
"pem": "^1.14.1",
"proxyquire": "^2.0.1",
"sinon": "^7.2.2",
Expand Down
10 changes: 5 additions & 5 deletions source/index.js → source/index.ts
@@ -1,6 +1,5 @@
'use strict';
const pkg = require('../package.json');
const create = require('./create');
import packageJson from '../package.json';
import create from './create';

const defaults = {
options: {
Expand Down Expand Up @@ -35,7 +34,7 @@ const defaults = {
]
},
headers: {
'user-agent': `${pkg.name}/${pkg.version} (https://github.com/sindresorhus/got)`
'user-agent': `${packageJson.name}/${packageJson.version} (https://github.com/sindresorhus/got)`
},
hooks: {
beforeRequest: [],
Expand All @@ -58,4 +57,5 @@ const defaults = {

const got = create(defaults);

module.exports = got;
module.exports = got; // For CommonJS default export support
export default got;
2 changes: 1 addition & 1 deletion tsconfig.json
Expand Up @@ -2,7 +2,7 @@
"extends": "@sindresorhus/tsconfig",
"compilerOptions": {
"outDir": "dist",
"target": "es2017",
"target": "es2017", // Node.js 8

// TODO: Remove these when everything has been converted to TS
"allowJs": true,
Expand Down

0 comments on commit 5dac30d

Please sign in to comment.