Skip to content

Commit

Permalink
feat(crwrsca): Include version in welcome message
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobbe committed Sep 15, 2024
1 parent d924a72 commit d7a0b37
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions packages/create-redwood-rsc-app/src/latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ import process from 'node:process'
import type { Config } from './config.js'

import { ExitCodeError } from './error.js'
import { getCrwrscaVersion } from './version.js'

export function shouldRelaunch(config: Config) {
if (config.verbose) {
console.log('shouldRelaunch process.argv', process.argv)
console.log('shouldRelaunch crwrsca version', getCrwrscaVersion())
}

if (process.argv.includes('--no-check-latest')) {
Expand Down
11 changes: 8 additions & 3 deletions packages/create-redwood-rsc-app/src/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,25 @@ import chalk from 'chalk'

import type { Config } from './config.js'

import { getCrwrscaVersion } from './version.js'

export function printWelcome() {
console.log()
console.log(
chalk
.hex('bf4722')
.bold('🌲 Welcome to the RedwoodJS RSC quick-start installer 🌲'),
.bold(
'🌲 Welcome to the RedwoodJS RSC quick-start installer ' +
`v${getCrwrscaVersion()} 🌲`,
),
)
console.log()
console.log(
'This installer is designed to get you started as fast as possible.',
)
console.log(
'If you need a more customized setup, please use the official installer ' +
'by running `yarn create redwood-app`',
'by running `yarn create redwood-app`',
)
console.log()
}
Expand All @@ -26,7 +31,7 @@ export function printDone(config: Config) {
console.log()
console.log(
'You can now run the following commands to build and serve the included ' +
'example application',
'example application',
)
console.log()
console.log(chalk.hex('cef792')('> cd ' + config.installationDir))
Expand Down
8 changes: 6 additions & 2 deletions packages/create-redwood-rsc-app/src/version.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import fs from 'node:fs'

export function printVersion() {
export function getCrwrscaVersion() {
const packageJson = JSON.parse(
fs.readFileSync(new URL('../package.json', import.meta.url), 'utf-8'),
)
const version: string = packageJson.version

console.log(`create-redwood-rsc-app ${version}`)
return version
}

export function printVersion() {
console.log(`create-redwood-rsc-app v${getCrwrscaVersion()}`)
}

0 comments on commit d7a0b37

Please sign in to comment.