Easily create commands within a pit of success
npm install as-command
for example
import { asCommand } from 'as-command';
import { getResourceNameFromFileName } from 'visualogic';
import { stage } from '../../../utils/environment';
import { log } from '../../../utils/logger';
import { COMMANDS_OUTPUT_DIRECTORY } from '../__tmp__/directory';
const command = asCommand(
{
name: getResourceNameFromFileName(__filename),
stage: stage,
dir: COMMANDS_OUTPUT_DIRECTORY,
log,
},
async () => {
// your logic
}
);
// STAGE=test npx tsx src/contract/commands/yourLogic.ts
if (require.main === module) void command({});