Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add dtslint and Cypress static types #1044

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
918 changes: 0 additions & 918 deletions cli/index.d.ts

This file was deleted.

13 changes: 11 additions & 2 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,28 @@
},
"scripts": {
"test": "npm run test-unit",
"test-unit": "bin-up mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json",
"test-unit": "npm run dtslint && bin-up mocha --reporter mocha-multi-reporters --reporter-options configFile=../mocha-reporter-config.json",
"test-watch": "bin-up mocha --watch",
"test-dependencies": "bin-up deps-ok && dependency-check . --no-dev",
"test-debug": "node --inspect --debug-brk $(bin-up _mocha)",
"lint": "bin-up eslint --fix *.js bin/* lib/*.js lib/**/*.js test/*.js test/**/*.js",
"dtslint": "dtslint types",
"prebuild": "npm run test-dependencies && node ./scripts/start-build.js",
"build": "node ./scripts/build.js",
"prerelease": "npm run build",
"release": "cd build && releaser --no-node --no-changelog",
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";"
},
"types": "types",
"dependencies": {
"@cypress/listr-verbose-renderer": "0.4.1",
"@cypress/xvfb": "1.0.4",
"@types/blob-util": "1.3.3",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure these have to be normal dependencies for downstream projects. I haven't actually deployed and linked as devDependencies, but from other testing the types will fail and fallback to any if the types can't be found.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think they will have to be included then.

"@types/bluebird": "3.5.18",
"@types/jquery": "3.2.16",
"@types/lodash": "4.14.87",
"@types/minimatch": "3.0.1",
"@types/sinon": "4.0.0",
"bluebird": "3.5.0",
"chalk": "2.1.0",
"check-more-types": "2.24.0",
Expand Down Expand Up @@ -60,6 +68,7 @@
"chai-string": "1.4.0",
"clear-module": "^2.1.0",
"dependency-check": "^2.8.0",
"dtslint": "0.2.0",
"execa-wrap": "1.1.0",
"nock": "^9.0.9",
"shelljs": "0.7.8",
Expand All @@ -71,6 +80,6 @@
"bin",
"lib",
"index.js",
"index.d.ts"
"types/*.d.ts"
]
}
2 changes: 1 addition & 1 deletion cli/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function preparePackageForNpmRelease (json) {
bugs,
repository,
engines,
types: 'index.d.ts', // typescript types
types: 'types', // typescript types
scripts: {
postinstall: 'node index.js --exec install',
size: 't=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";',
Expand Down
3 changes: 2 additions & 1 deletion cli/scripts/start-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ shell.set('-e') // any error is fatal

shell.rm('-rf', 'build')
shell.mkdir('-p', 'build/bin')
shell.mkdir('-p', 'build/types')
shell.cp('bin/cypress', 'build/bin/cypress')
shell.cp('NPM_README.md', 'build/README.md')
shell.cp('.release.json', 'build/.release.json')
shell.cp('index.d.ts', 'build/index.d.ts')
shell.cp('-R', 'types/*.ts', 'build/types/')

shell.exec('babel lib -d build/lib')
shell.exec('babel index.js -o build/index.js')
13 changes: 13 additions & 0 deletions cli/types/blob-util.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Shim definition to export a namespace. Cypress is actually a global module
// so import/export isn't allowed there. We import here and define a global module
// so that Cypress can get and use the Blob type

// tslint:disable-next-line:no-implicit-dependencies
import * as blobUtil from 'blob-util'

export = BlobUtil
export as namespace BlobUtil

declare namespace BlobUtil {
type BlobUtilStatic = typeof blobUtil
}
11 changes: 11 additions & 0 deletions cli/types/bluebird.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Shim definition to export a namespace. Cypress is actually a global module
// so import/export isn't allowed there. We import here and define a global module
// so that Cypress can get and use the Blob type
import * as BluebirdStatic from 'bluebird'

export = Bluebird
export as namespace Bluebird

declare namespace Bluebird {
type BluebirdStatic = typeof BluebirdStatic
}
Loading