Skip to content

Commit

Permalink
chore: add npx prefix for nuxthub commands
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Oct 7, 2024
1 parent 3077181 commit aa13911
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/content/1.docs/1.getting-started/1.index.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ The [NuxtHub admin](https://admin.hub.nuxt.com) is a web based dashboard to mana
It abstracts the complexity of managing full-stack Nuxt applications on Cloudflare:

- Link your Cloudflare account and stay in control, we never mark-up Cloudflare prices
- [Deploy your application](/docs/getting-started/deploy) with `nuxthub deploy` command or with Cloudflare Pages CI
- [Deploy your application](/docs/getting-started/deploy) with `npx nuxthub deploy` command or with Cloudflare Pages CI
- Relax while it provisions all the necessary resources (ai, blob, cache, database, kv)
- Manage your app's resources with an admin panel
- Visualize application, database, and cache metrics
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1.docs/1.getting-started/3.deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ jobs:
```
You need to add the following secrets to your GitHub repository:
- `NUXT_HUB_PROJECT_KEY`: Your project key (available in your project settings in the NuxtHub Admin or in your `.env` file if you ran `nuxthub link`)
- `NUXT_HUB_PROJECT_KEY`: Your project key (available in your project settings in the NuxtHub Admin or in your `.env` file if you ran `npx nuxthub link`)
- `NUXT_HUB_USER_TOKEN`: Your user token available in **User settings** → **Tokens** in the NuxtHub Admin

::tip
Expand Down
2 changes: 1 addition & 1 deletion docs/content/1.docs/1.getting-started/4.remote-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ You should not use the `remote` option in your `nuxt.config` file in production
::

::note
NuxtHub will use the remote storage from your deployed project **as long as you are logged in with the [NuxtHub CLI](https://github.com/nuxt-hub/cli) and the local project is linked to a NuxtHub project** with `nuxthub link` or `nuxthub deploy`.
NuxtHub will use the remote storage from your deployed project **as long as you are logged in with the [NuxtHub CLI](https://github.com/nuxt-hub/cli) and the local project is linked to a NuxtHub project** with `npx nuxthub link` or `npx nuxthub deploy`.
::

### Production vs Preview
Expand Down
6 changes: 3 additions & 3 deletions docs/content/1.docs/1.getting-started/5.server-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Using the [NuxtHub CLI](https://github.com/nuxt-hub/cli), you can access to the
By default, the CLI will detect based on the current branch the canonical deployment of your project and stream the logs of that deployment in the CLI.

```bash [Terminal]
nuxthub logs
npx nuxthub logs
```

:nuxt-img{src="/images/landing/nuxthub-cli-server-logs.png" alt="NuxtHub CLI Server Logs" width="915" height="515" data-zoom-src="/images/landing/nuxthub-cli-server-logs.png" class="rounded"}
Expand All @@ -28,13 +28,13 @@ nuxthub logs
To access the logs of the production environment, you can use the `--production` flag.

```bash [Terminal]
nuxthub logs --production
npx nuxthub logs --production
```

### Preview environment

In preview environment, NuxtHub will stream the logs of the latest successful deployment in the CLI.

```bash [Terminal]
nuxthub logs --preview
npx nuxthub logs --preview
```
2 changes: 1 addition & 1 deletion docs/content/5.blog/1.beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ The [NuxtHub admin](https://admin.hub.nuxt.com) is a web based dashboard to mana
Some of the features are:
- Link your Cloudflare account and stay in control (we never mark-up Cloudflare prices)
- Clone one of our full-stack Nuxt templates
- Deploy your application with nuxthub deploy command or link your GitHub or GitLab repository
- Deploy your application with `npx nuxthub deploy` command or link your GitHub or GitLab repository
- Relax while it provisions all the necessary resources (database, kv, blob)
- Manage your app's resources with an admin panel
- Share team member access to manage your app without sharing your Cloudflare account
Expand Down
18 changes: 9 additions & 9 deletions src/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function setupBase(nuxt: Nuxt, hub: HubConfig) {
export async function setupAI(nuxt: Nuxt, hub: HubConfig) {
// If we are in dev mode and the project is not linked, disable it
if (nuxt.options.dev && !hub.remote && !hub.projectKey) {
return log.warn('`hubAI()` is disabled: link a project with `nuxthub link` to run AI models in development mode.')
return log.warn('`hubAI()` is disabled: link a project with `npx nuxthub link` to run AI models in development mode.')
}
// If we are in dev mode and the project is linked, verify it
if (nuxt.options.dev && !hub.remote && hub.projectKey) {
Expand All @@ -95,9 +95,9 @@ export async function setupAI(nuxt: Nuxt, hub: HubConfig) {
if (!err.status) {
log.warn ('`hubAI()` is disabled: it seems that you are offline.')
} else if (err.status === 401) {
log.warn ('`hubAI()` is disabled: you are not logged in, make sure to run `nuxthub login`.')
log.warn ('`hubAI()` is disabled: you are not logged in, make sure to run `npx nuxthub login`.')
} else {
log.error('`hubAI()` is disabled: failed to fetch linked project `' + hub.projectKey + '` on NuxtHub, make sure to run `nuxthub link` again.')
log.error('`hubAI()` is disabled: failed to fetch linked project `' + hub.projectKey + '` on NuxtHub, make sure to run `npx nuxthub link` again.')
}
return
}
Expand Down Expand Up @@ -262,9 +262,9 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {
if (!err.status) {
log.error('It seems that you are offline.')
} else if (err.status === 401) {
log.error('It seems that you are not logged in, make sure to run `nuxthub login`.')
log.error('It seems that you are not logged in, make sure to run `npx nuxthub login`.')
} else {
log.error('Failed to fetch linked project on NuxtHub, make sure to run `nuxthub link` again.')
log.error('Failed to fetch linked project on NuxtHub, make sure to run `npx nuxthub link` again.')
}
process.exit(1)
})
Expand All @@ -286,7 +286,7 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {
hub.projectUrl = hub.projectUrl || (env === 'production' ? project.url : project.previewUrl)
// No production or preview URL found
if (!hub.projectUrl) {
log.error(`No deployment found for \`${env}\`, make sure to deploy the project using \`nuxthub deploy\`.`)
log.error(`No deployment found for \`${env}\`, make sure to deploy the project using \`npx nuxthub deploy\`.`)
process.exit(1)
}
// Update hub.env in runtimeConfig
Expand All @@ -295,7 +295,7 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {

// Make sure we have a projectUrl when using the remote option
if (!hub.projectUrl) {
log.error('No project URL defined, make sure to link your project with `nuxthub link` or add the deployed URL as `NUXT_HUB_PROJECT_URL` environment variable (if self-hosted).')
log.error('No project URL defined, make sure to link your project with `npx nuxthub link` or add the deployed URL as `NUXT_HUB_PROJECT_URL` environment variable (if self-hosted).')
process.exit(1)
}

Expand All @@ -314,11 +314,11 @@ export async function setupRemote(_nuxt: Nuxt, hub: HubConfig) {
}
})
.catch(async (err) => {
let message = 'Project not found.\nMake sure to deploy the project using `nuxthub deploy` or add the deployed URL as `NUXT_HUB_PROJECT_URL` environment variable.'
let message = 'Project not found.\nMake sure to deploy the project using `npx nuxthub deploy` or add the deployed URL as `NUXT_HUB_PROJECT_URL` environment variable.'
if (err.status >= 500) {
message = 'Internal server error'
} else if (err.status === 401) {
message = 'Authorization failed.\nMake sure to provide a valid NUXT_HUB_PROJECT_SECRET_KEY or being logged in with `nuxthub login`'
message = 'Authorization failed.\nMake sure to provide a valid NUXT_HUB_PROJECT_SECRET_KEY or being logged in with `npx nuxthub login`'
}
log.error(`Failed to fetch remote storage: ${message}`)
process.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions src/types/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ export interface ModuleOptions {
*/
url?: string
/**
* The project's key on the NuxtHub platform, added with `nuxthub link`.
* The project's key on the NuxtHub platform, added with `npx nuxthub link`.
* @default process.env.NUXT_HUB_PROJECT_KEY
*/
projectKey?: string
/**
* The user token to access the NuxtHub platform, added with `nuxthub login`
* The user token to access the NuxtHub platform, added with `npx nuxthub login`
* @default process.env.NUXT_HUB_USER_TOKEN
*/
userToken?: string
Expand Down

0 comments on commit aa13911

Please sign in to comment.