1
1
import { execSync } from "child_process" ;
2
- import { existsSync , readdirSync , readFileSync , writeFileSync } from "fs" ;
2
+ import { existsSync , mkdir , mkdirSync , readdirSync , readFileSync , writeFileSync } from "fs" ;
3
3
import path from "path" ;
4
4
import { parseHeader } from "./header-parser" ;
5
5
import { readmeFilenames , scripts , scriptsPath } from "./utils" ;
@@ -38,7 +38,8 @@ function isValidHttpUrl(string: string) {
38
38
39
39
function makeReadme ( script : string ) {
40
40
const indexJs = path . resolve ( scriptsPath , script , 'index.js' ) ;
41
- const readmePath = path . resolve ( process . cwd ( ) , 'temp' , script , 'README.md' ) ;
41
+ const tempDir = path . resolve ( process . cwd ( ) , 'node_modules/.cache' ) ;
42
+ const readmePath = path . resolve ( tempDir , script , 'README.md' ) ;
42
43
const readmeDefault = [
43
44
'# ' + script ,
44
45
'' ,
@@ -50,6 +51,7 @@ function makeReadme (script: string) {
50
51
''
51
52
] ;
52
53
54
+ mkdir ( path . resolve ( tempDir , script ) , console . warn ) ;
53
55
if ( ! existsSync ( indexJs ) ) {
54
56
console . error ( script , "missing index.js" ) ;
55
57
writeFileSync ( readmePath , readmeDefault . join ( '\n' ) ) ;
0 commit comments