-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pooya parsa
committed
Feb 23, 2019
1 parent
383f613
commit d53a49a
Showing
2 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) Nuxt.js Team | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# @nuxtjs/now-builder | ||
|
||
The Now Nuxt.js Builder takes a [Nuxt.js application](https://nuxtjs.org), defined by a `nuxt.config.js` entrypoint and deploys it to Now2 serverless environment. | ||
|
||
It features built-in caching of `node_modules` and all multi-stage build for fast and small-sized deployments. | ||
|
||
## When to use it | ||
|
||
`@nuxtjs/now-builder` is the ideal way to ship a fast, production-ready [Nuxt.js application](https://nuxtjs.org) that scales automatically. | ||
|
||
For more information on why you should use Nuxt.js for your project, see [the Nuxt.js website](https://nuxtjs.org). | ||
|
||
## How to use it | ||
|
||
The first step is to set up a Nuxt.js project. | ||
|
||
To get started, make sure you have installed the Nuxt.js dependencies with the following command: | ||
|
||
```bash | ||
yarn add nuxt | ||
``` | ||
|
||
Then, in your project directory, create a `pages` directory with some example pages, for example; the home index page, `pages/index.vue`: | ||
|
||
```html | ||
<template> | ||
<div> | ||
Works! | ||
</div> | ||
</template> | ||
``` | ||
|
||
Create a simple `nuxt.config.js` file: | ||
|
||
```js | ||
export default { | ||
head: { | ||
title: 'My Nuxt.js Application!' | ||
} | ||
} | ||
``` | ||
|
||
Then define builds and routes in `now.json` configuration file: | ||
|
||
```json | ||
{ | ||
"version": 2, | ||
"builds": [ | ||
{ "src": "nuxt.config.js", "use": "@nuxtjs/now-builder" } | ||
], | ||
"routes": [ | ||
{ "src": "/_nuxt/.+", "headers": { "cache-control": "s-maxage=31536000" } }, | ||
{ "src": "/(.*).(.*)" }, | ||
{ "src": "/(.*)", "dest": "/"} | ||
] | ||
} | ||
``` | ||
|
||
Upon deployment, you will get a URL like this: https://nuxtjs-8fnzfb1ci.now.sh | ||
|
||
## Technical Details | ||
|
||
### Dependencies installation | ||
|
||
The installation algorithm of dependencies works as follows: | ||
|
||
- If a `package-lock.json` is present, `npm install` is used | ||
- Otherwise, `yarn` is used. | ||
|
||
**NOTE:** Using `yarn` is HIGHLY recommanded! | ||
|
||
### Private npm modules | ||
|
||
To install private npm modules, define `NPM_TOKEN` as a [build environment](https://zeit.co/docs/v2/deployments/configuration#build.env) in `now.json`. | ||
|
||
### Node.js version | ||
|
||
The Node.js version used is the latest in the **8 branch**. | ||
|
||
# License | ||
|
||
Docs and Builder inspired by [Next.js](https://nextjs.org) by [Zeit.co](https://zeit.co). | ||
|
||
MIT - Nuxt.js Team |