Brian Glaz
Brian Glaz

Reputation: 15676

NPM Install, move files with a build script

I have built a custom npm package that is essentially a list of dependencies, a gulp file, and a configuration file for it. The idea is that I can run npm install <path-to-git-repo> to pull in gulp whenever I start a new development project.

However, I would like the gulp file and config file to be moved into the current directory, and not remain inside of node_modules. I have tried to accomplish this with the install script in my package.json file listed below, but it didn't seem to do anything. The files I'm trying to move are included in the files section of package.json.

"scripts":
    {
      "install": "mv gulpfile.js ./ && mv gulp.config.json ./"
    },

Thanks for your help

Upvotes: 2

Views: 7156

Answers (1)

Justin Maat
Justin Maat

Reputation: 1975

For something like this I think it would be much easier to have 1 source gulp file and specify the dependent gulp file(s) wherever you're installing them. example blog

Also, just to point out, install is typically considered an anti-pattern

But to answer your exact question, this command mv gulpfile.js ./ && mv gulp.config.json ./ looks to me like you're saying move gulpfile.js (which is already in the root directory), into ./ (which is the same directory). Check your source directory actually contains the gulpfile.js by running the command yourself on the command line

Upvotes: 1

Related Questions