mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 11:56:36 +00:00
Adapted the CLI download script.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
cd94608aee
commit
c6311ecb1d
@ -12,6 +12,7 @@
|
|||||||
"@theia/core": "next",
|
"@theia/core": "next",
|
||||||
"@theia/editor": "next",
|
"@theia/editor": "next",
|
||||||
"@theia/filesystem": "next",
|
"@theia/filesystem": "next",
|
||||||
|
"@theia/git": "next",
|
||||||
"@theia/languages": "next",
|
"@theia/languages": "next",
|
||||||
"@theia/markers": "next",
|
"@theia/markers": "next",
|
||||||
"@theia/monaco": "next",
|
"@theia/monaco": "next",
|
||||||
@ -19,7 +20,6 @@
|
|||||||
"@theia/workspace": "next",
|
"@theia/workspace": "next",
|
||||||
"@theia/navigator": "next",
|
"@theia/navigator": "next",
|
||||||
"@theia/terminal": "next",
|
"@theia/terminal": "next",
|
||||||
"@theia/git": "next",
|
|
||||||
"@theia/search-in-workspace": "next",
|
"@theia/search-in-workspace": "next",
|
||||||
"@types/ps-tree": "^1.1.0",
|
"@types/ps-tree": "^1.1.0",
|
||||||
"@types/which": "^1.3.1",
|
"@types/which": "^1.3.1",
|
||||||
@ -40,11 +40,12 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"decompress": "^4.2.0",
|
"decompress": "^4.2.0",
|
||||||
"decompress-tarbz2": "^4.1.1",
|
"decompress-targz": "^4.1.1",
|
||||||
"decompress-unzip": "^4.0.1",
|
"decompress-unzip": "^4.0.1",
|
||||||
"download": "^7.1.0",
|
"download": "^7.1.0",
|
||||||
"grpc-tools": "^1.7.3",
|
"grpc-tools": "^1.7.3",
|
||||||
"grpc_tools_node_protoc_ts": "^2.5.0",
|
"grpc_tools_node_protoc_ts": "^2.5.0",
|
||||||
|
"moment": "^2.24.0",
|
||||||
"ncp": "^2.0.0",
|
"ncp": "^2.0.0",
|
||||||
"rimraf": "^2.6.1",
|
"rimraf": "^2.6.1",
|
||||||
"shelljs": "^0.8.3",
|
"shelljs": "^0.8.3",
|
||||||
|
@ -1,11 +1,16 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
// The links to the downloads as of today (11.08.) are the followings:
|
// The links to the downloads as of today (19.08.) are the followings:
|
||||||
// - https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli-nightly-latest-${FILE_NAME}
|
// In order to get the latest nightly build for your platform use the following links replacing <DATE> with the current date, using the format YYYYMMDD (i.e for 2019/Aug/06 use 20190806 )
|
||||||
// - https://downloads.arduino.cc/arduino-cli/arduino-cli-latest-${FILE_NAME}
|
// Linux 64 bit: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-<DATE>_Linux_64bit.tar.gz
|
||||||
|
// Linux ARM 64 bit: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-<DATE>_Linux_ARM64.tar.gz
|
||||||
|
// Windows 64 bit: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-<DATE>_Windows_64bit.zip
|
||||||
|
// Mac OSX: https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-<DATE>_macOS_64bit.tar.gz
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
||||||
const DEFAULT_VERSION = 'nightly';
|
// TODO: currently, the download dates are one day behind.
|
||||||
|
// https://typefox.slack.com/archives/CJJHJCJSJ/p1567062276016400
|
||||||
|
const DEFAULT_VERSION = require('moment')().subtract(1, 'day').format('YYYYMMDD');
|
||||||
|
|
||||||
const os = require('os');
|
const os = require('os');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
@ -14,7 +19,7 @@
|
|||||||
const download = require('download');
|
const download = require('download');
|
||||||
const decompress = require('decompress');
|
const decompress = require('decompress');
|
||||||
const unzip = require('decompress-unzip');
|
const unzip = require('decompress-unzip');
|
||||||
const untarbz = require('decompress-tarbz2');
|
const untargz = require('decompress-targz');
|
||||||
|
|
||||||
process.on('unhandledRejection', (reason, _) => {
|
process.on('unhandledRejection', (reason, _) => {
|
||||||
shell.echo(String(reason));
|
shell.echo(String(reason));
|
||||||
@ -31,11 +36,7 @@
|
|||||||
.option('cli-version', {
|
.option('cli-version', {
|
||||||
alias: 'cv',
|
alias: 'cv',
|
||||||
default: DEFAULT_VERSION,
|
default: DEFAULT_VERSION,
|
||||||
choices: [
|
describe: `The version of the 'arduino-cli' to download with the YYYYMMDD format. Defaults to ${DEFAULT_VERSION}.`
|
||||||
// 'latest', // TODO: How do we get the source for `latest`. Currently, `latest` is the `0.3.7-alpha.preview`.
|
|
||||||
'nightly'
|
|
||||||
],
|
|
||||||
describe: `The version of the 'arduino-cli' to download. Defaults to ${DEFAULT_VERSION}.`
|
|
||||||
})
|
})
|
||||||
.option('force-download', {
|
.option('force-download', {
|
||||||
alias: 'fd',
|
alias: 'fd',
|
||||||
@ -68,13 +69,12 @@
|
|||||||
|
|
||||||
const suffix = (() => {
|
const suffix = (() => {
|
||||||
switch (platform) {
|
switch (platform) {
|
||||||
case 'darwin': return 'macosx.zip';
|
case 'darwin': return 'macOS_64bit.tar.gz';
|
||||||
case 'win32': return 'windows.zip';
|
case 'win32': return 'Windows_64bit.zip';
|
||||||
case 'linux': {
|
case 'linux': {
|
||||||
switch (arch) {
|
switch (arch) {
|
||||||
case 'arm64': return 'linuxarm.tar.bz2';
|
case 'arm64': return 'Linux_ARM64.tar.gz';
|
||||||
case 'x32': return 'linux32.tar.bz2';
|
case 'x64': return 'Linux_64bit.tar.gz';
|
||||||
case 'x64': return 'linux64.tar.bz2';
|
|
||||||
default: return undefined;
|
default: return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +86,7 @@
|
|||||||
shell.exit(1);
|
shell.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = `https://downloads.arduino.cc/arduino-cli/${version === 'nightly' ? 'nightly/' : ''}arduino-cli-${version}-latest-${suffix}`;
|
const url = `https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-${version}_${suffix}`;
|
||||||
shell.echo(`>>> Downloading 'arduino-cli' from '${url}'...`);
|
shell.echo(`>>> Downloading 'arduino-cli' from '${url}'...`);
|
||||||
const data = await download(url);
|
const data = await download(url);
|
||||||
shell.echo(`<<< Download succeeded.`);
|
shell.echo(`<<< Download succeeded.`);
|
||||||
@ -94,16 +94,21 @@
|
|||||||
const files = await decompress(data, downloads, {
|
const files = await decompress(data, downloads, {
|
||||||
plugins: [
|
plugins: [
|
||||||
unzip(),
|
unzip(),
|
||||||
untarbz()
|
untargz()
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
shell.echo('<<< Decompressing succeeded.');
|
if (files.length === 0) {
|
||||||
|
|
||||||
if (files.length !== 1) {
|
|
||||||
shell.echo('Error ocurred when decompressing the CLI.');
|
shell.echo('Error ocurred when decompressing the CLI.');
|
||||||
shell.exit(1);
|
shell.exit(1);
|
||||||
}
|
}
|
||||||
if (shell.mv('-f', path.join(downloads, files[0].path), cli).code !== 0) {
|
const cliIndex = files.findIndex(f => f.path.startsWith('arduino-cli'));
|
||||||
|
if (cliIndex === -1) {
|
||||||
|
shell.echo('The downloaded artifact does not contains the CLI.');
|
||||||
|
shell.exit(1);
|
||||||
|
}
|
||||||
|
shell.echo('<<< Decompressing succeeded.');
|
||||||
|
|
||||||
|
if (shell.mv('-f', path.join(downloads, files[cliIndex].path), cli).code !== 0) {
|
||||||
shell.echo(`Could not move file to ${cli}.`);
|
shell.echo(`Could not move file to ${cli}.`);
|
||||||
shell.exit(1);
|
shell.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -4473,7 +4473,7 @@ decompress-tar@^4.0.0, decompress-tar@^4.1.0, decompress-tar@^4.1.1:
|
|||||||
is-stream "^1.1.0"
|
is-stream "^1.1.0"
|
||||||
tar-stream "^1.5.2"
|
tar-stream "^1.5.2"
|
||||||
|
|
||||||
decompress-tarbz2@^4.0.0, decompress-tarbz2@^4.1.1:
|
decompress-tarbz2@^4.0.0:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz#3082a5b880ea4043816349f378b56c516be1a39b"
|
resolved "https://registry.yarnpkg.com/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz#3082a5b880ea4043816349f378b56c516be1a39b"
|
||||||
integrity sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==
|
integrity sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==
|
||||||
@ -4484,7 +4484,7 @@ decompress-tarbz2@^4.0.0, decompress-tarbz2@^4.1.1:
|
|||||||
seek-bzip "^1.0.5"
|
seek-bzip "^1.0.5"
|
||||||
unbzip2-stream "^1.0.9"
|
unbzip2-stream "^1.0.9"
|
||||||
|
|
||||||
decompress-targz@^4.0.0:
|
decompress-targz@^4.0.0, decompress-targz@^4.1.1:
|
||||||
version "4.1.1"
|
version "4.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/decompress-targz/-/decompress-targz-4.1.1.tgz#c09bc35c4d11f3de09f2d2da53e9de23e7ce1eee"
|
resolved "https://registry.yarnpkg.com/decompress-targz/-/decompress-targz-4.1.1.tgz#c09bc35c4d11f3de09f2d2da53e9de23e7ce1eee"
|
||||||
integrity sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==
|
integrity sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==
|
||||||
@ -8098,7 +8098,7 @@ modify-values@^1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
|
resolved "https://registry.yarnpkg.com/modify-values/-/modify-values-1.0.1.tgz#b3939fa605546474e3e3e3c63d64bd43b4ee6022"
|
||||||
integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==
|
integrity sha512-xV2bxeN6F7oYjZWTe/YPAy6MN2M+sL4u/Rlm2AHCIVGfo2p1yGmBHQ6vHehl4bRTZBdHu3TSkWdYgkwpYzAGSw==
|
||||||
|
|
||||||
moment@^2.10.6, moment@^2.18.1, moment@^2.21.0:
|
moment@^2.10.6, moment@^2.18.1, moment@^2.21.0, moment@^2.24.0:
|
||||||
version "2.24.0"
|
version "2.24.0"
|
||||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
|
resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b"
|
||||||
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
|
integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==
|
||||||
|
Loading…
x
Reference in New Issue
Block a user