Skip to content

Commit 7f82f37

Browse files
core: upgrade node-glob library
1 parent 3ccc864 commit 7f82f37

File tree

5 files changed

+293
-76
lines changed

5 files changed

+293
-76
lines changed

Diff for: arduino-ide-extension/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"fast-safe-stringify": "^2.1.1",
7474
"filename-reserved-regex": "^2.0.0",
7575
"fqbn": "^1.0.5",
76-
"glob": "^7.1.6",
76+
"glob": "^11.0.0",
7777
"google-protobuf": "^3.20.1",
7878
"hash.js": "^1.1.7",
7979
"is-online": "^10.0.0",
@@ -127,8 +127,8 @@
127127
"rimraf": "^2.6.1"
128128
},
129129
"optionalDependencies": {
130-
"grpc-tools": "^1.12.4",
131-
"@pingghost/protoc": "^1.0.2"
130+
"@pingghost/protoc": "^1.0.2",
131+
"grpc-tools": "^1.12.4"
132132
},
133133
"mocha": {
134134
"require": [

Diff for: arduino-ide-extension/scripts/generate-protocol.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const path = require('node:path');
66
const { mkdirSync, promises: fs, rmSync } = require('node:fs');
77
const { exec } = require('./utils');
8-
const glob = require('glob');
8+
const { glob } = require('glob');
99
const { SemVer, gte, valid: validSemVer } = require('semver');
1010
// Use a node-protoc fork until apple arm32 is supported
1111
// https://github.com/YePpHa/node-protoc/pull/10
@@ -147,16 +147,14 @@
147147
rmSync(out, { recursive: true, maxRetries: 5, force: true });
148148
mkdirSync(out, { recursive: true });
149149

150-
const protos = await new Promise((resolve) =>
151-
glob('**/*.proto', { cwd: rpc }, (error, matches) => {
152-
if (error) {
153-
console.log(error.stack ?? error.message);
154-
resolve([]);
155-
return;
156-
}
157-
resolve(matches.map((filename) => path.join(rpc, filename)));
158-
})
159-
);
150+
let protos = [];
151+
try {
152+
const matches = await glob('**/*.proto', { cwd: rpc });
153+
protos = matches.map((filename) => path.join(rpc, filename));
154+
} catch (error) {
155+
console.log(error.stack ?? error.message);
156+
}
157+
160158
if (!protos || protos.length === 0) {
161159
console.log(`Could not find any .proto files under ${rpc}.`);
162160
process.exit(1);

Diff for: arduino-ide-extension/src/node/sketches-service-impl.ts

+2-10
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import type { Mutable } from '@theia/core/lib/common/types';
88
import URI from '@theia/core/lib/common/uri';
99
import { FileUri } from '@theia/core/lib/node/file-uri';
1010
import { inject, injectable, named } from '@theia/core/shared/inversify';
11-
import glob from 'glob';
1211
import crypto from 'node:crypto';
1312
import {
1413
CopyOptions,
@@ -50,6 +49,7 @@ import {
5049
import { ServiceError } from './service-error';
5150
import { SettingsReader } from './settings-reader';
5251
import { ErrnoException } from './utils/errors';
52+
import { glob } from 'glob';
5353

5454
const RecentSketches = 'recent-sketches.json';
5555
const DefaultIno = `void setup() {
@@ -978,13 +978,5 @@ export async function discoverSketches(
978978
}
979979

980980
async function globSketches(pattern: string, root: string): Promise<string[]> {
981-
return new Promise<string[]>((resolve, reject) => {
982-
glob(pattern, { root }, (error, results) => {
983-
if (error) {
984-
reject(error);
985-
} else {
986-
resolve(results);
987-
}
988-
});
989-
});
981+
return await glob(pattern, { root });
990982
}

Diff for: electron-app/scripts/post-package.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const isCI = require('is-ci');
55
const fs = require('fs');
66
const path = require('path');
7-
const glob = require('glob');
7+
const { glob } = require('glob');
88
const { isRelease } = require('./utils');
99
const { isZip, adjustArchiveStructure } = require('./archive');
1010

0 commit comments

Comments
 (0)