Skip to content

Commit

Permalink
Fix Linux & Remove top level await support in console, temporarily (#231
Browse files Browse the repository at this point in the history
)

(patch)
  • Loading branch information
flybayer authored Apr 25, 2020
1 parent dcc9c4d commit 6af0eb7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/blitz/bin/blitz
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node --experimental-repl-await
#!/usr/bin/env node

require('../dist/cli')
14 changes: 9 additions & 5 deletions packages/blitz/src/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ if (fs.existsSync(localCLIPkgPath)) {
const cli = require(pkgPath as string)

const options = require('minimist')(process.argv.slice(2))
if (options._.length === 0 && (options.v || options.version)) {
// TODO: remove
console.log('debug:', usageType)
console.log('debug: pkgPath:', pkgPath, '\n')
const hasVersionFlag = options._.length === 0 && (options.v || options.version)
const hasVerboseFlag = options._.length === 0 && (options.V || options.verbose)

if (hasVersionFlag) {
if (hasVerboseFlag) {
console.log('debug:', usageType)
console.log('debug: pkgPath:', pkgPath, '\n')
}
try {
const osName = require('os-name')
console.log(`${osName()} ${process.platform}-${process.arch} node-${process.version}\n`)
console.log(`${osName()} | ${process.platform}-${process.arch} | Node: ${process.version}\n`)

let globalInstallPath
let localButGlobalLinked = usageType === 'local' && fs.existsSync(globalLinkedPath)
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/run
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env node --experimental-repl-await
#!/usr/bin/env node

require('@blitzjs/cli').run()
7 changes: 5 additions & 2 deletions packages/cli/src/commands/console.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ export default class Console extends Command {
async run() {
log.branded('You have entered the Blitz console')
console.log(chalk.yellow('Tips: - Exit by typing .exit or pressing Ctrl-D'))
console.log(chalk.yellow(' - Use your db like this: await db.user.findMany()'))
console.log(chalk.yellow(' - Use your queries/mutations like this: await getUsers()'))
console.log(chalk.yellow(' - Use your db like this: db.user.findMany().then(console.log)'))
console.log(chalk.yellow(' - Use your queries/mutations like this: getUsers().then(console.log)'))
console.log(
chalk.yellow(' - Top level `await` support coming: https://github.com/blitz-js/blitz/issues/230'),
)

setupTsnode()
await runPrismaGeneration({silent: true})
Expand Down

0 comments on commit 6af0eb7

Please sign in to comment.