Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/mystmd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"dev": "npm run link && esbuild src/index.ts --bundle --outfile=dist/myst.cjs --platform=node --external:fsevents --watch",
"lint": "npm run copy:version; eslint \"src/**/!(*.spec).ts\" -c ./.eslintrc.cjs",
"lint:format": "npm run copy:version; prettier --check \"src/**/*.ts\"",
"test": "npm run link; npm run copy:version; vitest run",
"typecheck": "tsc --noEmit",
"test": "npm run link; npm run copy:version; vitest run; bun run typecheck",
"test:watch": "npm run link; npm run copy:version; vitest watch",
"build:cli": "esbuild src/index.ts --bundle --outfile=dist/myst.cjs --platform=node --external:fsevents --target=node18",
"build": "npm-run-all -l clean copy:version -p build:cli"
Expand Down
2 changes: 1 addition & 1 deletion packages/mystmd/src/clirun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function clirun(
const opts = { ...program.opts(), ...(this?.opts?.() ?? {}) } as SessionOpts;
const logger = chalkLogger(opts?.debug ? LogLevel.debug : LogLevel.info, process.cwd());
// Override default myst.yml if --config option is given.
const configFiles = opts?.config ? [opts.config] : null;
const configFiles = opts?.config ? [opts.config] : undefined;
const parallelCount = opts?.executeParallel ?? Math.max(1, cpus().length - 1);
const executionSemaphore = new Semaphore(parallelCount);
const session = new sessionClass({ logger, configFiles, executionSemaphore });
Expand Down
6 changes: 3 additions & 3 deletions packages/mystmd/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import 'core-js/actual'; // This adds backwards compatible functionality for var
// This suppresses the punycode deprecation warning
// https://github.com/jupyter-book/mystmd/issues/1166
const { emit: originalEmit } = process;
function suppressor(event: string, error: Error) {
function suppressor(event: string, ...args: any[]) {
const error = args[0] as Error;
return event === 'warning' && error.name === 'DeprecationWarning'
? false
: // eslint-disable-next-line prefer-rest-params
originalEmit.apply(process, arguments);
: (originalEmit as (...args: any[]) => boolean).apply(process, [event, ...args]);
}
(process as any).emit = suppressor;

Expand Down
4 changes: 3 additions & 1 deletion packages/mystmd/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export function makeInitCLI(program: Command) {
// The default command runs `myst init` with no arguments
export function addDefaultCommand(program: Command) {
program.action(async (...args: any[]) => {
if (program.args.length === 0) return clirun(Session, init, program, { keepAlive: true })(args);
if (program.args.length === 0) {
return clirun(Session, init, program, { keepAlive: true }).call(program, ...args);
}
console.error(
`${chalk.red(`Invalid command: `)}${chalk.bold(program.args.join(' '))}\n\n${chalk.dim(
'See --help for a list of available commands.\n',
Expand Down
9 changes: 9 additions & 0 deletions packages/mystmd/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../tsconfig/base.json",
"compilerOptions": {
"outDir": "dist",
"noEmit": true
},
"include": ["src"],
"exclude": ["dist", "node_modules", "src/**/*.spec.ts", "tests"]
}