@diplodoc/cli
Advanced tools
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "4.21.0", | ||
"version": "4.22.0-alpha-1", | ||
"repository": { | ||
@@ -13,3 +13,4 @@ "type": "git", | ||
"bin": { | ||
"yfm": "build/index.js" | ||
"yfm": "build/index.js", | ||
"docs": "build/index.js" | ||
}, | ||
@@ -32,4 +33,4 @@ "main": "build/index.js", | ||
"typecheck": "tsc --noEmit", | ||
"prepublishOnly": "npm run lint && npm run build", | ||
"git:head": "git checkout master && git pull" | ||
"test": "vitest", | ||
"prepublishOnly": "npm run lint && npm run build" | ||
}, | ||
@@ -65,6 +66,7 @@ "engines": { | ||
"@types/mime-types": "2.1.4", | ||
"@types/node": "14.*", | ||
"@types/node": "^18.19.4", | ||
"@types/shelljs": "0.8.15", | ||
"@types/tar-stream": "^2.2.2", | ||
"@types/yargs": "17.0.24", | ||
"@vitest/coverage-v8": "^1.2.1", | ||
"ajv": "^8.11.0", | ||
@@ -74,2 +76,3 @@ "async": "^3.2.4", | ||
"chalk": "^4.1.2", | ||
"commander": "^12.0.0", | ||
"esbuild": "^0.20.0", | ||
@@ -85,6 +88,10 @@ "glob": "^8.0.3", | ||
"node-html-parser": "^6.1.5", | ||
"normalize-path": "^3.0.0", | ||
"simple-git": "3.22.0", | ||
"slugify": "^1.6.5", | ||
"tapable": "^2.2.1", | ||
"tar-stream": "^3.1.4", | ||
"typescript": "^5.3.3", | ||
"typescript": "^5.4.5", | ||
"vite-tsconfig-paths": "^4.2.3", | ||
"vitest": "^1.1.3", | ||
"walk-sync": "^3.0.0" | ||
@@ -91,0 +98,0 @@ }, |
@@ -23,3 +23,3 @@ import glob from 'glob'; | ||
import {copyFiles, logger} from '../../utils'; | ||
import {upload as publishFilesToS3} from '../publish/upload'; | ||
import {upload as publishFilesToS3} from '../../commands/publish/upload'; | ||
@@ -26,0 +26,0 @@ export const build = { |
export {build} from './build'; | ||
export {publish} from './publish'; | ||
export {translate} from './translate'; | ||
// export {publish} from './publish'; | ||
// export {translate} from './translate'; |
declare const VERSION: string; | ||
type Hash<T = any> = Record<string, T>; |
@@ -1,53 +0,34 @@ | ||
import yargs from 'yargs'; | ||
import {hideBin} from 'yargs/helpers'; | ||
import log from '@diplodoc/transform/lib/log'; | ||
import 'threads/register'; | ||
import {MAIN_TIMER_ID} from '~/constants'; | ||
import {MAIN_TIMER_ID} from './constants'; | ||
export type {ICallable, IProgram, ProgramConfig, ProgramArgs} from './program'; | ||
export {Program} from './program'; | ||
import {build, publish, translate} from './cmd'; | ||
export type {Config, OptionInfo} from './config'; | ||
export {Command, option, deprecated} from './config'; | ||
console.time(MAIN_TIMER_ID); | ||
import {Program} from './program'; | ||
yargs | ||
.command(build) | ||
.command(publish) | ||
.command(translate) | ||
.option('config', { | ||
alias: 'c', | ||
describe: 'YFM configuration file', | ||
type: 'string', | ||
}) | ||
.option('strict', { | ||
alias: 's', | ||
default: false, | ||
describe: 'Run in strict mode', | ||
type: 'boolean', | ||
}) | ||
.option('quiet', { | ||
alias: 'q', | ||
default: false, | ||
describe: "Run in quiet mode. Don't write logs to stdout", | ||
type: 'boolean', | ||
}) | ||
.group(['config', 'strict', 'quiet', 'help', 'version'], 'Common options:') | ||
.version(typeof VERSION !== 'undefined' ? VERSION : '') | ||
.help() | ||
.parse(hideBin(process.argv), {}, (err, {strict}, output) => { | ||
console.timeEnd(MAIN_TIMER_ID); | ||
if (module.require.main === module) { | ||
(async () => { | ||
console.time(MAIN_TIMER_ID); | ||
if (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
let exitCode = 0; | ||
try { | ||
const program = new Program(); | ||
await program.init(process.argv); | ||
await program.parse(process.argv); | ||
} catch (error: any) { | ||
exitCode = 1; | ||
const {warn, error} = log.get(); | ||
const message = error?.message || error; | ||
if ((strict && warn.length) || error.length) { | ||
process.exit(1); | ||
if (message) { | ||
console.error(error.stack || error.message || error); | ||
} | ||
} | ||
console.log(output); | ||
console.timeEnd(MAIN_TIMER_ID); | ||
process.exit(0); | ||
}); | ||
process.exit(exitCode); | ||
})(); | ||
} |
@@ -87,4 +87,7 @@ import walkSync from 'walk-sync'; | ||
// collect paths of all resources | ||
Object.keys(resources).forEach((type) => | ||
resources[type as keyof Resources]?.forEach((path: string) => resourcePaths.push(path)), | ||
Object.keys(resources).forEach( | ||
(type) => | ||
resources[type as keyof Resources]?.forEach((path: string) => | ||
resourcePaths.push(path), | ||
), | ||
); | ||
@@ -91,0 +94,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
45838473
25.18%103
24.1%21679
9.26%46
15%2
100%2
100%