Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit fe416be

Browse files
author
Akos Kitta
committedOct 5, 2023
chore(deps): update to Theia 1.42.1
- update translation VSIXs to `1.81.0`, - security: update dependencies, - remove `shelljs` Signed-off-by: Akos Kitta <[email protected]>
1 parent 8f4bcc8 commit fe416be

19 files changed

+1823
-3110
lines changed
 

‎arduino-ide-extension/package.json

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,27 @@
2424
},
2525
"dependencies": {
2626
"@grpc/grpc-js": "^1.8.14",
27-
"@theia/application-package": "1.41.0",
28-
"@theia/core": "1.41.0",
29-
"@theia/debug": "1.41.0",
30-
"@theia/editor": "1.41.0",
31-
"@theia/electron": "1.41.0",
32-
"@theia/filesystem": "1.41.0",
33-
"@theia/keymaps": "1.41.0",
34-
"@theia/markers": "1.41.0",
35-
"@theia/messages": "1.41.0",
36-
"@theia/monaco": "1.41.0",
27+
"@theia/application-package": "1.42.1",
28+
"@theia/core": "1.42.1",
29+
"@theia/debug": "1.42.1",
30+
"@theia/editor": "1.42.1",
31+
"@theia/electron": "1.42.1",
32+
"@theia/filesystem": "1.42.1",
33+
"@theia/keymaps": "1.42.1",
34+
"@theia/markers": "1.42.1",
35+
"@theia/messages": "1.42.1",
36+
"@theia/monaco": "1.42.1",
3737
"@theia/monaco-editor-core": "1.72.3",
38-
"@theia/navigator": "1.41.0",
39-
"@theia/outline-view": "1.41.0",
40-
"@theia/output": "1.41.0",
41-
"@theia/plugin-ext": "1.41.0",
42-
"@theia/preferences": "1.41.0",
43-
"@theia/scm": "1.41.0",
44-
"@theia/search-in-workspace": "1.41.0",
45-
"@theia/terminal": "1.41.0",
46-
"@theia/typehierarchy": "1.41.0",
47-
"@theia/workspace": "1.41.0",
38+
"@theia/navigator": "1.42.1",
39+
"@theia/outline-view": "1.42.1",
40+
"@theia/output": "1.42.1",
41+
"@theia/plugin-ext": "1.42.1",
42+
"@theia/preferences": "1.42.1",
43+
"@theia/scm": "1.42.1",
44+
"@theia/search-in-workspace": "1.42.1",
45+
"@theia/terminal": "1.42.1",
46+
"@theia/typehierarchy": "1.42.1",
47+
"@theia/workspace": "1.42.1",
4848
"@tippyjs/react": "^4.2.5",
4949
"@types/auth0-js": "^9.14.0",
5050
"@types/btoa": "^1.2.3",
@@ -109,7 +109,7 @@
109109
"devDependencies": {
110110
"@octokit/rest": "^18.12.0",
111111
"@types/chai": "^4.2.7",
112-
"@types/mocha": "^5.2.7",
112+
"@types/mocha": "^10.0.0",
113113
"@types/react-window": "^1.8.5",
114114
"@xhmikosr/downloader": "^13.0.1",
115115
"chai": "^4.2.0",
@@ -118,18 +118,15 @@
118118
"decompress-tarbz2": "^4.1.1",
119119
"decompress-targz": "^4.1.1",
120120
"decompress-unzip": "^4.0.1",
121-
"grpc_tools_node_protoc_ts": "^4.1.0",
122-
"mocha": "^7.0.0",
121+
"grpc_tools_node_protoc_ts": "^5.3.3",
122+
"mocha": "^10.2.0",
123123
"mockdate": "^3.0.5",
124124
"moment": "^2.24.0",
125125
"ncp": "^2.0.0",
126-
"rimraf": "^2.6.1",
127-
"shelljs": "^0.8.3",
128-
"uuid": "^3.2.1",
129-
"yargs": "^11.1.0"
126+
"rimraf": "^2.6.1"
130127
},
131128
"optionalDependencies": {
132-
"grpc-tools": "^1.9.0",
129+
"grpc-tools": "^1.12.4",
133130
"protoc": "^1.0.4"
134131
},
135132
"mocha": {

‎arduino-ide-extension/scripts/download-cli.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
(async () => {
44
const path = require('path');
5-
const shell = require('shelljs');
65
const semver = require('semver');
76
const moment = require('moment');
87
const downloader = require('./downloader');
@@ -29,8 +28,8 @@
2928
})();
3029

3130
if (!version) {
32-
shell.echo(`Could not retrieve CLI version info from the 'package.json'.`);
33-
shell.exit(1);
31+
console.log(`Could not retrieve CLI version info from the 'package.json'.`);
32+
process.exit(1);
3433
}
3534

3635
const { platform, arch } = process;
@@ -71,24 +70,24 @@
7170
}
7271
})();
7372
if (!suffix) {
74-
shell.echo(`The CLI is not available for ${platform} ${arch}.`);
75-
shell.exit(1);
73+
console.log(`The CLI is not available for ${platform} ${arch}.`);
74+
process.exit(1);
7675
}
7776
if (semver.valid(version)) {
7877
const url = `https://downloads.arduino.cc/arduino-cli/arduino-cli_${version}_${suffix}`;
79-
shell.echo(
78+
console.log(
8079
`📦 Identified released version of the CLI. Downloading version ${version} from '${url}'`
8180
);
8281
await downloader.downloadUnzipFile(url, destinationPath, 'arduino-cli');
8382
} else if (moment(version, 'YYYYMMDD', true).isValid()) {
8483
const url = `https://downloads.arduino.cc/arduino-cli/nightly/arduino-cli_nightly-${version}_${suffix}`;
85-
shell.echo(
84+
console.log(
8685
`🌙 Identified nightly version of the CLI. Downloading version ${version} from '${url}'`
8786
);
8887
await downloader.downloadUnzipFile(url, destinationPath, 'arduino-cli');
8988
} else {
90-
shell.echo(`🔥 Could not interpret 'version': ${version}`);
91-
shell.exit(1);
89+
console.log(`🔥 Could not interpret 'version': ${version}`);
90+
process.exit(1);
9291
}
9392
} else {
9493
taskBuildFromGit(version, destinationPath, 'CLI');

‎arduino-ide-extension/scripts/download-examples.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ const version = '1.10.0';
55

66
(async () => {
77
const os = require('node:os');
8-
const { existsSync, promises: fs } = require('node:fs');
8+
const {
9+
existsSync,
10+
promises: fs,
11+
mkdirSync,
12+
readdirSync,
13+
cpSync,
14+
} = require('node:fs');
915
const path = require('node:path');
10-
const shell = require('shelljs');
11-
const { v4 } = require('uuid');
1216
const { exec } = require('./utils');
1317

1418
const destination = path.join(
@@ -20,31 +24,38 @@ const version = '1.10.0';
2024
'Examples'
2125
);
2226
if (existsSync(destination)) {
23-
shell.echo(
27+
console.log(
2428
`Skipping Git checkout of the examples because the repository already exists: ${destination}`
2529
);
2630
return;
2731
}
2832

29-
const repository = path.join(os.tmpdir(), `${v4()}-arduino-examples`);
30-
if (shell.mkdir('-p', repository).code !== 0) {
31-
shell.exit(1);
32-
}
33+
const repository = await fs.mkdtemp(
34+
path.join(os.tmpdir(), 'arduino-examples-')
35+
);
3336

3437
exec(
3538
'git',
3639
['clone', 'https://github.com/arduino/arduino-examples.git', repository],
37-
shell
40+
{ logStdout: true }
3841
);
3942

4043
exec(
4144
'git',
4245
['-C', repository, 'checkout', `tags/${version}`, '-b', version],
43-
shell
46+
{ logStdout: true }
4447
);
4548

46-
shell.mkdir('-p', destination);
47-
shell.cp('-fR', path.join(repository, 'examples', '*'), destination);
49+
mkdirSync(destination, { recursive: true });
50+
const examplesPath = path.join(repository, 'examples');
51+
const exampleResources = readdirSync(examplesPath);
52+
for (const exampleResource of exampleResources) {
53+
cpSync(
54+
path.join(examplesPath, exampleResource),
55+
path.join(destination, exampleResource),
56+
{ recursive: true }
57+
);
58+
}
4859

4960
const isSketch = async (pathLike) => {
5061
try {
@@ -104,5 +115,5 @@ const version = '1.10.0';
104115
JSON.stringify(examples, null, 2),
105116
{ encoding: 'utf8' }
106117
);
107-
shell.echo(`Generated output to ${path.join(destination, 'examples.json')}`);
118+
console.log(`Generated output to ${path.join(destination, 'examples.json')}`);
108119
})();

‎arduino-ide-extension/scripts/download-fwuploader.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
(async () => {
44
const path = require('node:path');
5-
const shell = require('shelljs');
65
const semver = require('semver');
76
const downloader = require('./downloader');
87
const { taskBuildFromGit } = require('./utils');
@@ -28,10 +27,10 @@
2827
})();
2928

3029
if (!version) {
31-
shell.echo(
30+
console.log(
3231
`Could not retrieve Firmware Uploader version info from the 'package.json'.`
3332
);
34-
shell.exit(1);
33+
process.exit(1);
3534
}
3635

3736
const { platform, arch } = process;
@@ -71,14 +70,14 @@
7170
}
7271
})();
7372
if (!suffix) {
74-
shell.echo(
73+
console.log(
7574
`The Firmware Uploader is not available for ${platform} ${arch}.`
7675
);
77-
shell.exit(1);
76+
process.exit(1);
7877
}
7978
if (semver.valid(version)) {
8079
const url = `https://downloads.arduino.cc/arduino-fwuploader/arduino-fwuploader_${version}_${suffix}`;
81-
shell.echo(
80+
console.log(
8281
`📦 Identified released version of the Firmware Uploader. Downloading version ${version} from '${url}'`
8382
);
8483
await downloader.downloadUnzipFile(
@@ -87,8 +86,8 @@
8786
'arduino-fwuploader'
8887
);
8988
} else {
90-
shell.echo(`🔥 Could not interpret 'version': ${version}`);
91-
shell.exit(1);
89+
console.log(`🔥 Could not interpret 'version': ${version}`);
90+
process.exit(1);
9291
}
9392
} else {
9493
taskBuildFromGit(version, destinationPath, 'Firmware Uploader');

‎arduino-ide-extension/scripts/download-ls.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
(() => {
77
const path = require('path');
8-
const shell = require('shelljs');
98
const downloader = require('./downloader');
109
const { goBuildFromGit } = require('./utils');
1110

@@ -25,20 +24,20 @@
2524
})();
2625

2726
if (!DEFAULT_LS_VERSION) {
28-
shell.echo(
27+
console.log(
2928
`Could not retrieve Arduino Language Server version info from the 'package.json'.`
3029
);
31-
shell.exit(1);
30+
process.exit(1);
3231
}
3332

3433
if (!DEFAULT_CLANGD_VERSION) {
35-
shell.echo(
34+
console.log(
3635
`Could not retrieve clangd version info from the 'package.json'.`
3736
);
38-
shell.exit(1);
37+
process.exit(1);
3938
}
4039

41-
const yargs = require('yargs')
40+
const yargs = require('@theia/core/shared/yargs')
4241
.option('ls-version', {
4342
alias: 'lv',
4443
default: DEFAULT_LS_VERSION,
@@ -114,10 +113,10 @@
114113
throw new Error(`Unsupported platform/arch: ${platformArch}.`);
115114
}
116115
if (!lsSuffix || !clangdSuffix) {
117-
shell.echo(
116+
console.log(
118117
`The arduino-language-server is not available for ${platform} ${arch}.`
119118
);
120-
shell.exit(1);
119+
process.exit(1);
121120
}
122121

123122
if (typeof lsVersion === 'string') {
Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1+
// @ts-check
2+
13
const fs = require('fs');
24
const path = require('path');
3-
const shell = require('shelljs');
45
const decompress = require('decompress');
56
const unzip = require('decompress-unzip');
67
const untargz = require('decompress-targz');
78
const untarbz2 = require('decompress-tarbz2');
89

9-
process.on('unhandledRejection', (reason, _) => {
10-
shell.echo(String(reason));
11-
shell.exit(1);
12-
throw reason;
10+
process.on('unhandledRejection', (reason) => {
11+
console.log(String(reason));
12+
process.exit(1);
1313
});
1414
process.on('uncaughtException', (error) => {
15-
shell.echo(String(error));
16-
shell.exit(1);
17-
throw error;
15+
console.log(String(error));
16+
process.exit(1);
1817
});
1918

2019
/**
@@ -30,63 +29,50 @@ exports.downloadUnzipFile = async (
3029
force = false
3130
) => {
3231
if (fs.existsSync(targetFile) && !force) {
33-
shell.echo(`Skipping download because file already exists: ${targetFile}`);
32+
console.log(`Skipping download because file already exists: ${targetFile}`);
3433
return;
3534
}
36-
if (!fs.existsSync(path.dirname(targetFile))) {
37-
if (shell.mkdir('-p', path.dirname(targetFile)).code !== 0) {
38-
shell.echo('Could not create new directory.');
39-
shell.exit(1);
40-
}
41-
}
35+
fs.mkdirSync(path.dirname(targetFile), { recursive: true });
4236

4337
const downloads = path.join(__dirname, '..', 'downloads');
44-
if (shell.rm('-rf', targetFile, downloads).code !== 0) {
45-
shell.exit(1);
46-
}
38+
fs.rmSync(targetFile, { recursive: true, force: true });
39+
fs.rmSync(downloads, { recursive: true, force: true });
4740

48-
shell.echo(`>>> Downloading from '${url}'...`);
49-
const { default: download } = await import('@xhmikosr/downloader');
41+
console.log(`>>> Downloading from '${url}'...`);
5042
const data = await download(url);
51-
shell.echo(`<<< Download succeeded.`);
43+
console.log(`<<< Download succeeded.`);
5244

53-
shell.echo('>>> Decompressing...');
45+
console.log('>>> Decompressing...');
5446
const files = await decompress(data, downloads, {
5547
plugins: [unzip(), untargz(), untarbz2()],
5648
});
5749
if (files.length === 0) {
58-
shell.echo('Error ocurred while decompressing the archive.');
59-
shell.exit(1);
50+
console.log('Error ocurred while decompressing the archive.');
51+
process.exit(1);
6052
}
6153
const fileIndex = files.findIndex((f) => f.path.startsWith(filePrefix));
6254
if (fileIndex === -1) {
63-
shell.echo(
55+
console.log(
6456
`The downloaded artifact does not contain any file with prefix ${filePrefix}.`
6557
);
66-
shell.exit(1);
58+
process.exit(1);
6759
}
68-
shell.echo('<<< Decompressing succeeded.');
60+
console.log('<<< Decompressing succeeded.');
6961

70-
if (
71-
shell.mv('-f', path.join(downloads, files[fileIndex].path), targetFile)
72-
.code !== 0
73-
) {
74-
shell.echo(`Could not move file to target path: ${targetFile}`);
75-
shell.exit(1);
76-
}
62+
fs.renameSync(path.join(downloads, files[fileIndex].path), targetFile);
7763
if (!fs.existsSync(targetFile)) {
78-
shell.echo(`Could not find file: ${targetFile}`);
79-
shell.exit(1);
64+
console.log(`Could not find file: ${targetFile}`);
65+
process.exit(1);
8066
}
81-
shell.echo(`Done: ${targetFile}`);
67+
console.log(`Done: ${targetFile}`);
8268
};
8369

8470
/**
8571
* @param url {string} Download URL
8672
* @param targetDir {string} Directory into which to decompress the archive
8773
* @param targetFile {string} Path to the main file expected after decompressing
8874
* @param force {boolean} Whether to download even if the target file exists
89-
* @param decompressOptions {import('decompress').DecompressOptions}
75+
* @param decompressOptions {import('decompress').DecompressOptions|undefined} [decompressOptions]
9076
*/
9177
exports.downloadUnzipAll = async (
9278
url,
@@ -96,22 +82,16 @@ exports.downloadUnzipAll = async (
9682
decompressOptions = undefined
9783
) => {
9884
if (fs.existsSync(targetFile) && !force) {
99-
shell.echo(`Skipping download because file already exists: ${targetFile}`);
85+
console.log(`Skipping download because file already exists: ${targetFile}`);
10086
return;
10187
}
102-
if (!fs.existsSync(targetDir)) {
103-
if (shell.mkdir('-p', targetDir).code !== 0) {
104-
shell.echo('Could not create new directory.');
105-
shell.exit(1);
106-
}
107-
}
88+
fs.mkdirSync(targetDir, { recursive: true });
10889

109-
shell.echo(`>>> Downloading from '${url}'...`);
110-
const { default: download } = await import('@xhmikosr/downloader');
90+
console.log(`>>> Downloading from '${url}'...`);
11191
const data = await download(url);
112-
shell.echo(`<<< Download succeeded.`);
92+
console.log(`<<< Download succeeded.`);
11393

114-
shell.echo('>>> Decompressing...');
94+
console.log('>>> Decompressing...');
11595
let options = {
11696
plugins: [unzip(), untargz(), untarbz2()],
11797
};
@@ -120,14 +100,27 @@ exports.downloadUnzipAll = async (
120100
}
121101
const files = await decompress(data, targetDir, options);
122102
if (files.length === 0) {
123-
shell.echo('Error ocurred while decompressing the archive.');
124-
shell.exit(1);
103+
console.log('Error ocurred while decompressing the archive.');
104+
process.exit(1);
125105
}
126-
shell.echo('<<< Decompressing succeeded.');
106+
console.log('<<< Decompressing succeeded.');
127107

128108
if (!fs.existsSync(targetFile)) {
129-
shell.echo(`Could not find file: ${targetFile}`);
130-
shell.exit(1);
109+
console.log(`Could not find file: ${targetFile}`);
110+
process.exit(1);
131111
}
132-
shell.echo(`Done: ${targetFile}`);
112+
console.log(`Done: ${targetFile}`);
133113
};
114+
115+
/**
116+
* @param {string} url
117+
* @returns {Promise<import('node:buffer').Buffer>}
118+
*/
119+
async function download(url) {
120+
const { default: download } = await import('@xhmikosr/downloader');
121+
/** @type {import('node:buffer').Buffer} */
122+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
123+
// @ts-ignore
124+
const data = await download(url);
125+
return data;
126+
}

‎arduino-ide-extension/scripts/generate-protocol.js

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@
33
(async () => {
44
const os = require('node:os');
55
const path = require('node:path');
6+
const { mkdirSync, promises: fs } = require('node:fs');
67
const { exec } = require('./utils');
78
const glob = require('glob');
8-
const { v4 } = require('uuid');
9-
const shell = require('shelljs');
109
const protoc = path.dirname(require('protoc/protoc'));
1110

12-
const repository = path.join(os.tmpdir(), `${v4()}-arduino-cli`);
13-
if (shell.mkdir('-p', repository).code !== 0) {
14-
shell.exit(1);
15-
}
11+
const repository = await fs.mkdtemp(path.join(os.tmpdir(), 'arduino-cli-'));
1612

1713
const { owner, repo, commitish } = (() => {
1814
const pkg = require(path.join(__dirname, '..', 'package.json'));
1915
if (!pkg) {
20-
shell.echo(`Could not parse the 'package.json'.`);
21-
shell.exit(1);
16+
console.log(`Could not parse the 'package.json'.`);
17+
process.exit(1);
2218
}
2319

2420
const defaultVersion = {
@@ -48,21 +44,21 @@
4844
// We assume an object with `owner`, `repo`, commitish?` properties.
4945
const { owner, repo, commitish } = version;
5046
if (!owner) {
51-
shell.echo(`Could not retrieve 'owner' from ${JSON.stringify(version)}`);
52-
shell.exit(1);
47+
console.log(`Could not retrieve 'owner' from ${JSON.stringify(version)}`);
48+
process.exit(1);
5349
}
5450
if (!repo) {
55-
shell.echo(`Could not retrieve 'repo' from ${JSON.stringify(version)}`);
56-
shell.exit(1);
51+
console.log(`Could not retrieve 'repo' from ${JSON.stringify(version)}`);
52+
process.exit(1);
5753
}
5854

5955
return { owner, repo, commitish };
6056
})();
6157

6258
const url = `https://github.com/${owner}/${repo}.git`;
63-
shell.echo(`>>> Cloning repository from '${url}'...`);
64-
exec('git', ['clone', url, repository], shell);
65-
shell.echo(`<<< Repository cloned.`);
59+
console.log(`>>> Cloning repository from '${url}'...`);
60+
exec('git', ['clone', url, repository], { logStdout: true });
61+
console.log(`<<< Repository cloned.`);
6662

6763
const { platform } = process;
6864
const resourcesFolder = path.join(
@@ -76,10 +72,12 @@
7672
resourcesFolder,
7773
`arduino-cli${platform === 'win32' ? '.exe' : ''}`
7874
);
79-
const versionJson = exec(cli, ['version', '--format', 'json'], shell).trim();
75+
const versionJson = exec(cli, ['version', '--format', 'json'], {
76+
logStdout: true,
77+
}).trim();
8078
if (!versionJson) {
81-
shell.echo(`Could not retrieve the CLI version from ${cli}.`);
82-
shell.exit(1);
79+
console.log(`Could not retrieve the CLI version from ${cli}.`);
80+
process.exit(1);
8381
}
8482
// As of today (28.01.2021), the `VersionString` can be one of the followings:
8583
// - `nightly-YYYYMMDD` stands for the nightly build, we use the , the `commitish` from the `package.json` to check out the code.
@@ -103,58 +101,63 @@
103101
version !== '0.0.0-git' &&
104102
version !== 'git-snapshot'
105103
) {
106-
shell.echo(`>>> Checking out tagged version: '${version}'...`);
107-
exec('git', ['-C', repository, 'fetch', '--all', '--tags'], shell);
104+
console.log(`>>> Checking out tagged version: '${version}'...`);
105+
exec('git', ['-C', repository, 'fetch', '--all', '--tags'], {
106+
logStdout: true,
107+
});
108108
exec(
109109
'git',
110110
['-C', repository, 'checkout', `tags/${version}`, '-b', version],
111-
shell
111+
{ logStdout: true }
112112
);
113-
shell.echo(`<<< Checked out tagged version: '${version}'.`);
113+
console.log(`<<< Checked out tagged version: '${version}'.`);
114114
} else if (commitish) {
115-
shell.echo(
115+
console.log(
116116
`>>> Checking out commitish from 'package.json': '${commitish}'...`
117117
);
118-
exec('git', ['-C', repository, 'checkout', commitish], shell);
119-
shell.echo(
118+
exec('git', ['-C', repository, 'checkout', commitish], { logStdout: true });
119+
console.log(
120120
`<<< Checked out commitish from 'package.json': '${commitish}'.`
121121
);
122122
} else if (versionObject.Commit) {
123-
shell.echo(
123+
console.log(
124124
`>>> Checking out commitish from the CLI: '${versionObject.Commit}'...`
125125
);
126-
exec('git', ['-C', repository, 'checkout', versionObject.Commit], shell);
127-
shell.echo(
126+
exec('git', ['-C', repository, 'checkout', versionObject.Commit], {
127+
logStdout: true,
128+
});
129+
console.log(
128130
`<<< Checked out commitish from the CLI: '${versionObject.Commit}'.`
129131
);
130132
} else {
131-
shell.echo(`WARN: no 'git checkout'. Generating from the HEAD revision.`);
133+
console.log(`WARN: no 'git checkout'. Generating from the HEAD revision.`);
132134
}
133135

134-
shell.echo('>>> Generating TS/JS API from:');
135-
exec('git', ['-C', repository, 'rev-parse', '--abbrev-ref', 'HEAD'], shell);
136+
console.log('>>> Generating TS/JS API from:');
137+
exec('git', ['-C', repository, 'rev-parse', '--abbrev-ref', 'HEAD'], {
138+
logStdout: true,
139+
});
136140

137141
const rpc = path.join(repository, 'rpc');
138142
const out = path.join(__dirname, '..', 'src', 'node', 'cli-protocol');
139-
shell.mkdir('-p', out);
143+
mkdirSync(out, { recursive: true });
140144

141145
const protos = await new Promise((resolve) =>
142146
glob('**/*.proto', { cwd: rpc }, (error, matches) => {
143147
if (error) {
144-
shell.echo(error.stack ?? error.message);
148+
console.log(error.stack ?? error.message);
145149
resolve([]);
146150
return;
147151
}
148152
resolve(matches.map((filename) => path.join(rpc, filename)));
149153
})
150154
);
151155
if (!protos || protos.length === 0) {
152-
shell.echo(`Could not find any .proto files under ${rpc}.`);
153-
shell.exit(1);
156+
console.log(`Could not find any .proto files under ${rpc}.`);
157+
process.exit(1);
154158
}
155159

156160
// Generate JS code from the `.proto` files.
157-
158161
exec(
159162
'grpc_tools_node_protoc',
160163
[
@@ -164,7 +167,7 @@
164167
rpc,
165168
...protos,
166169
],
167-
shell
170+
{ logStdout: true }
168171
);
169172

170173
// Generate the `.d.ts` files for JS.
@@ -183,8 +186,8 @@
183186
rpc,
184187
...protos,
185188
],
186-
shell
189+
{ logStdout: true }
187190
);
188191

189-
shell.echo('<<< Generation was successful.');
192+
console.log('<<< Generation was successful.');
190193
})();

‎arduino-ide-extension/scripts/utils.js

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,21 @@
33
const exec = (
44
/** @type {string} */ command,
55
/** @type {readonly string[]} */ args,
6-
/** @type {import('shelljs')|undefined}*/ shell = undefined,
7-
/** @type {import('node:child_process').ExecFileSyncOptionsWithStringEncoding|undefined} */ options = undefined
6+
/** @type {Partial<import('node:child_process').ExecFileSyncOptionsWithStringEncoding> & { logStdout?: boolean }|undefined} */ options = undefined
87
) => {
98
try {
10-
const stdout = require('node:child_process').execFileSync(
11-
command,
12-
args,
13-
options ? options : { encoding: 'utf8' }
14-
);
15-
if (shell) {
16-
shell.echo(stdout.trim());
9+
const stdout = require('node:child_process').execFileSync(command, args, {
10+
encoding: 'utf8',
11+
...(options ?? {}),
12+
});
13+
if (options?.logStdout) {
14+
console.log(stdout.trim());
1715
}
1816
return stdout;
1917
} catch (err) {
20-
if (shell) {
21-
shell.echo(err instanceof Error ? err.message : String(err));
22-
shell.exit(1);
23-
}
18+
console.log(
19+
`Failed to execute ${command} with args: ${JSON.stringify(args)}`
20+
);
2421
throw err;
2522
}
2623
};
@@ -59,32 +56,31 @@ function buildFromGit(command, version, destinationPath, taskName) {
5956
const fs = require('node:fs');
6057
const path = require('node:path');
6158
const temp = require('temp');
62-
const shell = require('shelljs');
6359

6460
// We assume an object with `owner`, `repo`, commitish?` properties.
6561
if (typeof version !== 'object') {
66-
shell.echo(
62+
console.log(
6763
`Expected a \`{ owner, repo, commitish }\` object. Got <${version}> instead.`
6864
);
6965
}
7066
const { owner, repo, commitish } = version;
7167
if (!owner) {
72-
shell.echo(`Could not retrieve 'owner' from ${JSON.stringify(version)}`);
73-
shell.exit(1);
68+
console.log(`Could not retrieve 'owner' from ${JSON.stringify(version)}`);
69+
process.exit(1);
7470
}
7571
if (!repo) {
76-
shell.echo(`Could not retrieve 'repo' from ${JSON.stringify(version)}`);
77-
shell.exit(1);
72+
console.log(`Could not retrieve 'repo' from ${JSON.stringify(version)}`);
73+
process.exit(1);
7874
}
7975
const url = `https://github.com/${owner}/${repo}.git`;
80-
shell.echo(
76+
console.log(
8177
`Building ${taskName} from ${url}. Commitish: ${
8278
commitish ? commitish : 'HEAD'
8379
}`
8480
);
8581

8682
if (fs.existsSync(destinationPath)) {
87-
shell.echo(
83+
console.log(
8884
`Skipping the ${taskName} build because it already exists: ${destinationPath}`
8985
);
9086
return;
@@ -97,48 +93,51 @@ function buildFromGit(command, version, destinationPath, taskName) {
9793
'node',
9894
'resources'
9995
);
100-
if (shell.mkdir('-p', resourcesFolder).code !== 0) {
101-
shell.echo('Could not create resources folder.');
102-
shell.exit(1);
103-
}
96+
fs.mkdirSync(resourcesFolder, { recursive: true });
10497

10598
const tempRepoPath = temp.mkdirSync();
106-
shell.echo(`>>> Cloning ${taskName} source to ${tempRepoPath}...`);
107-
exec('git', ['clone', url, tempRepoPath], shell);
108-
shell.echo(`<<< Cloned ${taskName} repo.`);
99+
console.log(`>>> Cloning ${taskName} source to ${tempRepoPath}...`);
100+
exec('git', ['clone', url, tempRepoPath], { logStdout: true });
101+
console.log(`<<< Cloned ${taskName} repo.`);
109102

110103
if (commitish) {
111-
shell.echo(`>>> Checking out ${commitish}...`);
112-
exec('git', ['-C', tempRepoPath, 'checkout', commitish], shell);
113-
shell.echo(`<<< Checked out ${commitish}.`);
104+
console.log(`>>> Checking out ${commitish}...`);
105+
exec('git', ['-C', tempRepoPath, 'checkout', commitish], {
106+
logStdout: true,
107+
});
108+
console.log(`<<< Checked out ${commitish}.`);
114109
}
115110

116-
exec('git', ['-C', tempRepoPath, 'rev-parse', '--short', 'HEAD'], shell);
111+
exec('git', ['-C', tempRepoPath, 'rev-parse', '--short', 'HEAD'], {
112+
logStdout: true,
113+
});
117114

118-
shell.echo(`>>> Building the ${taskName}...`);
119-
exec(command, ['build'], shell, { cwd: tempRepoPath, encoding: 'utf8' });
120-
shell.echo(`<<< Done ${taskName} build.`);
115+
console.log(`>>> Building the ${taskName}...`);
116+
exec(command, ['build'], {
117+
cwd: tempRepoPath,
118+
encoding: 'utf8',
119+
logStdout: true,
120+
});
121+
console.log(`<<< Done ${taskName} build.`);
121122

122123
const binName = path.basename(destinationPath);
123124
if (!fs.existsSync(path.join(tempRepoPath, binName))) {
124-
shell.echo(
125+
console.log(
125126
`Could not find the ${taskName} at ${path.join(tempRepoPath, binName)}.`
126127
);
127-
shell.exit(1);
128+
process.exit(1);
128129
}
129130

130131
const binPath = path.join(tempRepoPath, binName);
131-
shell.echo(
132+
console.log(
132133
`>>> Copying ${taskName} from ${binPath} to ${destinationPath}...`
133134
);
134-
if (shell.cp(binPath, destinationPath).code !== 0) {
135-
shell.exit(1);
136-
}
137-
shell.echo(`<<< Copied the ${taskName}.`);
135+
fs.copyFileSync(binPath, destinationPath);
136+
console.log(`<<< Copied the ${taskName}.`);
138137

139-
shell.echo(`<<< Verifying ${taskName}...`);
138+
console.log(`<<< Verifying ${taskName}...`);
140139
if (!fs.existsSync(destinationPath)) {
141-
shell.exit(1);
140+
process.exit(1);
142141
}
143-
shell.echo(`>>> Verified ${taskName}.`);
142+
console.log(`>>> Verified ${taskName}.`);
144143
}

‎arduino-ide-extension/src/browser/theia/core/common-frontend-contribution.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ export class CommonFrontendContribution extends TheiaCommonFrontendContribution
2929
]) {
3030
commandRegistry.unregisterCommand(command);
3131
}
32+
commandRegistry.registerCommand(CommonCommands.NEW_UNTITLED_TEXT_FILE, {
33+
execute: () => {
34+
// register a noop command to avoid error when double-clicking in editor tabbar
35+
// https://github.com/eclipse-theia/theia/pull/12867
36+
},
37+
});
3238
}
3339

3440
override registerMenus(registry: MenuModelRegistry): void {

‎arduino-ide-extension/src/browser/theia/workspace/workspace-input-dialog.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { MaybePromise } from '@theia/core';
21
import { Dialog, DialogError } from '@theia/core/lib/browser/dialogs';
32
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
43
import { CancellationTokenSource } from '@theia/core/lib/common/cancellation';
@@ -10,13 +9,14 @@ import type {
109
Progress,
1110
ProgressUpdate,
1211
} from '@theia/core/lib/common/message-service-protocol';
12+
import type { MaybePromise } from '@theia/core/lib/common/types';
13+
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
1314
import { Widget } from '@theia/core/shared/@phosphor/widgets';
1415
import { inject } from '@theia/core/shared/inversify';
1516
import {
1617
WorkspaceInputDialog as TheiaWorkspaceInputDialog,
1718
WorkspaceInputDialogProps,
1819
} from '@theia/workspace/lib/browser/workspace-input-dialog';
19-
import { v4 } from 'uuid';
2020

2121
export class WorkspaceInputDialog extends TheiaWorkspaceInputDialog {
2222
private skipShowErrorMessageOnOpen: boolean;
@@ -161,7 +161,7 @@ export class WorkspaceInputDialogWithProgress<
161161

162162
const cancellationSource = new CancellationTokenSource();
163163
const progress: Progress = {
164-
id: v4(),
164+
id: UUID.uuid4(),
165165
cancel: () => cancellationSource.cancel(),
166166
report: (update: ProgressUpdate) => {
167167
this.setProgressMessage(update);

‎arduino-ide-extension/src/electron-browser/preload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
CHANNEL_REQUEST_RELOAD,
88
MenuDto,
99
} from '@theia/core/lib/electron-common/electron-api';
10-
import { v4 } from 'uuid';
10+
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
1111
import type { Sketch } from '../common/protocol/sketches-service';
1212
import {
1313
CHANNEL_APP_INFO,
@@ -43,7 +43,7 @@ function convertMenu(
4343
}
4444

4545
return menu.map((item) => {
46-
let nodeId = v4();
46+
let nodeId = UUID.uuid4();
4747
if (item.execute) {
4848
if (!item.id) {
4949
throw new Error(

‎arduino-ide-extension/src/node/board-discovery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ import { deepClone } from '@theia/core/lib/common/objects';
99
import { Deferred } from '@theia/core/lib/common/promise-util';
1010
import type { Mutable } from '@theia/core/lib/common/types';
1111
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
12+
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
1213
import { inject, injectable, named } from '@theia/core/shared/inversify';
1314
import { isDeepStrictEqual } from 'util';
14-
import { v4 } from 'uuid';
1515
import { Unknown } from '../common/nls';
1616
import {
1717
Board,
@@ -168,7 +168,7 @@ export class BoardDiscovery
168168
});
169169
const wrapper = {
170170
stream,
171-
uuid: v4(),
171+
uuid: UUID.uuid4(),
172172
dispose: () => {
173173
this.logger.info('disposing requesting cancel');
174174
// Cancelling the stream will kill the discovery `builtin:mdns-discovery process`.

‎arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,29 @@ export namespace LoadSketchRequest {
420420
}
421421
}
422422

423+
export class SketchProfile extends jspb.Message {
424+
getName(): string;
425+
setName(value: string): SketchProfile;
426+
getFqbn(): string;
427+
setFqbn(value: string): SketchProfile;
428+
429+
serializeBinary(): Uint8Array;
430+
toObject(includeInstance?: boolean): SketchProfile.AsObject;
431+
static toObject(includeInstance: boolean, msg: SketchProfile): SketchProfile.AsObject;
432+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
433+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
434+
static serializeBinaryToWriter(message: SketchProfile, writer: jspb.BinaryWriter): void;
435+
static deserializeBinary(bytes: Uint8Array): SketchProfile;
436+
static deserializeBinaryFromReader(message: SketchProfile, reader: jspb.BinaryReader): SketchProfile;
437+
}
438+
439+
export namespace SketchProfile {
440+
export type AsObject = {
441+
name: string,
442+
fqbn: string,
443+
}
444+
}
445+
423446
export class LoadSketchResponse extends jspb.Message {
424447
getMainFile(): string;
425448
setMainFile(value: string): LoadSketchResponse;
@@ -443,6 +466,15 @@ export class LoadSketchResponse extends jspb.Message {
443466
setDefaultPort(value: string): LoadSketchResponse;
444467
getDefaultProtocol(): string;
445468
setDefaultProtocol(value: string): LoadSketchResponse;
469+
clearProfilesList(): void;
470+
getProfilesList(): Array<SketchProfile>;
471+
setProfilesList(value: Array<SketchProfile>): LoadSketchResponse;
472+
addProfiles(value?: SketchProfile, index?: number): SketchProfile;
473+
474+
hasDefaultProfile(): boolean;
475+
clearDefaultProfile(): void;
476+
getDefaultProfile(): SketchProfile | undefined;
477+
setDefaultProfile(value?: SketchProfile): LoadSketchResponse;
446478

447479
serializeBinary(): Uint8Array;
448480
toObject(includeInstance?: boolean): LoadSketchResponse.AsObject;
@@ -464,6 +496,8 @@ export namespace LoadSketchResponse {
464496
defaultFqbn: string,
465497
defaultPort: string,
466498
defaultProtocol: string,
499+
profilesList: Array<SketchProfile.AsObject>,
500+
defaultProfile?: SketchProfile.AsObject,
467501
}
468502
}
469503

‎arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.js

Lines changed: 288 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.v1.NewSketchRequest', null, glo
5555
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.NewSketchResponse', null, global);
5656
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.SetSketchDefaultsRequest', null, global);
5757
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.SetSketchDefaultsResponse', null, global);
58+
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.SketchProfile', null, global);
5859
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.UpdateIndexRequest', null, global);
5960
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.UpdateIndexResponse', null, global);
6061
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.UpdateLibrariesIndexRequest', null, global);
@@ -418,6 +419,27 @@ if (goog.DEBUG && !COMPILED) {
418419
*/
419420
proto.cc.arduino.cli.commands.v1.LoadSketchRequest.displayName = 'proto.cc.arduino.cli.commands.v1.LoadSketchRequest';
420421
}
422+
/**
423+
* Generated by JsPbCodeGenerator.
424+
* @param {Array=} opt_data Optional initial data array, typically from a
425+
* server response, or constructed directly in Javascript. The array is used
426+
* in place and becomes part of the constructed object. It is not cloned.
427+
* If no data is provided, the constructed object will be empty, but still
428+
* valid.
429+
* @extends {jspb.Message}
430+
* @constructor
431+
*/
432+
proto.cc.arduino.cli.commands.v1.SketchProfile = function(opt_data) {
433+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
434+
};
435+
goog.inherits(proto.cc.arduino.cli.commands.v1.SketchProfile, jspb.Message);
436+
if (goog.DEBUG && !COMPILED) {
437+
/**
438+
* @public
439+
* @override
440+
*/
441+
proto.cc.arduino.cli.commands.v1.SketchProfile.displayName = 'proto.cc.arduino.cli.commands.v1.SketchProfile';
442+
}
421443
/**
422444
* Generated by JsPbCodeGenerator.
423445
* @param {Array=} opt_data Optional initial data array, typically from a
@@ -3196,12 +3218,172 @@ proto.cc.arduino.cli.commands.v1.LoadSketchRequest.prototype.setSketchPath = fun
31963218

31973219

31983220

3221+
3222+
3223+
if (jspb.Message.GENERATE_TO_OBJECT) {
3224+
/**
3225+
* Creates an object representation of this proto.
3226+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
3227+
* Optional fields that are not set will be set to undefined.
3228+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
3229+
* For the list of reserved names please see:
3230+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
3231+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
3232+
* JSPB instance for transitional soy proto support:
3233+
* http://goto/soy-param-migration
3234+
* @return {!Object}
3235+
*/
3236+
proto.cc.arduino.cli.commands.v1.SketchProfile.prototype.toObject = function(opt_includeInstance) {
3237+
return proto.cc.arduino.cli.commands.v1.SketchProfile.toObject(opt_includeInstance, this);
3238+
};
3239+
3240+
3241+
/**
3242+
* Static version of the {@see toObject} method.
3243+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
3244+
* the JSPB instance for transitional soy proto support:
3245+
* http://goto/soy-param-migration
3246+
* @param {!proto.cc.arduino.cli.commands.v1.SketchProfile} msg The msg instance to transform.
3247+
* @return {!Object}
3248+
* @suppress {unusedLocalVariables} f is only used for nested messages
3249+
*/
3250+
proto.cc.arduino.cli.commands.v1.SketchProfile.toObject = function(includeInstance, msg) {
3251+
var f, obj = {
3252+
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
3253+
fqbn: jspb.Message.getFieldWithDefault(msg, 2, "")
3254+
};
3255+
3256+
if (includeInstance) {
3257+
obj.$jspbMessageInstance = msg;
3258+
}
3259+
return obj;
3260+
};
3261+
}
3262+
3263+
3264+
/**
3265+
* Deserializes binary data (in protobuf wire format).
3266+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
3267+
* @return {!proto.cc.arduino.cli.commands.v1.SketchProfile}
3268+
*/
3269+
proto.cc.arduino.cli.commands.v1.SketchProfile.deserializeBinary = function(bytes) {
3270+
var reader = new jspb.BinaryReader(bytes);
3271+
var msg = new proto.cc.arduino.cli.commands.v1.SketchProfile;
3272+
return proto.cc.arduino.cli.commands.v1.SketchProfile.deserializeBinaryFromReader(msg, reader);
3273+
};
3274+
3275+
3276+
/**
3277+
* Deserializes binary data (in protobuf wire format) from the
3278+
* given reader into the given message object.
3279+
* @param {!proto.cc.arduino.cli.commands.v1.SketchProfile} msg The message object to deserialize into.
3280+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
3281+
* @return {!proto.cc.arduino.cli.commands.v1.SketchProfile}
3282+
*/
3283+
proto.cc.arduino.cli.commands.v1.SketchProfile.deserializeBinaryFromReader = function(msg, reader) {
3284+
while (reader.nextField()) {
3285+
if (reader.isEndGroup()) {
3286+
break;
3287+
}
3288+
var field = reader.getFieldNumber();
3289+
switch (field) {
3290+
case 1:
3291+
var value = /** @type {string} */ (reader.readString());
3292+
msg.setName(value);
3293+
break;
3294+
case 2:
3295+
var value = /** @type {string} */ (reader.readString());
3296+
msg.setFqbn(value);
3297+
break;
3298+
default:
3299+
reader.skipField();
3300+
break;
3301+
}
3302+
}
3303+
return msg;
3304+
};
3305+
3306+
3307+
/**
3308+
* Serializes the message to binary data (in protobuf wire format).
3309+
* @return {!Uint8Array}
3310+
*/
3311+
proto.cc.arduino.cli.commands.v1.SketchProfile.prototype.serializeBinary = function() {
3312+
var writer = new jspb.BinaryWriter();
3313+
proto.cc.arduino.cli.commands.v1.SketchProfile.serializeBinaryToWriter(this, writer);
3314+
return writer.getResultBuffer();
3315+
};
3316+
3317+
3318+
/**
3319+
* Serializes the given message to binary data (in protobuf wire
3320+
* format), writing to the given BinaryWriter.
3321+
* @param {!proto.cc.arduino.cli.commands.v1.SketchProfile} message
3322+
* @param {!jspb.BinaryWriter} writer
3323+
* @suppress {unusedLocalVariables} f is only used for nested messages
3324+
*/
3325+
proto.cc.arduino.cli.commands.v1.SketchProfile.serializeBinaryToWriter = function(message, writer) {
3326+
var f = undefined;
3327+
f = message.getName();
3328+
if (f.length > 0) {
3329+
writer.writeString(
3330+
1,
3331+
f
3332+
);
3333+
}
3334+
f = message.getFqbn();
3335+
if (f.length > 0) {
3336+
writer.writeString(
3337+
2,
3338+
f
3339+
);
3340+
}
3341+
};
3342+
3343+
3344+
/**
3345+
* optional string name = 1;
3346+
* @return {string}
3347+
*/
3348+
proto.cc.arduino.cli.commands.v1.SketchProfile.prototype.getName = function() {
3349+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
3350+
};
3351+
3352+
3353+
/**
3354+
* @param {string} value
3355+
* @return {!proto.cc.arduino.cli.commands.v1.SketchProfile} returns this
3356+
*/
3357+
proto.cc.arduino.cli.commands.v1.SketchProfile.prototype.setName = function(value) {
3358+
return jspb.Message.setProto3StringField(this, 1, value);
3359+
};
3360+
3361+
3362+
/**
3363+
* optional string fqbn = 2;
3364+
* @return {string}
3365+
*/
3366+
proto.cc.arduino.cli.commands.v1.SketchProfile.prototype.getFqbn = function() {
3367+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
3368+
};
3369+
3370+
3371+
/**
3372+
* @param {string} value
3373+
* @return {!proto.cc.arduino.cli.commands.v1.SketchProfile} returns this
3374+
*/
3375+
proto.cc.arduino.cli.commands.v1.SketchProfile.prototype.setFqbn = function(value) {
3376+
return jspb.Message.setProto3StringField(this, 2, value);
3377+
};
3378+
3379+
3380+
31993381
/**
32003382
* List of repeated fields within this message type.
32013383
* @private {!Array<number>}
32023384
* @const
32033385
*/
3204-
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.repeatedFields_ = [3,4,5];
3386+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.repeatedFields_ = [3,4,5,9];
32053387

32063388

32073389

@@ -3241,7 +3423,10 @@ proto.cc.arduino.cli.commands.v1.LoadSketchResponse.toObject = function(includeI
32413423
rootFolderFilesList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f,
32423424
defaultFqbn: jspb.Message.getFieldWithDefault(msg, 6, ""),
32433425
defaultPort: jspb.Message.getFieldWithDefault(msg, 7, ""),
3244-
defaultProtocol: jspb.Message.getFieldWithDefault(msg, 8, "")
3426+
defaultProtocol: jspb.Message.getFieldWithDefault(msg, 8, ""),
3427+
profilesList: jspb.Message.toObjectList(msg.getProfilesList(),
3428+
proto.cc.arduino.cli.commands.v1.SketchProfile.toObject, includeInstance),
3429+
defaultProfile: (f = msg.getDefaultProfile()) && proto.cc.arduino.cli.commands.v1.SketchProfile.toObject(includeInstance, f)
32453430
};
32463431

32473432
if (includeInstance) {
@@ -3310,6 +3495,16 @@ proto.cc.arduino.cli.commands.v1.LoadSketchResponse.deserializeBinaryFromReader
33103495
var value = /** @type {string} */ (reader.readString());
33113496
msg.setDefaultProtocol(value);
33123497
break;
3498+
case 9:
3499+
var value = new proto.cc.arduino.cli.commands.v1.SketchProfile;
3500+
reader.readMessage(value,proto.cc.arduino.cli.commands.v1.SketchProfile.deserializeBinaryFromReader);
3501+
msg.addProfiles(value);
3502+
break;
3503+
case 10:
3504+
var value = new proto.cc.arduino.cli.commands.v1.SketchProfile;
3505+
reader.readMessage(value,proto.cc.arduino.cli.commands.v1.SketchProfile.deserializeBinaryFromReader);
3506+
msg.setDefaultProfile(value);
3507+
break;
33133508
default:
33143509
reader.skipField();
33153510
break;
@@ -3395,6 +3590,22 @@ proto.cc.arduino.cli.commands.v1.LoadSketchResponse.serializeBinaryToWriter = fu
33953590
f
33963591
);
33973592
}
3593+
f = message.getProfilesList();
3594+
if (f.length > 0) {
3595+
writer.writeRepeatedMessage(
3596+
9,
3597+
f,
3598+
proto.cc.arduino.cli.commands.v1.SketchProfile.serializeBinaryToWriter
3599+
);
3600+
}
3601+
f = message.getDefaultProfile();
3602+
if (f != null) {
3603+
writer.writeMessage(
3604+
10,
3605+
f,
3606+
proto.cc.arduino.cli.commands.v1.SketchProfile.serializeBinaryToWriter
3607+
);
3608+
}
33983609
};
33993610

34003611

@@ -3599,6 +3810,81 @@ proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.setDefaultProtocol
35993810
};
36003811

36013812

3813+
/**
3814+
* repeated SketchProfile profiles = 9;
3815+
* @return {!Array<!proto.cc.arduino.cli.commands.v1.SketchProfile>}
3816+
*/
3817+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.getProfilesList = function() {
3818+
return /** @type{!Array<!proto.cc.arduino.cli.commands.v1.SketchProfile>} */ (
3819+
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.v1.SketchProfile, 9));
3820+
};
3821+
3822+
3823+
/**
3824+
* @param {!Array<!proto.cc.arduino.cli.commands.v1.SketchProfile>} value
3825+
* @return {!proto.cc.arduino.cli.commands.v1.LoadSketchResponse} returns this
3826+
*/
3827+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.setProfilesList = function(value) {
3828+
return jspb.Message.setRepeatedWrapperField(this, 9, value);
3829+
};
3830+
3831+
3832+
/**
3833+
* @param {!proto.cc.arduino.cli.commands.v1.SketchProfile=} opt_value
3834+
* @param {number=} opt_index
3835+
* @return {!proto.cc.arduino.cli.commands.v1.SketchProfile}
3836+
*/
3837+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.addProfiles = function(opt_value, opt_index) {
3838+
return jspb.Message.addToRepeatedWrapperField(this, 9, opt_value, proto.cc.arduino.cli.commands.v1.SketchProfile, opt_index);
3839+
};
3840+
3841+
3842+
/**
3843+
* Clears the list making it empty but non-null.
3844+
* @return {!proto.cc.arduino.cli.commands.v1.LoadSketchResponse} returns this
3845+
*/
3846+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.clearProfilesList = function() {
3847+
return this.setProfilesList([]);
3848+
};
3849+
3850+
3851+
/**
3852+
* optional SketchProfile default_profile = 10;
3853+
* @return {?proto.cc.arduino.cli.commands.v1.SketchProfile}
3854+
*/
3855+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.getDefaultProfile = function() {
3856+
return /** @type{?proto.cc.arduino.cli.commands.v1.SketchProfile} */ (
3857+
jspb.Message.getWrapperField(this, proto.cc.arduino.cli.commands.v1.SketchProfile, 10));
3858+
};
3859+
3860+
3861+
/**
3862+
* @param {?proto.cc.arduino.cli.commands.v1.SketchProfile|undefined} value
3863+
* @return {!proto.cc.arduino.cli.commands.v1.LoadSketchResponse} returns this
3864+
*/
3865+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.setDefaultProfile = function(value) {
3866+
return jspb.Message.setWrapperField(this, 10, value);
3867+
};
3868+
3869+
3870+
/**
3871+
* Clears the message field making it undefined.
3872+
* @return {!proto.cc.arduino.cli.commands.v1.LoadSketchResponse} returns this
3873+
*/
3874+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.clearDefaultProfile = function() {
3875+
return this.setDefaultProfile(undefined);
3876+
};
3877+
3878+
3879+
/**
3880+
* Returns whether this field is set.
3881+
* @return {boolean}
3882+
*/
3883+
proto.cc.arduino.cli.commands.v1.LoadSketchResponse.prototype.hasDefaultProfile = function() {
3884+
return jspb.Message.getField(this, 10) != null;
3885+
};
3886+
3887+
36023888

36033889

36043890

‎arduino-ide-extension/src/node/grpc-progressible.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { v4 } from 'uuid';
2-
import {
1+
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
2+
import type {
33
IndexType,
44
IndexUpdateDidCompleteParams,
55
IndexUpdateDidFailParams,
@@ -16,10 +16,10 @@ import {
1616
} from './cli-protocol/cc/arduino/cli/commands/v1/commands_pb';
1717
import {
1818
DownloadProgress,
19-
TaskProgress,
19+
DownloadProgressEnd,
2020
DownloadProgressStart,
2121
DownloadProgressUpdate,
22-
DownloadProgressEnd,
22+
TaskProgress,
2323
} from './cli-protocol/cc/arduino/cli/commands/v1/common_pb';
2424
import { CompileResponse } from './cli-protocol/cc/arduino/cli/commands/v1/compile_pb';
2525
import {
@@ -170,7 +170,7 @@ export namespace ExecuteWithProgress {
170170
progressId,
171171
reportResult,
172172
}: ExecuteWithProgress.Options): (response: R) => void {
173-
const uuid = v4();
173+
const uuid = UUID.uuid4();
174174
let message = '';
175175
let url = '';
176176
return (response: R) => {
@@ -330,7 +330,7 @@ export class IndexesUpdateProgressHandler {
330330
onComplete?: (params: IndexUpdateDidCompleteParams) => void;
331331
}
332332
) {
333-
this.progressId = v4();
333+
this.progressId = UUID.uuid4();
334334
this.results = [];
335335
this.total = IndexesUpdateProgressHandler.total(types, additionalUrlsCount);
336336
// Note: at this point, the IDE2 backend might not have any connected clients, so this notification is not delivered to anywhere

‎arduino-ide-extension/src/test/browser/create-api.test.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { UUID } from '@theia/core/shared/@phosphor/coreutils';
12
import {
23
Container,
34
ContainerModule,
@@ -6,7 +7,7 @@ import {
67
import { assert, expect } from 'chai';
78
import fetch from 'cross-fetch';
89
import { posix } from 'node:path';
9-
import { v4 } from 'uuid';
10+
import queryString from 'query-string';
1011
import { ArduinoPreferences } from '../../browser/arduino-preferences';
1112
import { AuthenticationClientService } from '../../browser/auth/authentication-client-service';
1213
import { CreateApi } from '../../browser/create/create-api';
@@ -15,7 +16,6 @@ import { Create, CreateError } from '../../browser/create/typings';
1516
import { SketchCache } from '../../browser/widgets/cloud-sketchbook/cloud-sketch-cache';
1617
import { SketchesService } from '../../common/protocol';
1718
import { AuthenticationSession } from '../../node/auth/types';
18-
import queryString from 'query-string';
1919

2020
/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */
2121
/* eslint-disable @typescript-eslint/no-non-null-assertion */
@@ -132,7 +132,7 @@ describe('create-api', () => {
132132
}
133133

134134
it('should delete sketch', async () => {
135-
const name = v4();
135+
const name = UUID.uuid4();
136136
const content = 'alma\nkorte';
137137
const posixPath = toPosix(name);
138138

@@ -172,8 +172,8 @@ describe('create-api', () => {
172172
});
173173

174174
it('should rename a sketch folder with all its content', async () => {
175-
const name = v4();
176-
const newName = v4();
175+
const name = UUID.uuid4();
176+
const newName = UUID.uuid4();
177177
const content = 'void setup(){} void loop(){}';
178178
const posixPath = toPosix(name);
179179
const newPosixPath = toPosix(newName);
@@ -201,8 +201,8 @@ describe('create-api', () => {
201201
});
202202

203203
it('should error with HTTP 409 (Conflict) when renaming a sketch and the target already exists', async () => {
204-
const name = v4();
205-
const otherName = v4();
204+
const name = UUID.uuid4();
205+
const otherName = UUID.uuid4();
206206
const content = 'void setup(){} void loop(){}';
207207
const posixPath = toPosix(name);
208208
const otherPosixPath = toPosix(otherName);
@@ -259,7 +259,7 @@ describe('create-api', () => {
259259
});
260260

261261
it("should fetch the sketch when transforming the 'secrets' into '#include' and the sketch is not in the cache", async () => {
262-
const name = v4();
262+
const name = UUID.uuid4();
263263
const posixPath = toPosix(name);
264264
const newSketch = await createApi.createSketch(
265265
posixPath,
@@ -302,7 +302,9 @@ describe('create-api', () => {
302302
const content = 'void setup(){} void loop(){}';
303303
const maxLimit = 50; // https://github.com/arduino/arduino-ide/pull/875
304304
const sketchCount = maxLimit + diff;
305-
const sketchNames = [...Array(sketchCount).keys()].map(() => v4());
305+
const sketchNames = [...Array(sketchCount).keys()].map(() =>
306+
UUID.uuid4()
307+
);
306308

307309
await sketchNames
308310
.map((name) => createApi.createSketch(toPosix(name), content))

‎electron-app/package.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55
"license": "AGPL-3.0-or-later",
66
"main": "./src-gen/backend/electron-main.js",
77
"dependencies": {
8-
"@theia/core": "1.41.0",
9-
"@theia/debug": "1.41.0",
10-
"@theia/editor": "1.41.0",
11-
"@theia/electron": "1.41.0",
12-
"@theia/filesystem": "1.41.0",
13-
"@theia/keymaps": "1.41.0",
14-
"@theia/messages": "1.41.0",
15-
"@theia/monaco": "1.41.0",
16-
"@theia/navigator": "1.41.0",
17-
"@theia/plugin-ext": "1.41.0",
18-
"@theia/plugin-ext-vscode": "1.41.0",
19-
"@theia/preferences": "1.41.0",
20-
"@theia/terminal": "1.41.0",
21-
"@theia/workspace": "1.41.0",
8+
"@theia/core": "1.42.1",
9+
"@theia/debug": "1.42.1",
10+
"@theia/editor": "1.42.1",
11+
"@theia/electron": "1.42.1",
12+
"@theia/filesystem": "1.42.1",
13+
"@theia/keymaps": "1.42.1",
14+
"@theia/messages": "1.42.1",
15+
"@theia/monaco": "1.42.1",
16+
"@theia/navigator": "1.42.1",
17+
"@theia/plugin-ext": "1.42.1",
18+
"@theia/plugin-ext-vscode": "1.42.1",
19+
"@theia/preferences": "1.42.1",
20+
"@theia/terminal": "1.42.1",
21+
"@theia/workspace": "1.42.1",
2222
"arduino-ide-extension": "2.2.2"
2323
},
2424
"devDependencies": {
25-
"@theia/cli": "1.41.0",
25+
"@theia/cli": "1.42.1",
2626
"7zip-min": "^1.4.4",
2727
"chmodr": "^1.2.0",
2828
"compression-webpack-plugin": "^9.0.0",
2929
"copy-webpack-plugin": "^8.1.1",
3030
"dateformat": "^5.0.3",
31-
"electron": "^25.5.0",
31+
"electron": "^26.2.4",
3232
"electron-builder": "^24.6.3",
3333
"electron-notarize": "^1.1.1",
3434
"execa": "^7.1.1",
@@ -201,22 +201,22 @@
201201
"vscode-builtin-json-language-features": "https://open-vsx.org/api/vscode/json-language-features/1.46.1/file/vscode.json-language-features-1.46.1.vsix",
202202
"cortex-debug": "https://downloads.arduino.cc/marus25.cortex-debug/marus25.cortex-debug-1.5.1.vsix",
203203
"vscode-language-pack-bg": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-bg/1.48.3/file/MS-CEINTL.vscode-language-pack-bg-1.48.3.vsix",
204-
"vscode-language-pack-cs": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-cs/1.80.0/file/MS-CEINTL.vscode-language-pack-cs-1.80.0.vsix",
205-
"vscode-language-pack-de": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-de/1.80.0/file/MS-CEINTL.vscode-language-pack-de-1.80.0.vsix",
206-
"vscode-language-pack-es": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-es/1.80.0/file/MS-CEINTL.vscode-language-pack-es-1.80.0.vsix",
207-
"vscode-language-pack-fr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-fr/1.80.0/file/MS-CEINTL.vscode-language-pack-fr-1.80.0.vsix",
204+
"vscode-language-pack-cs": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-cs/1.81.0/file/MS-CEINTL.vscode-language-pack-cs-1.81.0.vsix",
205+
"vscode-language-pack-de": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-de/1.81.0/file/MS-CEINTL.vscode-language-pack-de-1.81.0.vsix",
206+
"vscode-language-pack-es": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-es/1.81.0/file/MS-CEINTL.vscode-language-pack-es-1.81.0.vsix",
207+
"vscode-language-pack-fr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-fr/1.81.0/file/MS-CEINTL.vscode-language-pack-fr-1.81.0.vsix",
208208
"vscode-language-pack-hu": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-hu/1.48.3/file/MS-CEINTL.vscode-language-pack-hu-1.48.3.vsix",
209-
"vscode-language-pack-it": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-it/1.80.0/file/MS-CEINTL.vscode-language-pack-it-1.80.0.vsix",
210-
"vscode-language-pack-ja": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ja/1.80.0/file/MS-CEINTL.vscode-language-pack-ja-1.80.0.vsix",
211-
"vscode-language-pack-ko": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ko/1.80.0/file/MS-CEINTL.vscode-language-pack-ko-1.80.0.vsix",
209+
"vscode-language-pack-it": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-it/1.81.0/file/MS-CEINTL.vscode-language-pack-it-1.81.0.vsix",
210+
"vscode-language-pack-ja": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ja/1.81.0/file/MS-CEINTL.vscode-language-pack-ja-1.81.0.vsix",
211+
"vscode-language-pack-ko": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ko/1.81.0/file/MS-CEINTL.vscode-language-pack-ko-1.81.0.vsix",
212212
"vscode-language-pack-nl": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-nl/1.48.3/file/MS-CEINTL.vscode-language-pack-nl-1.48.3.vsix",
213-
"vscode-language-pack-pl": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pl/1.80.0/file/MS-CEINTL.vscode-language-pack-pl-1.80.0.vsix",
214-
"vscode-language-pack-pt-BR": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pt-BR/1.80.0/file/MS-CEINTL.vscode-language-pack-pt-BR-1.80.0.vsix",
215-
"vscode-language-pack-ru": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ru/1.80.0/file/MS-CEINTL.vscode-language-pack-ru-1.80.0.vsix",
216-
"vscode-language-pack-tr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-tr/1.80.0/file/MS-CEINTL.vscode-language-pack-tr-1.80.0.vsix",
213+
"vscode-language-pack-pl": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pl/1.81.0/file/MS-CEINTL.vscode-language-pack-pl-1.81.0.vsix",
214+
"vscode-language-pack-pt-BR": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-pt-BR/1.81.0/file/MS-CEINTL.vscode-language-pack-pt-BR-1.81.0.vsix",
215+
"vscode-language-pack-ru": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-ru/1.81.0/file/MS-CEINTL.vscode-language-pack-ru-1.81.0.vsix",
216+
"vscode-language-pack-tr": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-tr/1.81.0/file/MS-CEINTL.vscode-language-pack-tr-1.81.0.vsix",
217217
"vscode-language-pack-uk": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-uk/1.48.3/file/MS-CEINTL.vscode-language-pack-uk-1.48.3.vsix",
218-
"vscode-language-pack-zh-hans": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hans/1.80.0/file/MS-CEINTL.vscode-language-pack-zh-hans-1.80.0.vsix",
219-
"vscode-language-pack-zh-hant": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hant/1.80.0/file/MS-CEINTL.vscode-language-pack-zh-hant-1.80.0.vsix"
218+
"vscode-language-pack-zh-hans": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hans/1.81.0/file/MS-CEINTL.vscode-language-pack-zh-hans-1.81.0.vsix",
219+
"vscode-language-pack-zh-hant": "https://open-vsx.org/api/MS-CEINTL/vscode-language-pack-zh-hant/1.81.0/file/MS-CEINTL.vscode-language-pack-zh-hant-1.81.0.vsix"
220220
},
221221
"mocha": {
222222
"reporter": "spec",

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"node": ">=18.17.0 <21"
1111
},
1212
"devDependencies": {
13-
"@theia/cli": "1.41.0",
13+
"@theia/cli": "1.42.1",
1414
"@typescript-eslint/eslint-plugin": "^5.59.0",
1515
"@typescript-eslint/parser": "^5.59.0",
1616
"@xhmikosr/downloader": "^13.0.1",

‎yarn.lock

Lines changed: 1236 additions & 2851 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.