-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add node fixer * Update node versions * Rename chunks
- Loading branch information
Showing
5 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const os = require('os'); | ||
const util = require('util'); | ||
const exec = util.promisify(require('child_process').exec); | ||
|
||
exports.register = async (fixers) => { | ||
const { stdout, stderr } = await exec('bash -lc ". ~/.nvm/nvm.sh && nvm ls-remote --no-colors"'); | ||
if (stderr) { | ||
throw stderr; | ||
} | ||
|
||
const minorVersionReplacements = {}; | ||
for (const line of stdout.split('\n')) { | ||
const match = line.trim().match(/^[->]*\s*([a-z1-9\.]+-)?v(\d+\.)(\d+\.\d+)\s*.*$/); | ||
if (!match || match[2] === '0.') { | ||
// Unsupported format, or unsupported version (e.g. Node.js v0). | ||
continue; | ||
} | ||
|
||
const prefix = match[1] ? match[1] + 'v' : ''; | ||
const pattern = (prefix + match[2]).replace(/\./g, '\\.') + '[0-9][0-9]*\\.[0-9][0-9]*'; | ||
minorVersionReplacements[pattern] = prefix + match[2] + match[3]; | ||
} | ||
|
||
fixers[0].push({ | ||
id: 'upgrade-lang-node', | ||
cmd: Object.keys(minorVersionReplacements).map(pattern => { | ||
return `sed ${os.type() === 'Darwin' ? '-i "" -E' : '-i -e'} "s/\\(NODE_VERSION.*\\)${pattern}/\\1${minorVersionReplacements[pattern]}/g" chunks/lang-node/chunk.yaml`; | ||
}).join('\n'), | ||
description: 'update lang-node', | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
variants: | ||
- name: "16.13.2" | ||
- name: "16" | ||
args: | ||
NODE_VERSION: 16.13.2 | ||
- name: "17.4.0" | ||
NODE_VERSION: 16.14.2 | ||
- name: "17" | ||
args: | ||
NODE_VERSION: 17.4.0 | ||
NODE_VERSION: 17.8.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters