File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "version" : " 5.7.0" ,
55 "author" : " Yasuaki Uechi <y@uechi.io>" ,
66 "scripts" : {
7- "build" : " shx rm -rf lib && npm run build:ts --minify --dts" ,
7+ "build" : " shx rm -rf lib && yarn build:ts --minify --dts" ,
88 "build:ts" : " tsup src/index.ts src/cli.ts -d lib" ,
9- "dev" : " npm run build:ts --watch" ,
10- "prepublishOnly" : " npm run build" ,
9+ "dev" : " yarn build:ts --watch" ,
10+ "prepublishOnly" : " yarn build" ,
1111 "release" : " release-it" ,
1212 "test" : " echo notest"
1313 },
Original file line number Diff line number Diff line change 11#!/usr/bin/env node
22
33import chalk from 'chalk' ;
4- import epicfail from 'epicfail' ;
54import { resolve } from 'path' ;
65import { AfterHookOptions , create } from '.' ;
76
8- epicfail ( {
9- assertExpected : ( err ) => err . name === 'CLIError' ,
10- } ) ;
11-
127const templateRoot = resolve ( __dirname , '..' , 'templates' ) ;
138const caveat = ( { name, template } : AfterHookOptions ) => {
149 let text = `
Original file line number Diff line number Diff line change 11import chalk from 'chalk' ;
22import { CommonSpawnOptions } from 'child_process' ;
33import { spawn } from 'cross-spawn' ;
4+ import epicfail from 'epicfail' ;
45import execa , { CommonOptions , ExecaChildProcess } from 'execa' ;
56import fs from 'fs' ;
67import gitconfig from 'gitconfig' ;
@@ -65,7 +66,7 @@ export interface AfterHookOptions {
6566 installNpmPackage : ( packageName : string ) => Promise < void > ;
6667}
6768
68- class CLIError extends Error {
69+ export class CLIError extends Error {
6970 constructor ( message : string ) {
7071 super ( message ) ;
7172 this . name = 'CLIError' ;
@@ -196,6 +197,10 @@ async function getYargsOptions(
196197}
197198
198199export async function create ( appName : string , options : Options ) {
200+ epicfail ( {
201+ assertExpected : ( err ) => err . name === 'CLIError' ,
202+ } ) ;
203+
199204 const firstArg = process . argv [ 2 ] ;
200205 if ( firstArg === undefined ) {
201206 throw new CLIError ( `${ appName } <name>` ) ;
You can’t perform that action at this time.
0 commit comments