-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
23 lines (19 loc) · 903 Bytes
/
index.ts
File metadata and controls
23 lines (19 loc) · 903 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env node
import { CLI, findProjectRoot } from '@nexical/cli-core';
import { fileURLToPath } from 'node:url';
import { discoverCommandDirectories } from './src/utils/discovery.js';
import pkg from './package.json';
import path from 'node:path';
import { filterCommandDirectories } from './src/utils/filter.js';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const commandName = 'nexical';
const projectRoot = (await findProjectRoot(commandName, process.cwd())) || process.cwd();
const coreCommandsDir = path.resolve(__dirname, './src/commands');
const additionalCommands = discoverCommandDirectories(projectRoot);
const filteredAdditional = filterCommandDirectories(additionalCommands, coreCommandsDir);
const app = new CLI({
version: pkg.version,
commandName: commandName,
searchDirectories: [...new Set([coreCommandsDir, ...filteredAdditional])],
});
app.start();