mirror of
https://github.com/directus/directus.git
synced 2026-02-17 12:01:22 -05:00
Fix extension CLI not executing any command (#7667)
This commit is contained in:
committed by
GitHub
parent
fe882fd407
commit
40f8d2ef99
@@ -1,2 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('./dist/cjs/cli/index.js');
|
||||
require('./dist/cjs/cli/run.js');
|
||||
|
||||
@@ -1,31 +1,4 @@
|
||||
import { Command } from 'commander';
|
||||
import create from './commands/create';
|
||||
import build from './commands/build';
|
||||
|
||||
const pkg = require('../../../package.json');
|
||||
|
||||
if (require.main === module) {
|
||||
run();
|
||||
}
|
||||
|
||||
function run() {
|
||||
const program = new Command();
|
||||
|
||||
program.name('directus-extension').usage('[command] [options]');
|
||||
program.version(pkg.version, '-v, --version');
|
||||
|
||||
program.command('create').arguments('<type> <name>').description('Scaffold a new Directus extension').action(create);
|
||||
|
||||
program
|
||||
.command('build')
|
||||
.description('Bundle a Directus extension to a single entrypoint')
|
||||
.option('-t, --type <type>', 'overwrite the extension type read from package manifest')
|
||||
.option('-i, --input <file>', 'overwrite the entrypoint read from package manifest')
|
||||
.option('-o, --output <file>', 'overwrite the output file read from package manifest')
|
||||
.option('-f, --force', 'ignore the package manifest')
|
||||
.action(build);
|
||||
|
||||
program.parse(process.argv);
|
||||
}
|
||||
|
||||
export { create, build };
|
||||
|
||||
23
packages/extension-sdk/src/cli/run.ts
Normal file
23
packages/extension-sdk/src/cli/run.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { Command } from 'commander';
|
||||
import create from './commands/create';
|
||||
import build from './commands/build';
|
||||
|
||||
const pkg = require('../../../package.json');
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program.name('directus-extension').usage('[command] [options]');
|
||||
program.version(pkg.version, '-v, --version');
|
||||
|
||||
program.command('create').arguments('<type> <name>').description('Scaffold a new Directus extension').action(create);
|
||||
|
||||
program
|
||||
.command('build')
|
||||
.description('Bundle a Directus extension to a single entrypoint')
|
||||
.option('-t, --type <type>', 'overwrite the extension type read from package manifest')
|
||||
.option('-i, --input <file>', 'overwrite the entrypoint read from package manifest')
|
||||
.option('-o, --output <file>', 'overwrite the output file read from package manifest')
|
||||
.option('-f, --force', 'ignore the package manifest')
|
||||
.action(build);
|
||||
|
||||
program.parse(process.argv);
|
||||
Reference in New Issue
Block a user