Skip to content

Commit

Permalink
chore(runtime): add instructions for nuxt >= 2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinmarrec committed Feb 23, 2021
1 parent b8a349f commit 6752bcc
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions packages/typescript-runtime/bin/nuxt-ts.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,26 @@
#!/usr/bin/env node

const cli = (() => { try { return require('@nuxt/cli') } catch (err) { return require('@nuxt/cli-edge') } })()
let cli, hooks, version

const { hooks } = require('..')
try {
cli = require('@nuxt/cli')
version = require('@nuxt/cli/package.json').version
} catch (err) {
cli = require('@nuxt/cli-edge')
version = require('@nuxt/cli-edge/package.json').version
}

const { coerce, gte } = require('semver')

if (gte(coerce(version), '2.15.0')) {
const chalk = require('chalk')
const consola = require('consola')
consola.warn(chalk`You're using Nuxt {green ${version}}, which includes built-in TypeScript {blue runtime} support`)
consola.warn(chalk`You can safely use {green nuxt} instead of {yellow nuxt-ts} and remove {blue @nuxt/typescript-runtime} package`)
hooks = {}
} else {
hooks = require('..').hooks
}

cli.run(null, hooks)
.catch((error) => {
Expand Down

0 comments on commit 6752bcc

Please sign in to comment.