dolittle / Home

Dolittle is a platform designed to build Line of Business applications without sacrificing architectural quality, code quality or scalability.
http://www.dolittle.io
MIT License
27 stars 5 forks source link

@dolittle npm package naming consitency #32

Closed woksin closed 5 years ago

woksin commented 5 years ago

We're getting all sorts of problems with npm because we don't have consistent naming in our packages.json files

┆Issue is synchronized with this Asana task

woksin commented 5 years ago

Yarn tolerates it, but npm doesn't

woksin commented 5 years ago

@einari @jakhog @pavsaund @Virrum

einari commented 5 years ago

Can you point to an example of inconsistency ?

woksin commented 5 years ago

For example, in eCommerce we have packages.json files like this:

{
  "name": "Shop",
  "version": "1.0.0",
  "description": "",
  "main": "karma.conf.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "run": "./run.js"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "dolittle.javascript.build": "https://github.com/dolittle/JavaScript.Build.git",
    "dolittle.javascript.build.aurelia": "https://github.com/dolittle-interaction/JavaScript.Build.Aurelia.git",
    "dolittle.styles": "https://github.com/dolittle/dolittle.styles.git#2.9.4"
  },
  "dependencies": {
    "@dolittle/commands": "^1.0.10",
    "@dolittle/core": "^1.0.4",
    "@dolittle/queries": "^1.0.12",
    "aurelia-http-client": "^1.2.1",
    "dotenv": "^6.1.0"
  }
}

Notice the devDependencies here, the name "dolittle.javascript.build" and "dolittle.javascript.build.aurelia" doesn't match up with the names defined in their package.json files. For example the aurelia build one is called "@dolittle/build.aurelia" in it's package.json.

When doing $ yarn install everything seemingly works, it doesn't care about the name of the package, it just installs the dependency as the name given in its own package.json file 'dolittle.javascript.build'

However, for $ npm install it seems like it gets confused with the mismatch in the naming, so it doesn't install the packages, and none of its dependencies. Changing the name of the package from "dolittle.javascript.build" to what it's defined as in that package's package.json file, "@dolittle/build" fixes the problem for npm

woksin commented 5 years ago

I see that "dolittle.styles" doesn't have the @ prefixed like our other packages : https://github.com/dolittle-interaction/Dolittle.styles/blob/master/package.json

woksin commented 5 years ago

So should all of our npm-packages be prefixed with @ then? If so, this also has to be reflected into the Samples and in the boilerplates

einari commented 5 years ago

All packages should be published to our NPM @dolittle organization. I guess it is only styles that is missing (cc: @Virrum).

woksin commented 5 years ago

Seems like this is fixed? (dolittle/styles => @dolittle/styles cc @Virrum )

Virrum commented 5 years ago

YEs @woksin