Page MenuHomePhabricator

Make sure extensions using composer/npm for development dependencies have the right .gitignore rules
Closed, ResolvedPublic

Description

We've been adding npm/composer dependencies to a lot of extensions, but not necessarily been updating the .gitignore rules.

If an extension has npm dependencies, it needs to have a .gitignore with:

/node_modules

composer dependencies should have:

/composer.lock
/vendor

To avoid git status thinking that the repo is not clean, etc.

Event Timeline

Legoktm raised the priority of this task from to Needs Triage.
Legoktm updated the task description. (Show Details)
Legoktm added a project: MediaWiki-General.
Legoktm added subscribers: Legoktm, Jdforrester-WMF.
hashar added subscribers: Umherirrender, hashar.

I have added a few ignores for node_modules and was wondering which syntax to use exactly.

From the root of mediawiki/extensions I have:

$ grep node_modules */.gitignore|cut -d: -f2|sort|uniq -c|sort -nr
    389 node_modules/
    148 /node_modules/
    106 node_modules/**
     49 /node_modules
     33 node_modules
      2 node_modules/
      2 /nbproject/private/node_modules/
      1 server/node_modules
      1 !node_modules/caman-dist-only/dist/caman.full.min.js
      1 node_modules/**
      1 node_modules/*
      1 # https

I am tempted to convert to:

/node_modules/
/vendor/
/composer.lock

Though that would not ignore a file node_modules or vendor or directories deeper in tree.

Umherirrender claimed this task.

Should all done for now (in mediawiki/extensions and mediawiki/skins).

[See https://gerrit.wikimedia.org/r/#/q/status:merged+topic:build for the last one yesterday]

When new composer or npm gets added, hopefully the review process will observe it