Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Repo setup #6

Merged
merged 5 commits into from
Apr 16, 2019
Merged

Repo setup #6

merged 5 commits into from
Apr 16, 2019

Conversation

michielbdejong
Copy link
Contributor

No description provided.

Copy link
Contributor

@jaxoncreed jaxoncreed left a comment

Choose a reason for hiding this comment

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

Looks good to me :shipit:

src/server.ts Outdated
import Debug from 'debug'

const debug = Debug('server')
const port = 8080
Copy link
Contributor

Choose a reason for hiding this comment

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

const port = process.env.PORT || 8080

Choose a reason for hiding this comment

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

Or better yet: make Server a class so it is testable; and 8080 is a default for its parameters. Classes should not depend on process variables, that's up to the script wiring up things.

src/server.ts Outdated
import Debug from 'debug'

const debug = Debug('server')
const port = 8080

Choose a reason for hiding this comment

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

Or better yet: make Server a class so it is testable; and 8080 is a default for its parameters. Classes should not depend on process variables, that's up to the script wiring up things.

tsconfig.json Outdated
{
"env": "node",
"compilerOptions": {
"target": "es6",

Choose a reason for hiding this comment

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

Use es2015 rather than es6 (that name was abandoned a long while ago)

tsconfig.json Outdated
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": false,

Choose a reason for hiding this comment

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

I'd recommend to keep the TypeScript compiler as strict as possible from the start of the project. I'll be easier that way. Making it stricter later on will prove difficult.

Most of the time, it isn't that hard to be explicit about types and to limit the use of "any"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

"debug": "^4.1.1"
},
"devDependencies": {
"@types/chai": "^4.1.7",

Choose a reason for hiding this comment

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

I don't know how you feel about this, but I'd advise against using ^ or ~ for version ranges. I love semver, but third-party developers can rarely be trusted to respect it systematically. For stability, keeping stricter control is usually nicer and avoid surprises.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

isn't that handled by package-lock.json? When I run npm install, it will look for the latest versions of everything, and update the package-lock.json. Then I run my tests and if everything still works, commit the new package-lock to git and to npm. Then if someone installs my package through npm, they get the versions that are in the package-lock. That way every user gets the same dependency versions as the ones I tested with. Right?

Choose a reason for hiding this comment

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

Indeed, but what happens is that you'll get patch updates that create problems that your test suite doesn't show you; you lose control in that sense.

Sometimes there are many changes in the package-lock.json and it's impossible to see the ramifications.

When you keep stricter control over dependencies, then you know exactly what you've just changed and things become more tractable.

https://renovatebot.com/docs/dependency-pinning/

What I personally like to do it deploy something like greenkeeper (https://greenkeeper.io/) to automatically propose version upgrades as pull requests. Here's an example: NationalBankBelgium/stark#1206

That way things remain under control and it eliminates surprises while remaining manageable

@@ -0,0 +1,10 @@
{
"extends": ["tslint-config-standard"],

Choose a reason for hiding this comment

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

Don't know if you're aware, but TSLint will be abandoned in favor of ESLint by its creators (Palantir): https://medium.com/palantir/tslint-in-2019-1a144c2317a9

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 didn't know! They say "Once we consider ESLint feature-complete w.r.t. TSLint, we will deprecate TSLint and help users migrate to ESLint" so we'll stay on TSLint until they tell us it's time to switch.

Copy link

@kjetilk kjetilk left a comment

Choose a reason for hiding this comment

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

It is fine except for the port thing :-)

package.json Outdated
"Michiel de Jong (https://github.com/michielbdejong)",
"Ruben Verborgh (https://github.com/rubenverborgh)",
"Kjetil Kjernsmo (https://github.com/kjetilk)",
"*Jackson Morgan (https://github.com/jaxoncreed)",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo *

package.json Outdated
"Pat McBennett (https://github.com/pmcb55)",
"Justin Bingham (https://github.com/justinwb)"
],
"license": "ISC",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be MIT?

@michielbdejong
Copy link
Contributor Author

Remark from @kjetilk : don't hard-code port in test

@michielbdejong
Copy link
Contributor Author

Thanks all!

@michielbdejong michielbdejong merged commit f3ad7e9 into master Apr 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants