Skip to content

Commit 7e35897

Browse files
committed
Cleanup
1 parent cd99c6e commit 7e35897

File tree

7 files changed

+65
-63
lines changed

7 files changed

+65
-63
lines changed

packages/cli/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"bin": "n8n"
2121
},
2222
"scripts": {
23-
"benchmark": "tsc -p tsconfig.benchmark.json && tsc-alias -p tsconfig.benchmark.json && node dist/test/benchmark/main.js",
23+
"benchmark": "tsc -p tsconfig.benchmark.json && tsc-alias -p tsconfig.benchmark.json && node dist/test/benchmarks/main.js",
2424
"clean": "rimraf dist .turbo",
2525
"typecheck": "tsc",
2626
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node scripts/build.mjs",

packages/cli/src/commands/start.ts

+30-28
Original file line numberDiff line numberDiff line change
@@ -289,35 +289,37 @@ export class Start extends BaseCommand {
289289
const editorUrl = Container.get(UrlService).baseUrl;
290290
this.log(`\nEditor is now accessible via:\n${editorUrl}`);
291291

292-
// Allow to open n8n editor by pressing "o"
293-
if (Boolean(process.stdout.isTTY) && process.stdin.setRawMode) {
294-
process.stdin.setRawMode(true);
295-
process.stdin.resume();
296-
process.stdin.setEncoding('utf8');
292+
console.log('hello');
297293

298-
if (flags.open) {
299-
this.openBrowser();
300-
}
301-
this.log('\nPress "o" to open in Browser.');
302-
process.stdin.on('data', (key: string) => {
303-
if (key === 'o') {
304-
this.openBrowser();
305-
} else if (key.charCodeAt(0) === 3) {
306-
// Ctrl + c got pressed
307-
void this.stopProcess();
308-
} else {
309-
// When anything else got pressed, record it and send it on enter into the child process
310-
311-
if (key.charCodeAt(0) === 13) {
312-
// send to child process and print in terminal
313-
process.stdout.write('\n');
314-
} else {
315-
// record it and write into terminal
316-
process.stdout.write(key);
317-
}
318-
}
319-
});
320-
}
294+
// Allow to open n8n editor by pressing "o"
295+
// if (Boolean(process.stdout.isTTY) && process.stdin.setRawMode) {
296+
// process.stdin.setRawMode(true);
297+
// process.stdin.resume();
298+
// process.stdin.setEncoding('utf8');
299+
300+
// if (flags.open) {
301+
// this.openBrowser();
302+
// }
303+
// this.log('\nPress "o" to open in Browser.');
304+
// process.stdin.on('data', (key: string) => {
305+
// if (key === 'o') {
306+
// this.openBrowser();
307+
// } else if (key.charCodeAt(0) === 3) {
308+
// // Ctrl + c got pressed
309+
// void this.stopProcess();
310+
// } else {
311+
// // When anything else got pressed, record it and send it on enter into the child process
312+
313+
// if (key.charCodeAt(0) === 13) {
314+
// // send to child process and print in terminal
315+
// process.stdout.write('\n');
316+
// } else {
317+
// // record it and write into terminal
318+
// process.stdout.write(key);
319+
// }
320+
// }
321+
// });
322+
// }
321323
}
322324

323325
async initPruning() {

packages/cli/test/benchmark/init.ts

-17
This file was deleted.

packages/cli/test/benchmarks/init.ts

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Config } from '@oclif/core';
2+
import { Start } from '@/commands/start';
3+
import * as testDb from '../integration/shared/testDb';
4+
5+
async function mainProcess() {
6+
const args: string[] = [];
7+
const _config = new Config({ root: __dirname });
8+
9+
const main = new Start(args, _config);
10+
11+
await main.init();
12+
await main.run();
13+
}
14+
15+
export const init = {
16+
database: testDb.init,
17+
mainProcess,
18+
};

packages/cli/test/benchmark/main.ts packages/cli/test/benchmarks/main.ts

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
/* eslint-disable import/no-extraneous-dependencies */ // @TODO: Remove
22

33
import 'reflect-metadata';
4-
54
import { Bench } from 'tinybench';
65
import { withCodSpeed } from '@codspeed/tinybench-plugin';
7-
8-
import { webhook } from './webhook.bm';
9-
10-
function registerBenchmarks(bench: Bench) {
11-
webhook(bench);
12-
}
6+
import { register } from './register';
137

148
async function main() {
15-
const bench = withCodSpeed(
16-
new Bench(
17-
{ time: 0, iterations: 1 }, // @TEMP: Remove
18-
),
19-
);
9+
const _bench = new Bench({ time: 0, iterations: 1 }); // @TEMP: Remove arg
10+
const bench = withCodSpeed(_bench);
2011

21-
registerBenchmarks(bench);
12+
register(bench);
2213

2314
// await bench.warmup(); // @TODO: Restore
2415
await bench.run();
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import type Bench from 'tinybench';
2+
import { webhook } from './webhook.benchmark';
3+
4+
export function register(bench: Bench) {
5+
webhook(bench);
6+
}

packages/cli/test/benchmark/webhook.bm.ts packages/cli/test/benchmarks/webhook.benchmark.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@ export function webhook(bench: Bench) {
66
bench.add(
77
'`start` command',
88
async () => {
9-
// console.log('ended');
10-
console.log(bench.iterations);
9+
console.log('iteration');
1110
},
1211
{
1312
beforeAll: async () => {
1413
console.log('beforeAll start');
1514

16-
await init.startCommand();
17-
// await init.database();
15+
await init.database();
16+
await init.mainProcess();
1817

1918
console.log('beforeAll end');
2019
},
20+
afterAll: () => {
21+
// stop process // @TODO
22+
},
2123
},
2224
);
2325
}

0 commit comments

Comments
 (0)