Page MenuHomePhabricator

Make language-data installable as a proper library
Closed, ResolvedPublic

Description

Language-data is hosted in https://github.com/wikimedia/language-data

It does have a package.json, but as far as I can see, it doesn't have any releases nor is it submitted to npm. It is not submitted to packagist.

Currently, I believe, composer dependencies are easier to add to MediaWiki core.

Steps to do

  • Establish a release policy (who, when, semantic versioning)
  • Make a release in GitHub
  • Register language-data in npm
  • Add composer.json and register in packagist

QA plan

Affected projects: none
Verify that projects are installable via composer and npm

Outcome

Language-data library is released in Packagist and NPM package repositories

Event Timeline

I've submitted the following patches

  1. Add a PHP Interface and test cases - https://github.com/wikimedia/language-data/pull/79
  2. Replace TravisCI with Github actions - https://github.com/wikimedia/language-data/pull/80
  3. Move documentation to Read the docs - https://github.com/wikimedia/language-data/pull/81
  4. Add spyc to composer.json - https://github.com/wikimedia/language-data/pull/82
  5. Update minimum supported node.js version to 8.x - https://github.com/wikimedia/language-data/pull/83

After the above patches have been merged we've to do the following,

From GitHub:

wikimedia / language-data
(forked from santhoshtr/language-data)

You may want to re-create/push either the wikimedia or the santhoshtr one to break (or reverse) this link so that GitHub's code search isn't disabled, and to ensure contributes and GH's automatic PRs don't encourage the user to go to the old repo instead. E.g. right now it says "This branch is 22 commits ahead" and new PRs that you create internally will defaullt to upstream/master instead of local master.

From GitHub:

wikimedia / language-data
(forked from santhoshtr/language-data)

You may want to re-create/push either the wikimedia or the santhoshtr one to break (or reverse) this link so that GitHub's code search isn't disabled, and to ensure contributes and GH's automatic PRs don't encourage the user to go to the old repo instead. E.g. right now it says "This branch is 22 commits ahead" and new PRs that you create internally will defaullt to upstream/master instead of local master.

Fixed.

We've released updated versions of the library on npm (v0.2.0) and packagist (v1.0.0).

  1. Documentation is available here
  2. The changelog is available here.
  3. Subsequent releases will be done along with the MLEB release i.e once every quarter.

I did:

jadekukka:~/foo$ npm i @wikimedia/language-data
npm WARN npm npm does not support Node.js v10.21.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN saveError ENOENT: no such file or directory, open '/home/nike/foo/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/nike/foo/package.json'
npm WARN foo No description
npm WARN foo No repository field.
npm WARN foo No README data
npm WARN foo No license field.

+ @wikimedia/language-data@0.2.0
added 1 package from 5 contributors in 3.864s
jadekukka:~/foo$ composer require wikimedia/language-data
Using version ^1.0 for wikimedia/language-data
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing mustangostang/spyc (0.6.3): Downloading (100%)         
  - Installing wikimedia/language-data (1.0.0): Downloading (100%)         
Writing lock file
Generating autoload files