Skip to content

Commit

Permalink
Fixes nuxt-hub#8
Browse files Browse the repository at this point in the history
  • Loading branch information
unibeck committed Apr 23, 2024
1 parent c0ee04d commit c3c1e6c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
*.log
.env
.idea/
11 changes: 10 additions & 1 deletion src/commands/deploy.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ export default defineCommand({
type: 'boolean',
description: 'Force the current deployment as preview.',
default: false
},
dotenv: {
type: 'string',
description: 'Point to another .env file to load, relative to the root directory.',
default: ''
}
},
async setup({ args }) {
Expand Down Expand Up @@ -83,7 +88,11 @@ export default defineCommand({
if (!deps['@nuxthub/core']) {
consola.warn('`@nuxthub/core` is not installed, make sure to install it with `npx nuxt module add hub`')
}
await execa('./node_modules/.bin/nuxi', ['build', '--preset=cloudflare-pages'], { stdio: 'inherit' })
const nuxiBuildArgs = ['--preset=cloudflare-pages'];
if (args.dotenv) {
nuxiBuildArgs.push(`--dotenv=${args.dotenv}`);
}
await execa('./node_modules/.bin/nuxi', ['build', ...nuxiBuildArgs], { stdio: 'inherit' })
.catch((err) => {
if (err.code === 'ENOENT') {
consola.error('`nuxt` is not installed, please make sure that you are inside a Nuxt project.')
Expand Down
2 changes: 1 addition & 1 deletion src/commands/init.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { execa } from 'execa'
export default defineCommand({
meta: {
name: 'init',
description: 'Initialize a fresh NuxtHUb project, alias of `nuxi init -t hub`.',
description: 'Initialize a fresh NuxtHub project, alias of `nuxi init -t hub`.',
},
async setup({ args }) {
await execa('npx', ['nuxi@latest', 'init', '-t', 'hub', ...args._], { stdio: 'inherit' })
Expand Down

0 comments on commit c3c1e6c

Please sign in to comment.