Skip to content

Commit

Permalink
Nuekit: Show Nuekit version in the "generator" meta tag. Closes #219
Browse files Browse the repository at this point in the history
  • Loading branch information
tipiirai committed Feb 24, 2024
1 parent ad6a292 commit c1feaa8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
9 changes: 6 additions & 3 deletions packages/nuekit/src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,17 @@ async function printHelp() {
}

async function printVersion() {
log(`Nue ${await getVersion()} ${colors.green('•')} ${getEngine()}`)
const v = await getVersion()
log(`Nue ${v} ${colors.green('•')} ${getEngine()}`)
return v
}

async function runCommand(args) {
const { createKit } = await import('./nuekit.js')
const nue = await createKit(args)
console.info('')
await printVersion()

args.nuekit_version = await printVersion()
const nue = await createKit(args)

// build
const { cmd='serve' } = args
Expand Down
9 changes: 3 additions & 6 deletions packages/nuekit/src/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { TYPES } from './nueserver.js'

export function renderHead(data, is_prod) {
const {
generator = `Nue v${data.nuekit_version} (nuejs.org)`,
viewport = 'width=device-width,initial-scale=1',
generator = 'Nue (nuejs.org)',
charset = 'utf-8',
title_template = '%s',
scripts = [],
Expand All @@ -25,11 +25,8 @@ export function renderHead(data, is_prod) {
// meta
const pushMeta = (key, val) => val && head.push(`<meta name="${key}" content="${val}">`)

if (is_prod) {
pushMeta('generator', generator)
pushMeta('date.updated', new Date().toISOString())
}

pushMeta('generator', generator)
pushMeta('date.updated', new Date().toISOString())
pushMeta('viewport', viewport)
pushMeta('description', data.description)
pushMeta('author', data.author)
Expand Down
4 changes: 2 additions & 2 deletions packages/nuekit/src/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ENOENT = -4058

export async function createSite(args) {

const { root, is_prod, env } = args
const { root, is_prod, env, nuekit_version } = args
const { is_bulk = args.cmd == 'build' } = args
const cache = {}

Expand Down Expand Up @@ -149,7 +149,7 @@ export async function createSite(args) {
}

self.getData = async function (pagedir) {
const data = { ...site_data }
const data = { nuekit_version, ...site_data }
for (const dir of getDirs(pagedir)) {
Object.assign(data, await readData(`${dir}/app.yaml`))
}
Expand Down

0 comments on commit c1feaa8

Please sign in to comment.