openworm / geppetto-application

Sample Geppetto application
http://geppetto.org
Other
3 stars 1 forks source link

Use "file" key in package.json to avoid "npm link" in development #17

Closed rodriguez-facundo closed 5 years ago

rodriguez-facundo commented 5 years ago

Closes #16 Bound to https://github.com/openworm/org.geppetto.docs/pull/80.

The issue related to webpack not being able to pick the right version of a package when we install geppetto-client in development mode can be addressed by implementing a different approach.

Instead of using npm link, do the following:

Clone geppetto-client inside geppetto-application and then use local file dependencies in package.json as follow:

// package.json
"devDependencies": {
    "@geppettoengine/geppetto-client": "file:./geppetto-client"
  },

That will cause mvn install to preserve symlinks and to avoid the node_module folder duplication.

That is all that it needs to be done. After that, you can run npm start and go to localhost:8081 and work in de development. No need to link or run any sequence of steps.

cc: @ddelpiano, @jrmartin, @tarelli

tarelli commented 5 years ago

@rodriguez-facundo looks great! @mattearnshaw @filippomc can you test this?

tarelli commented 5 years ago

@ddelpiano could you also try this?

filippomc commented 5 years ago

I'm not being able to get it work. It doesn't seem to be a problem of this branch tough, I'm having the same trouble with the development branch.

After

git clone [...]/geppetto-application
cd geppetto-application
git checkout bug/16
[now modify package.json with file: reference]
npm install
npm run build-dev

The output is the following:

> geppetto-application@1.0.0 build-dev /home/user/geppetto-application
> webpack --devtool eval

sh: 1: webpack: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! geppetto-application@1.0.0 build-dev: `webpack --devtool eval`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the geppetto-application@1.0.0 build-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/user/.npm/_logs/2019-07-31T08_40_18_535Z-debug.log

Looking at the node_modules something weird happens: all the libraries are inside @geppettoengine/geppetto-client/node_modules

filippomc commented 5 years ago

Little note: following git-flow the branch should be called feature/16 even if it a bug!

tarelli commented 5 years ago

What OS? Webpack not found rings a bell.

filippomc commented 5 years ago

What OS? Webpack not found rings a bell.

Linux. I'm making also some tests on windows and I cannot get geppetto-application to work (filled #19)

rodriguez-facundo commented 5 years ago

Update on this one:

macos linux and windows:

Windows :

tarelli commented 5 years ago

For point 1 the documentation is already saying geppetto-client needs to be cloned inside geppetto-application, see here

Robbie1977 commented 5 years ago

Works in Travis for VFB using local files

ddelpiano commented 5 years ago

tested locally on VFB and works for me on macos.