Merge lp:~cjwatson/launchpad/yarn into lp:launchpad

Proposed by Colin Watson
Status: Merged
Merged at revision: 18485
Proposed branch: lp:~cjwatson/launchpad/yarn
Merge into: lp:launchpad
Diff against target: 234 lines (+93/-24)
9 files modified
.bzrignore (+1/-1)
Makefile (+18/-16)
lib/lp/app/javascript/testing/test.css (+0/-1)
lib/lp/scripts/utilities/js/combinecss.py (+4/-4)
lib/lp/testing/yuixhr.py (+0/-2)
utilities/yarn (+7/-0)
yarn/.yarnrc (+6/-0)
yarn/package.json (+15/-0)
yarn/yarn.lock (+42/-0)
To merge this branch: bzr merge lp:~cjwatson/launchpad/yarn
Reviewer Review Type Date Requested Status
William Grant Approve
Review via email: mp+327823@code.launchpad.net

Commit message

Install YUI using Yarn.

Description of the change

This is in part an RFC, but it was surprisingly little work. Additional things that would need to be done in order to test or land this:

 * Add nodejs to launchpad-developer-dependencies.
 * Download https://github.com/yarnpkg/yarn/releases/download/v1.2.1/yarn-v1.2.1.tar.gz to download-cache/dist/yarn-1.2.1.tar.gz.
 * Populate an initial download-cache/yarn/. "make build/js/yarn && utilities/yarn install" should do the trick.

I'm hoping that after this we can start using useful but previously-inaccessible tools such as postcss, and maybe start modernising Launchpad's JavaScript in general (for example, we could consider using Webpack for module bundling, Babel so that we can use modern language features, eslint for linting, and so on); but that's for the future.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

Is xenial's nodejs reasonably new? Can we backport it to precise, or do we want to wait a few weeks?

review: Approve
Revision history for this message
Colin Watson (cjwatson) wrote :

xenial's nodejs is sufficient for our purposes. I'm inclined to wait until the upgrades are done rather than bothering with a backport.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2017-05-11 14:15:36 +0000
+++ .bzrignore 2017-10-20 13:04:50 +0000
@@ -45,7 +45,6 @@
45./production-configs45./production-configs
46bzr.dev46bzr.dev
47_trial_temp47_trial_temp
48lazr-js
49.bazaar48.bazaar
50.cache49.cache
51.subversion50.subversion
@@ -78,3 +77,4 @@
78./celerybeat-schedule77./celerybeat-schedule
79!logs/README.txt78!logs/README.txt
80./logs79./logs
80yarn/node_modules
8181
=== modified file 'Makefile'
--- Makefile 2017-09-26 03:08:34 +0000
+++ Makefile 2017-10-20 13:04:50 +0000
@@ -22,10 +22,10 @@
22LP_BUILT_JS_ROOT=${ICING}/build22LP_BUILT_JS_ROOT=${ICING}/build
2323
24JS_BUILD_DIR := build/js24JS_BUILD_DIR := build/js
25YUI_VERSIONS := 3.10.325YARN_VERSION := 1.2.1
26YUI_BUILDS := $(patsubst %,$(JS_BUILD_DIR)/yui-%, $(YUI_VERSIONS))26YARN_BUILD := $(JS_BUILD_DIR)/yarn
27YUI_DEFAULT := yui-3.10.327YARN := utilities/yarn
28YUI_DEFAULT_SYMLINK := $(JS_BUILD_DIR)/yui28YUI_SYMLINK := $(JS_BUILD_DIR)/yui
29LP_JS_BUILD := $(JS_BUILD_DIR)/lp29LP_JS_BUILD := $(JS_BUILD_DIR)/lp
3030
31MINS_TO_SHUTDOWN=1531MINS_TO_SHUTDOWN=15
@@ -145,7 +145,7 @@
145css_combine: jsbuild_widget_css145css_combine: jsbuild_widget_css
146 ${SHHH} bin/sprite-util create-image146 ${SHHH} bin/sprite-util create-image
147 ${SHHH} bin/sprite-util create-css147 ${SHHH} bin/sprite-util create-css
148 ln -sfn ../../../../build/js/$(YUI_DEFAULT) $(ICING)/yui148 ln -sfn ../../../../yarn/node_modules/yui $(ICING)/yui
149 ${SHHH} bin/combine-css149 ${SHHH} bin/combine-css
150150
151jsbuild_widget_css: bin/jsbuild151jsbuild_widget_css: bin/jsbuild
@@ -159,17 +159,20 @@
159$(JS_BUILD_DIR):159$(JS_BUILD_DIR):
160 mkdir -p $@160 mkdir -p $@
161161
162$(YUI_BUILDS): | $(JS_BUILD_DIR)162$(YARN_BUILD): | $(JS_BUILD_DIR)
163 mkdir -p $@/tmp163 mkdir -p $@/tmp
164 unzip -q download-cache/dist/yui_$(subst build/js/yui-,,$@).zip -d $@/tmp 'yui/build/*'164 tar -C $@/tmp -xf download-cache/dist/yarn-$(YARN_VERSION).tar.gz
165 # We don't use the Flash components and they have a bad security165 mv $@/tmp/yarn-v$(YARN_VERSION)/* $@
166 $(RM) -r $@/tmp
167
168yarn/node_modules/yui: yarn/package.json | $(YARN_BUILD)
169 $(YARN) install --offline --frozen-lockfile
170 # We don't use YUI's Flash components and they have a bad security
166 # record. Kill them.171 # record. Kill them.
167 find $@/tmp/yui/build -name '*.swf' -delete172 find yarn/node_modules/yui -name '*.swf' -delete
168 mv $@/tmp/yui/build/* $@
169 $(RM) -r $@/tmp
170173
171$(YUI_DEFAULT_SYMLINK): $(YUI_BUILDS)174$(YUI_SYMLINK): yarn/node_modules/yui
172 ln -sfn $(YUI_DEFAULT) $@175 ln -sfn ../../yarn/node_modules/yui $@
173176
174$(LP_JS_BUILD): | $(JS_BUILD_DIR)177$(LP_JS_BUILD): | $(JS_BUILD_DIR)
175 -mkdir $@178 -mkdir $@
@@ -181,7 +184,7 @@
181 find $@ -name 'tests' -type d | xargs rm -rf184 find $@ -name 'tests' -type d | xargs rm -rf
182 bin/lpjsmin -p $@185 bin/lpjsmin -p $@
183186
184jsbuild: $(LP_JS_BUILD) $(YUI_DEFAULT_SYMLINK)187jsbuild: $(LP_JS_BUILD) $(YUI_SYMLINK)
185 utilities/js-deps -n LP_MODULES -s build/js/lp -x '-min.js' -o \188 utilities/js-deps -n LP_MODULES -s build/js/lp -x '-min.js' -o \
186 build/js/lp/meta.js >/dev/null189 build/js/lp/meta.js >/dev/null
187 utilities/check-js-deps190 utilities/check-js-deps
@@ -340,7 +343,7 @@
340343
341clean_js:344clean_js:
342 $(RM) -r $(JS_BUILD_DIR)345 $(RM) -r $(JS_BUILD_DIR)
343 $(RM) -r yui # Remove obsolete top-level directory for now.346 $(RM) -r yarn/node_modules
344347
345clean_buildout:348clean_buildout:
346 $(RM) -r build349 $(RM) -r build
@@ -349,7 +352,6 @@
349 $(RM) -r parts352 $(RM) -r parts
350 $(RM) -r develop-eggs353 $(RM) -r develop-eggs
351 $(RM) .installed.cfg354 $(RM) .installed.cfg
352 $(RM) -r yui/*
353355
354clean_logs:356clean_logs:
355 $(RM) logs/thread*.request357 $(RM) logs/thread*.request
356358
=== removed symlink 'lib/canonical/launchpad/icing/yui3-gallery'
=== target was u'../../../lp/contrib/javascript/yui3-gallery'
=== modified file 'lib/lp/app/javascript/testing/test.css'
--- lib/lp/app/javascript/testing/test.css 2011-11-18 05:38:25 +0000
+++ lib/lp/app/javascript/testing/test.css 2017-10-20 13:04:50 +0000
@@ -1,5 +1,4 @@
1@import url("../../../../canonical/launchpad/icing/import.css");1@import url("../../../../canonical/launchpad/icing/import.css");
2@import url("../../../../canonical/launchpad/icing/yui/assets/skins/sam/skin.css");
3@import url("../../../../canonical/launchpad/icing/yui/cssreset/reset.css");2@import url("../../../../canonical/launchpad/icing/yui/cssreset/reset.css");
4@import url("../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css");3@import url("../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css");
5@import url("../../../../canonical/launchpad/icing/yui/cssbase/base.css");4@import url("../../../../canonical/launchpad/icing/yui/cssbase/base.css");
65
=== modified file 'lib/lp/scripts/utilities/js/combinecss.py'
--- lib/lp/scripts/utilities/js/combinecss.py 2017-07-20 15:14:40 +0000
+++ lib/lp/scripts/utilities/js/combinecss.py 2017-10-20 13:04:50 +0000
@@ -16,10 +16,10 @@
16 'ubuntu-webfonts.css',16 'ubuntu-webfonts.css',
17 'style.css',17 'style.css',
18 'yui/cssreset/cssreset.css',18 'yui/cssreset/cssreset.css',
19 'yui/assets/skins/sam/autocomplete-list.css',19 'yui/autocomplete-list/assets/skins/sam/autocomplete-list.css',
20 'yui/assets/skins/sam/calendar-base.css',20 'yui/calendar-base/assets/skins/sam/calendar-base.css',
21 'yui/assets/skins/sam/calendar.css',21 'yui/calendar/assets/skins/sam/calendar.css',
22 'yui/assets/skins/sam/calendarnavigator.css',22 'yui/calendarnavigator/assets/skins/sam/calendarnavigator.css',
23 # Since the old cssgrids uses yui-, and the new uses yui3-, it is only23 # Since the old cssgrids uses yui-, and the new uses yui3-, it is only
24 # used for the calendar.24 # used for the calendar.
25 'yui/cssgrids/cssgrids.css',25 'yui/cssgrids/cssgrids.css',
2626
=== modified file 'lib/lp/testing/yuixhr.py'
--- lib/lp/testing/yuixhr.py 2016-09-14 11:13:06 +0000
+++ lib/lp/testing/yuixhr.py 2017-10-20 13:04:50 +0000
@@ -232,8 +232,6 @@
232 <html>232 <html>
233 <head>233 <head>
234 <title>YUI XHR Tests</title>234 <title>YUI XHR Tests</title>
235 <link rel="stylesheet"
236 href="/+icing/yui/assets/skins/sam/skin.css"/>
237 <link rel="stylesheet" href="/+icing/rev%(revision)s/combo.css"/>235 <link rel="stylesheet" href="/+icing/rev%(revision)s/combo.css"/>
238 <style>236 <style>
239 ul {237 ul {
240238
=== added file 'utilities/yarn'
--- utilities/yarn 1970-01-01 00:00:00 +0000
+++ utilities/yarn 2017-10-20 13:04:50 +0000
@@ -0,0 +1,7 @@
1#! /bin/sh
2set -e
3
4cd "$(dirname "$0")"/../yarn
5# Disable the unsupported Node version check for now. It's much easier to
6# go with what's in Ubuntu 16.04, and things seem to work OK at the moment.
7../build/js/yarn/bin/yarn --no-node-version-check "$@"
08
=== added directory 'yarn'
=== added file 'yarn/.yarnrc'
--- yarn/.yarnrc 1970-01-01 00:00:00 +0000
+++ yarn/.yarnrc 2017-10-20 13:04:50 +0000
@@ -0,0 +1,6 @@
1# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2# yarn lockfile v1
3
4
5lastUpdateCheck 1500567929021
6yarn-offline-mirror "../download-cache/yarn"
07
=== added file 'yarn/package.json'
--- yarn/package.json 1970-01-01 00:00:00 +0000
+++ yarn/package.json 2017-10-20 13:04:50 +0000
@@ -0,0 +1,15 @@
1{
2 "name": "launchpad",
3 "version": "0.0.0",
4 "description": "Launchpad",
5 "main": "index.js",
6 "repository": {
7 "type": "bzr",
8 "url": "https://bazaar.launchpad.net/+branch/launchpad"
9 },
10 "author": "Canonical Ltd.",
11 "license": "AGPL-3.0",
12 "dependencies": {
13 "yui": "3.10.3"
14 }
15}
016
=== added file 'yarn/yarn.lock'
--- yarn/yarn.lock 1970-01-01 00:00:00 +0000
+++ yarn/yarn.lock 2017-10-20 13:04:50 +0000
@@ -0,0 +1,42 @@
1# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2# yarn lockfile v1
3
4
5async@~0.2.7:
6 version "0.2.10"
7 resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
8
9combined-stream@~0.0.4:
10 version "0.0.7"
11 resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-0.0.7.tgz#0137e657baa5a7541c57ac37ac5fc07d73b4dc1f"
12 dependencies:
13 delayed-stream "0.0.5"
14
15delayed-stream@0.0.5:
16 version "0.0.5"
17 resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-0.0.5.tgz#d4b1f43a93e8296dfe02694f4680bc37a313c73f"
18
19form-data@~0.0.3:
20 version "0.0.10"
21 resolved "https://registry.yarnpkg.com/form-data/-/form-data-0.0.10.tgz#db345a5378d86aeeb1ed5d553b869ac192d2f5ed"
22 dependencies:
23 async "~0.2.7"
24 combined-stream "~0.0.4"
25 mime "~1.2.2"
26
27mime@~1.2.2, mime@~1.2.7:
28 version "1.2.11"
29 resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10"
30
31request@~2.14.0:
32 version "2.14.0"
33 resolved "https://registry.yarnpkg.com/request/-/request-2.14.0.tgz#0d8acbb0b14c1ab82e000b7d381fa8c80d1a7d88"
34 dependencies:
35 form-data "~0.0.3"
36 mime "~1.2.7"
37
38yui@3.10.3:
39 version "3.10.3"
40 resolved "https://registry.yarnpkg.com/yui/-/yui-3.10.3.tgz#35fcea1bfafc6d435d27f13621d1ae9deb1e9f85"
41 dependencies:
42 request "~2.14.0"