🐛 cannot run
parent
4de156fa33
commit
7c01e3534c
|
@ -9,7 +9,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "tsx src",
|
"dev": "tsx src",
|
||||||
"build": "tsup",
|
"build": "tsup-node",
|
||||||
"prepack": "pnpm build"
|
"prepack": "pnpm build"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|
10
src/index.ts
10
src/index.ts
|
@ -1,17 +1,23 @@
|
||||||
#!/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
import { program } from 'commander'
|
import { program } from 'commander'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import { PropertiesSchema } from './schema'
|
import { PropertiesSchema } from './schema'
|
||||||
import prettier from 'prettier'
|
import prettier from 'prettier'
|
||||||
import fs from 'fs'
|
import fs from 'fs'
|
||||||
import { getPropertyType, propertyTypes } from './types'
|
import { getPropertyType } from './types'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
await program.parseAsync()
|
await program.parseAsync()
|
||||||
|
|
||||||
const url = program.args[0]
|
const url = program.args[0]
|
||||||
|
|
||||||
|
if (!url) {
|
||||||
|
console.error(chalk.red('Usage: adofai-typegen <url>'))
|
||||||
|
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
console.log(chalk.blue`Fetching properties json`)
|
console.log(chalk.blue`Fetching properties json`)
|
||||||
|
|
||||||
const data: PropertiesSchema = await (await fetch(url)).json()
|
const data: PropertiesSchema = await (await fetch(url)).json()
|
||||||
|
|
Loading…
Reference in New Issue