VCityTeam / UD-Viz

UD-Viz is a javascript mono repository for creating web applications for visualizing and interacting with geospatial 3D urban data.
Other
36 stars 18 forks source link

npm-git doesn't allow to work on a specific commit-ish of itowns. #3

Closed EricBoix closed 6 years ago

EricBoix commented 6 years ago

I need to work with a specific feature-branch of iTowns (that is not in the npm registry yet).

Specifying a dependency as a github URL doesn't work for an iTowns (as a dependency of our project) because (itowns) npm prepublish is not executed when a dependency-package gets installed. In other terms npm fetches the required commitish version of iTowns but doesn't run the npm prepublish on the retrieved sources of iTowns.

This limiting design of npm (known since 2013, happens sometimes to be problematic (like for our need).

npm-git-install seems to be an effective temporary fix. Alas if you consider the following package.json file then an npm install on UDV-Core does indeed trigger npm-git install that in turn runs iTows npm prepublish but the build directory used for that build seems to be removed by npm-git.

{
  "name": "UDV-Core",
  "version": "0.0.1",
  "description": "An iTowns based set of overlay display modules for City exploration",
  "main": "src/Main.js",
  "scripts": {
    "build": "webpack -p",
    "doc": "jsdoc Setup3DScene.js",
    "doclint": "npm run doc -- -t templates/silent",
    "install": "npm-git install",
    "lint": "eslint \"src/**/*.js\" \"Main.js\" \"Setup3DScene.js\"",
    "start": "cross-env NODE_ENV=development webpack-dev-server -d --inline --hot",
    "test": "npm run lint",
    "transpile": "cross-env BABEL_DISABLE_CACHE=1 babel src --out-dir lib",
    "//": "\"prepublish\": \"npm run build && npm run transpile\""
  },
  "files": [
    "Tools",
    "Modules"
  ],
  "repository": {
    "type": "git",
    "url": "git+https://github.com/MEPP-team/UDV.git"
  },
  "license": "(LGPL-2.1)",
  "bugs": {
    "url": "https://github.com/MEPP-team/UDV/issues"
  },
  "homepage": "https://github.com/MEPP-team/UDV/",
  "dependencies": {
    "babel-runtime": "^6.20.0",
    "es6-promise": "^4.0.5",
    "moment": "^2.19.0",
    "npm-git-install": "^0.3.0"
  },
  "devDependencies": {
    "babel-cli": "^6.22.2",
    "babel-core": "^6.22.1",
    "babel-loader": "^7.0.0",
    "babel-plugin-minify-dead-code-elimination": "^0.2.0",
    "babel-plugin-transform-runtime": "^6.22.0",
    "babel-plugin-webpack-loaders": "^0.9.0",
    "babel-preset-env": "^1.6.0",
    "chart.js": "^2.4.0",
    "cross-env": "^3.1.4",
    "eslint": "^3.14.0",
    "eslint-config-airbnb-base": "^11.3.0",
    "eslint-import-resolver-webpack": "^0.8.1",
    "eslint-loader": "^1.7.1",
    "eslint-plugin-import": "^2.2.0",
    "imports-loader": "^0.7.1",
    "jsdoc": "^3.4.3",
    "mocha": "^3.4.2",
    "node-fetch": "^1.7.0",
    "raw-loader": "^0.5.1",
    "require-from-string": "^1.2.1",
    "webpack": "^2.6.1",
    "webpack-dev-server": "^2.4.5"
  },
  "gitDependencies": {
    "itowns": "https://github.com/iTowns/itowns"
  }
}

The result is that npm-git happens to be of no help in our case. Maybe this is due to the fact that iTowns uses peerDependencies that cannot be installed automagically ?

EricBoix commented 6 years ago

Workaround consists in the following trick: