Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes nuxt-hub/cli#8 #9

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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