← Back to team overview

launchpad-reviewers team mailing list archive

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

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/yarn into lp:launchpad.

Commit message:
Install YUI using Yarn.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/yarn/+merge/327823

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/v0.27.5/yarn-v0.27.5.tar.gz to download-cache/dist/yarn-0.27.5.tar.gz.
 * Populate an initial download-cache/yarn/.  "make build/js/yarn && build/js/yarn/bin/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.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/yarn into lp:launchpad.
=== modified file '.bzrignore'
--- .bzrignore	2017-05-11 14:15:36 +0000
+++ .bzrignore	2017-07-20 17:41:37 +0000
@@ -45,7 +45,6 @@
 ./production-configs
 bzr.dev
 _trial_temp
-lazr-js
 .bazaar
 .cache
 .subversion
@@ -78,3 +77,5 @@
 ./celerybeat-schedule
 !logs/README.txt
 ./logs
+./node_modules
+./yarn.lock

=== added file '.yarnrc'
--- .yarnrc	1970-01-01 00:00:00 +0000
+++ .yarnrc	2017-07-20 17:41:37 +0000
@@ -0,0 +1,6 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+
+lastUpdateCheck 1500567929021
+yarn-offline-mirror "./download-cache/yarn"

=== modified file 'Makefile'
--- Makefile	2017-05-11 14:15:36 +0000
+++ Makefile	2017-07-20 17:41:37 +0000
@@ -22,10 +22,10 @@
 LP_BUILT_JS_ROOT=${ICING}/build
 
 JS_BUILD_DIR := build/js
-YUI_VERSIONS := 3.10.3
-YUI_BUILDS := $(patsubst %,$(JS_BUILD_DIR)/yui-%, $(YUI_VERSIONS))
-YUI_DEFAULT := yui-3.10.3
-YUI_DEFAULT_SYMLINK := $(JS_BUILD_DIR)/yui
+YARN_VERSION := 0.27.5
+YARN_BUILD := $(JS_BUILD_DIR)/yarn
+YARN := $(YARN_BUILD)/bin/yarn
+YUI_SYMLINK := $(JS_BUILD_DIR)/yui
 LP_JS_BUILD := $(JS_BUILD_DIR)/lp
 
 MINS_TO_SHUTDOWN=15
@@ -145,7 +145,7 @@
 css_combine: jsbuild_widget_css
 	${SHHH} bin/sprite-util create-image
 	${SHHH} bin/sprite-util create-css
-	ln -sfn ../../../../build/js/$(YUI_DEFAULT) $(ICING)/yui
+	ln -sfn ../../../../node_modules/yui $(ICING)/yui
 	${SHHH} bin/combine-css
 
 jsbuild_widget_css: bin/jsbuild
@@ -159,17 +159,20 @@
 $(JS_BUILD_DIR):
 	mkdir -p $@
 
-$(YUI_BUILDS): | $(JS_BUILD_DIR)
+$(YARN_BUILD): | $(JS_BUILD_DIR)
 	mkdir -p $@/tmp
-	unzip -q download-cache/dist/yui_$(subst build/js/yui-,,$@).zip -d $@/tmp 'yui/build/*'
-	# We don't use the Flash components and they have a bad security
+	tar -C $@/tmp -xf download-cache/dist/yarn-$(YARN_VERSION).tar.gz
+	mv $@/tmp/dist/* $@
+	$(RM) -r $@/tmp
+
+yarn.lock: package.json | $(YARN_BUILD)
+	$(YARN) install --offline
+	# We don't use YUI's Flash components and they have a bad security
 	# record. Kill them.
-	find $@/tmp/yui/build -name '*.swf' -delete
-	mv $@/tmp/yui/build/* $@
-	$(RM) -r $@/tmp
+	find node_modules/yui -name '*.swf' -delete
 
-$(YUI_DEFAULT_SYMLINK): $(YUI_BUILDS)
-	ln -sfn $(YUI_DEFAULT) $@
+$(YUI_SYMLINK): yarn.lock
+	ln -sfn ../../node_modules/yui $@
 
 $(LP_JS_BUILD): | $(JS_BUILD_DIR)
 	-mkdir $@
@@ -181,7 +184,7 @@
 	find $@ -name 'tests' -type d | xargs rm -rf
 	bin/lpjsmin -p $@
 
-jsbuild: $(LP_JS_BUILD) $(YUI_DEFAULT_SYMLINK)
+jsbuild: $(LP_JS_BUILD) $(YUI_SYMLINK)
 	utilities/js-deps -n LP_MODULES -s build/js/lp -x '-min.js' -o \
 	build/js/lp/meta.js >/dev/null
 	utilities/check-js-deps
@@ -339,7 +342,7 @@
 
 clean_js:
 	$(RM) -r $(JS_BUILD_DIR)
-	$(RM) -r yui # Remove obsolete top-level directory for now.
+	$(RM) -r node_modules .yarn.lock
 
 clean_buildout:
 	$(RM) -r build
@@ -348,7 +351,6 @@
 	$(RM) -r parts
 	$(RM) -r develop-eggs
 	$(RM) .installed.cfg
-	$(RM) -r yui/*
 
 clean_logs:
 	$(RM) logs/thread*.request

=== 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-07-20 17:41:37 +0000
@@ -1,5 +1,4 @@
 @import url("../../../../canonical/launchpad/icing/import.css");
-@import url("../../../../canonical/launchpad/icing/yui/assets/skins/sam/skin.css");
 @import url("../../../../canonical/launchpad/icing/yui/cssreset/reset.css");
 @import url("../../../../canonical/launchpad/icing/yui/cssfonts/fonts.css");
 @import url("../../../../canonical/launchpad/icing/yui/cssbase/base.css");

=== modified file 'lib/lp/scripts/utilities/js/combinecss.py'
--- lib/lp/scripts/utilities/js/combinecss.py	2017-01-18 00:55:27 +0000
+++ lib/lp/scripts/utilities/js/combinecss.py	2017-07-20 17:41:37 +0000
@@ -16,9 +16,9 @@
     'ubuntu-webfonts.css',
     'style.css',
     'yui/cssreset/cssreset.css',
-    'yui/assets/skins/sam/calendar-base.css',
-    'yui/assets/skins/sam/calendar.css',
-    'yui/assets/skins/sam/calendarnavigator.css',
+    'yui/calendar-base/assets/skins/sam/calendar-base.css',
+    'yui/calendar/assets/skins/sam/calendar.css',
+    'yui/calendarnavigator/assets/skins/sam/calendarnavigator.css',
     # Since the old cssgrids uses yui-, and the new uses yui3-, it is only
     # used for the calendar.
     'yui/cssgrids/cssgrids.css',

=== 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-07-20 17:41:37 +0000
@@ -232,8 +232,6 @@
         <html>
           <head>
           <title>YUI XHR Tests</title>
-          <link rel="stylesheet"
-            href="/+icing/yui/assets/skins/sam/skin.css"/>
           <link rel="stylesheet" href="/+icing/rev%(revision)s/combo.css"/>
           <style>
           ul {

=== added file 'package.json'
--- package.json	1970-01-01 00:00:00 +0000
+++ package.json	2017-07-20 17:41:37 +0000
@@ -0,0 +1,15 @@
+{
+  "name": "launchpad",
+  "version": "0.0.0",
+  "description": "Launchpad",
+  "main": "index.js",
+  "repository": {
+    "type": "bzr",
+    "url": "https://bazaar.launchpad.net/+branch/launchpad";
+  },
+  "author": "Canonical Ltd.",
+  "license": "AGPL-3.0",
+  "dependencies": {
+    "yui": "3.10.3"
+  }
+}


Follow ups