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
1=== modified file '.bzrignore'
2--- .bzrignore 2017-05-11 14:15:36 +0000
3+++ .bzrignore 2017-10-20 13:04:50 +0000
4@@ -45,7 +45,6 @@
5 ./production-configs
6 bzr.dev
7 _trial_temp
8-lazr-js
9 .bazaar
10 .cache
11 .subversion
12@@ -78,3 +77,4 @@
13 ./celerybeat-schedule
14 !logs/README.txt
15 ./logs
16+yarn/node_modules
17
18=== modified file 'Makefile'
19--- Makefile 2017-09-26 03:08:34 +0000
20+++ Makefile 2017-10-20 13:04:50 +0000
21@@ -22,10 +22,10 @@
22 LP_BUILT_JS_ROOT=${ICING}/build
23
24 JS_BUILD_DIR := build/js
25-YUI_VERSIONS := 3.10.3
26-YUI_BUILDS := $(patsubst %,$(JS_BUILD_DIR)/yui-%, $(YUI_VERSIONS))
27-YUI_DEFAULT := yui-3.10.3
28-YUI_DEFAULT_SYMLINK := $(JS_BUILD_DIR)/yui
29+YARN_VERSION := 1.2.1
30+YARN_BUILD := $(JS_BUILD_DIR)/yarn
31+YARN := utilities/yarn
32+YUI_SYMLINK := $(JS_BUILD_DIR)/yui
33 LP_JS_BUILD := $(JS_BUILD_DIR)/lp
34
35 MINS_TO_SHUTDOWN=15
36@@ -145,7 +145,7 @@
37 css_combine: jsbuild_widget_css
38 ${SHHH} bin/sprite-util create-image
39 ${SHHH} bin/sprite-util create-css
40- ln -sfn ../../../../build/js/$(YUI_DEFAULT) $(ICING)/yui
41+ ln -sfn ../../../../yarn/node_modules/yui $(ICING)/yui
42 ${SHHH} bin/combine-css
43
44 jsbuild_widget_css: bin/jsbuild
45@@ -159,17 +159,20 @@
46 $(JS_BUILD_DIR):
47 mkdir -p $@
48
49-$(YUI_BUILDS): | $(JS_BUILD_DIR)
50+$(YARN_BUILD): | $(JS_BUILD_DIR)
51 mkdir -p $@/tmp
52- unzip -q download-cache/dist/yui_$(subst build/js/yui-,,$@).zip -d $@/tmp 'yui/build/*'
53- # We don't use the Flash components and they have a bad security
54+ tar -C $@/tmp -xf download-cache/dist/yarn-$(YARN_VERSION).tar.gz
55+ mv $@/tmp/yarn-v$(YARN_VERSION)/* $@
56+ $(RM) -r $@/tmp
57+
58+yarn/node_modules/yui: yarn/package.json | $(YARN_BUILD)
59+ $(YARN) install --offline --frozen-lockfile
60+ # We don't use YUI's Flash components and they have a bad security
61 # record. Kill them.
62- find $@/tmp/yui/build -name '*.swf' -delete
63- mv $@/tmp/yui/build/* $@
64- $(RM) -r $@/tmp
65+ find yarn/node_modules/yui -name '*.swf' -delete
66
67-$(YUI_DEFAULT_SYMLINK): $(YUI_BUILDS)
68- ln -sfn $(YUI_DEFAULT) $@
69+$(YUI_SYMLINK): yarn/node_modules/yui
70+ ln -sfn ../../yarn/node_modules/yui $@
71
72 $(LP_JS_BUILD): | $(JS_BUILD_DIR)
73 -mkdir $@
74@@ -181,7 +184,7 @@
75 find $@ -name 'tests' -type d | xargs rm -rf
76 bin/lpjsmin -p $@
77
78-jsbuild: $(LP_JS_BUILD) $(YUI_DEFAULT_SYMLINK)
79+jsbuild: $(LP_JS_BUILD) $(YUI_SYMLINK)
80 utilities/js-deps -n LP_MODULES -s build/js/lp -x '-min.js' -o \
81 build/js/lp/meta.js >/dev/null
82 utilities/check-js-deps
83@@ -340,7 +343,7 @@
84
85 clean_js:
86 $(RM) -r $(JS_BUILD_DIR)
87- $(RM) -r yui # Remove obsolete top-level directory for now.
88+ $(RM) -r yarn/node_modules
89
90 clean_buildout:
91 $(RM) -r build
92@@ -349,7 +352,6 @@
93 $(RM) -r parts
94 $(RM) -r develop-eggs
95 $(RM) .installed.cfg
96- $(RM) -r yui/*
97
98 clean_logs:
99 $(RM) logs/thread*.request
100
101=== removed symlink 'lib/canonical/launchpad/icing/yui3-gallery'
102=== target was u'../../../lp/contrib/javascript/yui3-gallery'
103=== modified file 'lib/lp/app/javascript/testing/test.css'
104--- lib/lp/app/javascript/testing/test.css 2011-11-18 05:38:25 +0000
105+++ lib/lp/app/javascript/testing/test.css 2017-10-20 13:04:50 +0000
106@@ -1,5 +1,4 @@
107 @import url("../../../../canonical/launchpad/icing/import.css");
108-@import url("../../../../canonical/launchpad/icing/yui/assets/skins/sam/skin.css");
109 @import url("../../../../canonical/launchpad/icing/yui/cssreset/reset.css");
110 @import url("../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css");
111 @import url("../../../../canonical/launchpad/icing/yui/cssbase/base.css");
112
113=== modified file 'lib/lp/scripts/utilities/js/combinecss.py'
114--- lib/lp/scripts/utilities/js/combinecss.py 2017-07-20 15:14:40 +0000
115+++ lib/lp/scripts/utilities/js/combinecss.py 2017-10-20 13:04:50 +0000
116@@ -16,10 +16,10 @@
117 'ubuntu-webfonts.css',
118 'style.css',
119 'yui/cssreset/cssreset.css',
120- 'yui/assets/skins/sam/autocomplete-list.css',
121- 'yui/assets/skins/sam/calendar-base.css',
122- 'yui/assets/skins/sam/calendar.css',
123- 'yui/assets/skins/sam/calendarnavigator.css',
124+ 'yui/autocomplete-list/assets/skins/sam/autocomplete-list.css',
125+ 'yui/calendar-base/assets/skins/sam/calendar-base.css',
126+ 'yui/calendar/assets/skins/sam/calendar.css',
127+ 'yui/calendarnavigator/assets/skins/sam/calendarnavigator.css',
128 # Since the old cssgrids uses yui-, and the new uses yui3-, it is only
129 # used for the calendar.
130 'yui/cssgrids/cssgrids.css',
131
132=== modified file 'lib/lp/testing/yuixhr.py'
133--- lib/lp/testing/yuixhr.py 2016-09-14 11:13:06 +0000
134+++ lib/lp/testing/yuixhr.py 2017-10-20 13:04:50 +0000
135@@ -232,8 +232,6 @@
136 <html>
137 <head>
138 <title>YUI XHR Tests</title>
139- <link rel="stylesheet"
140- href="/+icing/yui/assets/skins/sam/skin.css"/>
141 <link rel="stylesheet" href="/+icing/rev%(revision)s/combo.css"/>
142 <style>
143 ul {
144
145=== added file 'utilities/yarn'
146--- utilities/yarn 1970-01-01 00:00:00 +0000
147+++ utilities/yarn 2017-10-20 13:04:50 +0000
148@@ -0,0 +1,7 @@
149+#! /bin/sh
150+set -e
151+
152+cd "$(dirname "$0")"/../yarn
153+# Disable the unsupported Node version check for now. It's much easier to
154+# go with what's in Ubuntu 16.04, and things seem to work OK at the moment.
155+../build/js/yarn/bin/yarn --no-node-version-check "$@"
156
157=== added directory 'yarn'
158=== added file 'yarn/.yarnrc'
159--- yarn/.yarnrc 1970-01-01 00:00:00 +0000
160+++ yarn/.yarnrc 2017-10-20 13:04:50 +0000
161@@ -0,0 +1,6 @@
162+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
163+# yarn lockfile v1
164+
165+
166+lastUpdateCheck 1500567929021
167+yarn-offline-mirror "../download-cache/yarn"
168
169=== added file 'yarn/package.json'
170--- yarn/package.json 1970-01-01 00:00:00 +0000
171+++ yarn/package.json 2017-10-20 13:04:50 +0000
172@@ -0,0 +1,15 @@
173+{
174+ "name": "launchpad",
175+ "version": "0.0.0",
176+ "description": "Launchpad",
177+ "main": "index.js",
178+ "repository": {
179+ "type": "bzr",
180+ "url": "https://bazaar.launchpad.net/+branch/launchpad"
181+ },
182+ "author": "Canonical Ltd.",
183+ "license": "AGPL-3.0",
184+ "dependencies": {
185+ "yui": "3.10.3"
186+ }
187+}
188
189=== added file 'yarn/yarn.lock'
190--- yarn/yarn.lock 1970-01-01 00:00:00 +0000
191+++ yarn/yarn.lock 2017-10-20 13:04:50 +0000
192@@ -0,0 +1,42 @@
193+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
194+# yarn lockfile v1
195+
196+
197+async@~0.2.7:
198+ version "0.2.10"
199+ resolved "https://registry.yarnpkg.com/async/-/async-0.2.10.tgz#b6bbe0b0674b9d719708ca38de8c237cb526c3d1"
200+
201+combined-stream@~0.0.4:
202+ version "0.0.7"
203+ resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-0.0.7.tgz#0137e657baa5a7541c57ac37ac5fc07d73b4dc1f"
204+ dependencies:
205+ delayed-stream "0.0.5"
206+
207+delayed-stream@0.0.5:
208+ version "0.0.5"
209+ resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-0.0.5.tgz#d4b1f43a93e8296dfe02694f4680bc37a313c73f"
210+
211+form-data@~0.0.3:
212+ version "0.0.10"
213+ resolved "https://registry.yarnpkg.com/form-data/-/form-data-0.0.10.tgz#db345a5378d86aeeb1ed5d553b869ac192d2f5ed"
214+ dependencies:
215+ async "~0.2.7"
216+ combined-stream "~0.0.4"
217+ mime "~1.2.2"
218+
219+mime@~1.2.2, mime@~1.2.7:
220+ version "1.2.11"
221+ resolved "https://registry.yarnpkg.com/mime/-/mime-1.2.11.tgz#58203eed86e3a5ef17aed2b7d9ebd47f0a60dd10"
222+
223+request@~2.14.0:
224+ version "2.14.0"
225+ resolved "https://registry.yarnpkg.com/request/-/request-2.14.0.tgz#0d8acbb0b14c1ab82e000b7d381fa8c80d1a7d88"
226+ dependencies:
227+ form-data "~0.0.3"
228+ mime "~1.2.7"
229+
230+yui@3.10.3:
231+ version "3.10.3"
232+ resolved "https://registry.yarnpkg.com/yui/-/yui-3.10.3.tgz#35fcea1bfafc6d435d27f13621d1ae9deb1e9f85"
233+ dependencies:
234+ request "~2.14.0"