mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-10 18:59:28 +00:00
- Updated `@theia/*` to `1.37.0`. - Fixed all `yarn audit` security vulnerabilities. - Updated to `electron@23.2.4`: - `contextIsolation` is `true`, - `nodeIntegration` is `false`, and the - `webpack` target is moved from `electron-renderer` to `web`. - Updated to `typescript@4.9.3`. - Updated the `eslint` plugins. - Added the new `Light High Contrast` theme to the IDE2. - High contrast themes use Theia APIs for style adjustments. - Support for ESM modules: `"moduleResolution": "node16"`. - Node.js >= 16.14 is required. - VISX langage packs were bumped to `1.70.0`. - Removed undesired editor context menu items. (Closes #1394) Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
66 lines
1.7 KiB
TypeScript
66 lines
1.7 KiB
TypeScript
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
import {
|
|
inject,
|
|
injectable,
|
|
postConstruct,
|
|
} from '@theia/core/shared/inversify';
|
|
import {
|
|
hasStartupTasks,
|
|
StartupTasks,
|
|
} from '../../electron-common/startup-task';
|
|
import { AppService } from '../app-service';
|
|
import { Contribution } from './contribution';
|
|
|
|
@injectable()
|
|
export class StartupTasksExecutor extends Contribution {
|
|
@inject(AppService)
|
|
private readonly appService: AppService;
|
|
|
|
private readonly toDispose = new DisposableCollection();
|
|
|
|
@postConstruct()
|
|
protected override init(): void {
|
|
super.init();
|
|
this.toDispose.push(
|
|
this.appService.registerStartupTasksHandler((tasks) =>
|
|
this.handleStartupTasks(tasks)
|
|
)
|
|
);
|
|
}
|
|
|
|
onStop(): void {
|
|
this.toDispose.dispose();
|
|
}
|
|
|
|
private async handleStartupTasks(tasks: StartupTasks): Promise<void> {
|
|
console.debug(
|
|
`Received the startup tasks from the electron main process. Args: ${JSON.stringify(
|
|
tasks
|
|
)}`
|
|
);
|
|
if (!hasStartupTasks(tasks)) {
|
|
console.warn(`Could not detect 'tasks' from the signal. Skipping.`);
|
|
return;
|
|
}
|
|
await this.appStateService.reachedState('ready');
|
|
console.log(`Executing startup tasks:`);
|
|
tasks.tasks.forEach(({ command, args = [] }) => {
|
|
console.log(
|
|
` - '${command}' ${
|
|
args.length ? `, args: ${JSON.stringify(args)}` : ''
|
|
}`
|
|
);
|
|
this.commandService
|
|
.executeCommand(command, ...args)
|
|
.catch((err) =>
|
|
console.error(
|
|
`Error occurred when executing the startup task '${command}'${
|
|
args?.length ? ` with args: '${JSON.stringify(args)}` : ''
|
|
}.`,
|
|
err
|
|
)
|
|
);
|
|
});
|
|
}
|
|
}
|