|
1 | 1 | import { promises as fsp } from 'fs'; |
2 | 2 | import fs from 'fs'; |
| 3 | +import patch from './patch'; |
3 | 4 |
|
4 | 5 |
|
5 | 6 | export default class deeplinkCommands { |
6 | 7 |
|
7 | 8 | static async loadCommands() { |
8 | | - let commands = []; |
| 9 | + let commands = [{ name: 'patch', run: patch }]; |
9 | 10 |
|
10 | | - // Получаем список всех папок в src/main/deeplinkCommands/ |
11 | | - const dirPath = __dirname; |
12 | | - const entries = await fsp.readdir(dirPath, { withFileTypes: true }); |
13 | | - for (const entry of entries) { |
14 | | - if (entry.isDirectory()) { |
15 | | - const indexPath = `${dirPath}/${entry.name}/index.js`; |
16 | | - if (fs.existsSync(indexPath)) { |
17 | | - const command = await import(indexPath); |
18 | | - commands.push(command.default || command.run || command); |
19 | | - } |
20 | | - } |
21 | | - } |
| 11 | + // TODO Разобраться с вебпаком чтобы main не бандлился а копировался. |
| 12 | + // // Получаем список всех папок в src/main/deeplinkCommands/ |
| 13 | + // const dirPath = __dirname; |
| 14 | + // const entries = await fsp.readdir(dirPath, { withFileTypes: true }); |
| 15 | + // for (const entry of entries) { |
| 16 | + // if (entry.isDirectory()) { |
| 17 | + // const indexPath = `${dirPath}/${entry.name}/index.js`; |
| 18 | + // if (fs.existsSync(indexPath)) { |
| 19 | + // const command = await import(indexPath); |
| 20 | + // commands.push({ name: entry.name, run: command.default || command.run || command}); |
| 21 | + // } |
| 22 | + // } |
| 23 | + // } |
22 | 24 |
|
23 | 25 | return commands; |
24 | 26 | } |
|
0 commit comments