slushjs / slush

The streaming scaffolding system - Gulp as a replacement for Yeoman
http://slushjs.github.io/generators
MIT License
1.24k stars 58 forks source link

Question - Update an existing application #52

Open no-more opened 8 years ago

no-more commented 8 years ago

Hello,

I know this is not the best place for this question but I couldn't find a slush forum or something else to ask.

I'm starting to use slush for a new project which will have several apps (that's why I need scaffolding tools). But what I would like is to be able to use this tool to maintain the apps when the template evolves.

For example if one of the dependency number change in the package.json file I would like to be able to apply it every where without to manually edit them, but I don't want local changes to be lost either.

Is there any way to do it easily with slush/glulp or should I use another tool (which one ?)?

Thanks a lot

Regards Christophe.

joakimbeng commented 8 years ago

That's a good question! I have been thinking a lot about this myself, but I'm afraid I haven't found a good solution for it yet.

One way to solve it would be to create a gulp plugin which, instead of just copying a package.json template, modifies a package.json so it includes the needed dependencies without affecting other stuff. Maybe an API like this (let's call the hypothetical plugin gulp-deps):

const gulp = require('gulp');
const deps = require('gulp-deps');
const install = require('gulp-install');

gulp.task('default', () => {
  return gulp.src('./package.json')
    .pipe(deps({
      dependencies: {
        gulp: '^3.0.0'
      },
      devDependencies: {
        xo: '^0.13.0'
      },
      remove: [
        'no-longer-used-dependency'
      ]
    }))
    .pipe(gulp.dest('./'))
    .pipe(install());
});

How does that look? As I said it doesn't exist yet though, and I haven't had the time to build such a plugin myself.

no-more commented 8 years ago

Thanks,

Your idea is quite interesting. I don't know how to make gulp plugin, but if I can I'll try to have a look onto this.

Thanks.