From 11b01b35bb31396ea25bafe854723e4004957eb8 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Wed, 17 Jul 2019 12:15:57 -0400 Subject: [PATCH 1/4] Update default Node.js version to 'lts/*' --- lib/travis/build/script/node_js.rb | 2 +- spec/build/script/node_js_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/travis/build/script/node_js.rb b/lib/travis/build/script/node_js.rb index 7b8cb30e12..63eaab89a7 100644 --- a/lib/travis/build/script/node_js.rb +++ b/lib/travis/build/script/node_js.rb @@ -4,7 +4,7 @@ module Travis module Build class Script class NodeJs < Script - DEFAULT_VERSION = '0.10' + DEFAULT_VERSION = 'lts/*' YARN_REQUIRED_NODE_VERSION = '4' diff --git a/spec/build/script/node_js_spec.rb b/spec/build/script/node_js_spec.rb index 5f4f0abcf3..ba90c81a1f 100644 --- a/spec/build/script/node_js_spec.rb +++ b/spec/build/script/node_js_spec.rb @@ -84,11 +84,11 @@ let(:sexp) { sexp_filter(subject, [:if, '-f .nvmrc'], [:else]) } it 'sets the version to 0.10' do - expect(sexp).to include_sexp [:cmd, 'nvm install 0.10', echo: true, timing: true] + expect(sexp).to include_sexp [:cmd, 'nvm install lts/*', echo: true, timing: true] end it 'sets TRAVIS_NODE_VERSION to 0.10' do - expect(sexp).to include_sexp [:export, ['TRAVIS_NODE_VERSION', '0.10']] + expect(sexp).to include_sexp [:export, ['TRAVIS_NODE_VERSION', 'lts/*']] end end end From 4f43765fc83f684571d05c0ffe9f0b4008c2f036 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Wed, 17 Jul 2019 14:16:47 -0400 Subject: [PATCH 2/4] Set default Node.js version more consistently So that nvs can also use it. --- lib/travis/build/script/node_js.rb | 6 ++++-- lib/travis/build/script/node_js/manager/nvm.rb | 2 +- spec/build/script/node_js_spec.rb | 10 +++++++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/travis/build/script/node_js.rb b/lib/travis/build/script/node_js.rb index 63eaab89a7..a238259131 100644 --- a/lib/travis/build/script/node_js.rb +++ b/lib/travis/build/script/node_js.rb @@ -4,7 +4,9 @@ module Travis module Build class Script class NodeJs < Script - DEFAULT_VERSION = 'lts/*' + DEFAULTS = { + node_js: 'lts/*', + } YARN_REQUIRED_NODE_VERSION = '4' @@ -126,7 +128,7 @@ def version end def node_js_given_in_config? - !!config[:node_js] + !data.language_default_p end private diff --git a/lib/travis/build/script/node_js/manager/nvm.rb b/lib/travis/build/script/node_js/manager/nvm.rb index a2de1df75e..1153423897 100644 --- a/lib/travis/build/script/node_js/manager/nvm.rb +++ b/lib/travis/build/script/node_js/manager/nvm.rb @@ -41,7 +41,7 @@ def use_default install_version '$(< .nvmrc)' end sh.else do - install_version Travis::Build::Script::NodeJs::DEFAULT_VERSION + install_version version end end diff --git a/spec/build/script/node_js_spec.rb b/spec/build/script/node_js_spec.rb index ba90c81a1f..6ebb2b4333 100644 --- a/spec/build/script/node_js_spec.rb +++ b/spec/build/script/node_js_spec.rb @@ -87,7 +87,7 @@ expect(sexp).to include_sexp [:cmd, 'nvm install lts/*', echo: true, timing: true] end - it 'sets TRAVIS_NODE_VERSION to 0.10' do + it 'sets TRAVIS_NODE_VERSION to lts/*' do expect(sexp).to include_sexp [:export, ['TRAVIS_NODE_VERSION', 'lts/*']] end end @@ -162,5 +162,13 @@ expect(subject).to include_sexp [:cmd, "nvs add 0.10", assert: true, echo: true, timing: true] end end + + context 'when no node_js version is given' do + let(:config) { {} } + + it "installs lts" do + expect(subject).to include_sexp [:cmd, "nvs add lts/*", assert: true, echo: true, timing: true] + end + end end end From 8a99e8bbb4cd2ec713cc4886e390bb93100b8129 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Mon, 5 Aug 2019 10:48:10 -0400 Subject: [PATCH 3/4] Warn upcoming Node.js default version change and switch the default back to '0.10' --- lib/travis/build/script/node_js.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/travis/build/script/node_js.rb b/lib/travis/build/script/node_js.rb index a238259131..eef5dcb9a8 100644 --- a/lib/travis/build/script/node_js.rb +++ b/lib/travis/build/script/node_js.rb @@ -5,9 +5,18 @@ module Build class Script class NodeJs < Script DEFAULTS = { - node_js: 'lts/*', + node_js: '0.10', } + DEPRECATIONS = [ + { + name: 'Node.js', + current_default: '0.10', + new_default: 'lts/*', + cutoff_date: '2019-09-01', + } + ] + YARN_REQUIRED_NODE_VERSION = '4' NPM_CI_CMD_VERSION = '5.8.0' From 524796acd8e37f772e9347c0e1493e5bd2e38b73 Mon Sep 17 00:00:00 2001 From: Hiro Asari Date: Mon, 5 Aug 2019 10:55:34 -0400 Subject: [PATCH 4/4] Revert specs back to 0.10 as default --- spec/build/script/node_js_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/build/script/node_js_spec.rb b/spec/build/script/node_js_spec.rb index 6ebb2b4333..61e30cd807 100644 --- a/spec/build/script/node_js_spec.rb +++ b/spec/build/script/node_js_spec.rb @@ -84,11 +84,11 @@ let(:sexp) { sexp_filter(subject, [:if, '-f .nvmrc'], [:else]) } it 'sets the version to 0.10' do - expect(sexp).to include_sexp [:cmd, 'nvm install lts/*', echo: true, timing: true] + expect(sexp).to include_sexp [:cmd, 'nvm install 0.10', echo: true, timing: true] end - it 'sets TRAVIS_NODE_VERSION to lts/*' do - expect(sexp).to include_sexp [:export, ['TRAVIS_NODE_VERSION', 'lts/*']] + it 'sets TRAVIS_NODE_VERSION to 0.10' do + expect(sexp).to include_sexp [:export, ['TRAVIS_NODE_VERSION', '0.10']] end end end @@ -166,8 +166,8 @@ context 'when no node_js version is given' do let(:config) { {} } - it "installs lts" do - expect(subject).to include_sexp [:cmd, "nvs add lts/*", assert: true, echo: true, timing: true] + it "installs 0.10" do + expect(subject).to include_sexp [:cmd, "nvs add 0.10", assert: true, echo: true, timing: true] end end end