Problem/Motivation

Currently there is no ability to specify JavaScript dependences, or test commands for Drupal. package.json is a file use by npm to configure dependencies, tools settings (like eslint configuration, babel configuration) as well as dependencies. Eventually it might be used to control our third party dependencies such as jquery, jquery once, etc. It's pretty much like composer.json for javascript.

An example can be found here: http://browsenpm.org/package.json

This file will also hold the commands to run unit tests once we have that set up.

Proposed resolution

Adding a package.json would allow us to manage development dependencies (to compile ES6 down to ES5) as well as automate the execution of coding standards tests for JavaScript.

Comments

drpal created an issue. See original summary.

GrandmaGlassesRopeMan’s picture

StatusFileSize
new767 bytes

Just a minor fix to the pattern match for JavaScript files as well as a correct version number.

nod_’s picture

Title: [patch] Add Package.json to Drupal » Add package.json to Drupal
Category: Feature request » Task
Issue summary: View changes
Status: Active » Needs review
wim leers’s picture

Issue summary: View changes
+++ b/package.json
@@ -0,0 +1,13 @@
+  “version”: “8.3.0”,

This would be another place that core committers would have to keep the version number up-to-date…

nod_’s picture

StatusFileSize
new474 bytes

Simplified this, dev dependencies will be added in a follow-up.

Status: Needs review » Needs work

The last submitted patch, 5: core-package-2809165-5.patch, failed testing.

GrandmaGlassesRopeMan’s picture

@Wim Leers

I'd love to be able to remove the version from package.json, but sadly it's not a valid file without one.

nod_’s picture

Status: Needs work » Needs review
StatusFileSize
new352 bytes

(>_<)

GrandmaGlassesRopeMan’s picture

Whoops

attiks’s picture

Status: Needs review » Reviewed & tested by the community

#8 Looks enough to get us started, true that core committers have to update version before tagging a new release, but not much we can do about it, it's a required field, although if it doesn't get updated not much is going to happen, version is mainly required for modules installed using npm.

nod_’s picture

And the private: true in the package.json makes sure this doesn't get on npm by error.

alexpott’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Related issues: +#2809477: Add ES6 to ES5 build process

I think we should do this in #2809477: Add ES6 to ES5 build process since we've been discussing the location there.