Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4c55807

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
Speed up IDE startup time.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
1 parent cb50d3a commit 4c55807

File tree

179 files changed

+2688
-2018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+2688
-2018
lines changed

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ arduino-ide-extension/data/cli/config
2121
scripts/themes/tokens
2222
# environment variables
2323
.env
24+
# content trace files for electron
25+
electron-app/traces

‎.prettierrc‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"singleQuote": true,
33
"tabWidth": 2,
44
"useTabs": false,
5-
"printWidth": 80
5+
"printWidth": 80,
6+
"endOfLine": "auto"
67
}

‎.vscode/launch.json‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,44 @@
11
{
22
"version": "0.2.0",
33
"configurations": [
4+
{
5+
"type": "node",
6+
"request": "launch",
7+
"name": "App (Electron) [Dev]",
8+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron",
9+
"windows": {
10+
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
11+
},
12+
"cwd": "${workspaceFolder}/electron-app",
13+
"args": [
14+
".",
15+
"--log-level=debug",
16+
"--hostname=localhost",
17+
"--no-cluster",
18+
"--app-project-path=${workspaceRoot}/electron-app",
19+
"--remote-debugging-port=9222",
20+
"--no-app-auto-install",
21+
"--plugins=local-dir:../plugins",
22+
"--hosted-plugin-inspect=9339",
23+
"--nosplash",
24+
"--content-trace",
25+
"--open-devtools"
26+
],
27+
"env": {
28+
"NODE_ENV": "development"
29+
},
30+
"sourceMaps": true,
31+
"outFiles": [
32+
"${workspaceRoot}/electron-app/src-gen/backend/*.js",
33+
"${workspaceRoot}/electron-app/src-gen/frontend/*.js",
34+
"${workspaceRoot}/electron-app/lib/**/*.js",
35+
"${workspaceRoot}/arduino-ide-extension/lib/**/*.js",
36+
"${workspaceRoot}/node_modules/@theia/**/*.js"
37+
],
38+
"smartStep": true,
39+
"internalConsoleOptions": "openOnSessionStart",
40+
"outputCapture": "std"
41+
},
442
{
543
"type": "node",
644
"request": "launch",
@@ -10,7 +48,6 @@
1048
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron.cmd",
1149
},
1250
"cwd": "${workspaceFolder}/electron-app",
13-
"protocol": "inspector",
1451
"args": [
1552
".",
1653
"--log-level=debug",
@@ -78,7 +115,6 @@
78115
{
79116
"type": "node",
80117
"request": "launch",
81-
"protocol": "inspector",
82118
"name": "Run Test [current]",
83119
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
84120
"args": [

‎arduino-ide-extension/package.json‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@
2121
"test:watch": "mocha --watch --watch-files lib \"./lib/test/**/*.test.js\""
2222
},
2323
"dependencies": {
24-
"@grpc/grpc-js": "^1.3.7",
24+
"@grpc/grpc-js": "^1.6.7",
2525
"@theia/application-package": "1.25.0",
2626
"@theia/core": "1.25.0",
2727
"@theia/editor": "1.25.0",
2828
"@theia/editor-preview": "1.25.0",
2929
"@theia/electron": "1.25.0",
3030
"@theia/filesystem": "1.25.0",
31-
"@theia/git": "1.25.0",
3231
"@theia/keymaps": "1.25.0",
3332
"@theia/markers": "1.25.0",
3433
"@theia/monaco": "1.25.0",
@@ -45,7 +44,7 @@
4544
"@types/btoa": "^1.2.3",
4645
"@types/dateformat": "^3.0.1",
4746
"@types/deepmerge": "^2.2.0",
48-
"@types/glob": "^5.0.35",
47+
"@types/glob": "^7.2.0",
4948
"@types/google-protobuf": "^3.7.2",
5049
"@types/js-yaml": "^3.12.2",
5150
"@types/keytar": "^4.4.0",
@@ -63,14 +62,12 @@
6362
"atob": "^2.1.2",
6463
"auth0-js": "^9.14.0",
6564
"btoa": "^1.2.1",
66-
"css-element-queries": "^1.2.0",
6765
"dateformat": "^3.0.3",
6866
"deepmerge": "2.0.1",
6967
"electron-updater": "^4.6.5",
70-
"fuzzy": "^0.1.3",
68+
"fast-safe-stringify": "^2.1.1",
7169
"glob": "^7.1.6",
72-
"google-protobuf": "^3.11.4",
73-
"grpc": "^1.24.11",
70+
"google-protobuf": "^3.20.1",
7471
"hash.js": "^1.1.7",
7572
"is-valid-path": "^0.1.1",
7673
"js-yaml": "^3.13.1",
@@ -91,6 +88,7 @@
9188
"semver": "^7.3.2",
9289
"string-natural-compare": "^2.0.3",
9390
"temp": "^0.9.1",
91+
"temp-dir": "^2.0.0",
9492
"tree-kill": "^1.2.1",
9593
"upath": "^1.1.2",
9694
"url": "^0.11.0",
@@ -157,10 +155,10 @@
157155
],
158156
"arduino": {
159157
"cli": {
160-
"version": "0.21.0"
158+
"version": "0.23.0"
161159
},
162160
"fwuploader": {
163-
"version": "2.0.0"
161+
"version": "2.2.0"
164162
},
165163
"clangd": {
166164
"version": "14.0.0"

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

Lines changed: 84 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,30 +4,93 @@
44
const version = '1.9.1';
55

66
(async () => {
7+
const os = require('os');
8+
const { promises: fs } = require('fs');
9+
const path = require('path');
10+
const shell = require('shelljs');
11+
const { v4 } = require('uuid');
712

8-
const os = require('os');
9-
constpath=require('path');
10-
constshell=require('shelljs');
11-
const{ v4 }=require('uuid');
13+
const repository = path.join(os.tmpdir(),`${v4()}-arduino-examples`);
14+
if(shell.mkdir('-p',repository).code!==0){
15+
shell.exit(1);
16+
}
1217

13-
const repository = path.join(os.tmpdir(), `${v4()}-arduino-examples`);
14-
if (shell.mkdir('-p', repository).code !== 0) {
15-
shell.exit(1);
16-
process.exit(1);
17-
}
18-
19-
if (shell.exec(`git clone https://github.com/arduino/arduino-examples.git ${repository}`).code !== 0) {
20-
shell.exit(1);
21-
process.exit(1);
22-
}
18+
if (
19+
shell.exec(
20+
`git clone https://github.com/arduino/arduino-examples.git ${repository}`
21+
).code !== 0
22+
) {
23+
shell.exit(1);
24+
}
2325

24-
if (shell.exec(`git -C ${repository} checkout tags/${version} -b ${version}`).code !== 0) {
25-
shell.exit(1);
26-
process.exit(1);
27-
}
26+
if (
27+
shell.exec(`git -C ${repository} checkout tags/${version} -b ${version}`)
28+
.code !== 0
29+
) {
30+
shell.exit(1);
31+
}
2832

29-
const destination = path.join(__dirname, '..', 'Examples');
30-
shell.mkdir('-p', destination);
31-
shell.cp('-fR', path.join(repository, 'examples', '*'), destination);
33+
const destination = path.join(__dirname, '..', 'Examples');
34+
shell.mkdir('-p', destination);
35+
shell.cp('-fR', path.join(repository, 'examples', '*'), destination);
3236

37+
const isSketch = async (pathLike) => {
38+
try {
39+
const names = await fs.readdir(pathLike);
40+
const dirName = path.basename(pathLike);
41+
return names.indexOf(`${dirName}.ino`) !== -1;
42+
} catch (e) {
43+
if (e.code === 'ENOTDIR') {
44+
return false;
45+
}
46+
throw e;
47+
}
48+
};
49+
const examples = [];
50+
const categories = await fs.readdir(destination);
51+
const visit = async (pathLike, container) => {
52+
const stat = await fs.lstat(pathLike);
53+
if (stat.isDirectory()) {
54+
if (await isSketch(pathLike)) {
55+
container.sketches.push({
56+
name: path.basename(pathLike),
57+
relativePath: path.relative(destination, pathLike),
58+
});
59+
} else {
60+
const names = await fs.readdir(pathLike);
61+
for (const name of names) {
62+
const childPath = path.join(pathLike, name);
63+
if (await isSketch(childPath)) {
64+
container.sketches.push({
65+
name,
66+
relativePath: path.relative(destination, childPath),
67+
});
68+
} else {
69+
const child = {
70+
label: name,
71+
children: [],
72+
sketches: [],
73+
};
74+
container.children.push(child);
75+
await visit(childPath, child);
76+
}
77+
}
78+
}
79+
}
80+
};
81+
for (const category of categories) {
82+
const example = {
83+
label: category,
84+
children: [],
85+
sketches: [],
86+
};
87+
await visit(path.join(destination, category), example);
88+
examples.push(example);
89+
}
90+
await fs.writeFile(
91+
path.join(destination, 'examples.json'),
92+
JSON.stringify(examples, null, 2),
93+
{ encoding: 'utf8' }
94+
);
95+
shell.echo(`Generated output to ${path.join(destination, 'examples.json')}`);
3396
})();

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /