# Panther

This project was created using [Create Nuxt App](https://github.com/nuxt/create-nuxt-app).

## Installation and build commands

See: https://nuxtjs.org/guide/commands/

``` bash
# Install dependencies
npm install

# Development mode
# Launch the development server on localhost with hot-reloading
npm start
# or
npm run dev

# Production mode
# Build for production, minify the JavaScript and CSS, and launch the server in production mode
# (you probably won't use this often because we always deploy Panther as a static site)
npm run prod

# Analyze the production Webpack bundle
npm run analyze

# Generate static project
# Build the application and generate every route as an HTML file (used for static hosting)
npm run generate

# Deploy static project via Surge
# (Surge must be installed globally first)
npm install --global surge
npm run deploy
```

For detailed explanation on how Nuxt works, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js).

## Troubleshooting

If Node hangs for some reason, you may have to locate and kill the Node process (see [this StackOverflow answer](https://stackoverflow.com/questions/3855127/find-and-kill-process-locking-port-3000-on-mac#answer-18706913)):

``` bash
# Assuming you're using port 3333
lsof -i :3333
kill -9 <PID>
```

## Visual Studio Code configuration

For the best developer experience, we recommend installing the following [Visual Studio Code](https://code.visualstudio.com/) extensions:
- [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur)
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)

You'll need to edit your VSCode settings as follows, in order to make the Vetur and ESLint extensions work together properly (see [this documentation page](https://vuejs.github.io/vetur/linting-error.html) for more information):

``` javascript
"eslint.validate": [
  "javascript",
  "javascriptreact",
  {
    "language": "vue",
    "autoFix": true
  }
]
```

## Publishing prerelease NPM packages

Until we've fully migrated over to Nuxt and `tgam-patterns` version `5.0.0` has been released, this codebase will publish a prerelease version of `tgam-patterns` to NPM (e.g. `5.0.0-alpha.1`). To publish a new prerelease version, run the following commands:

``` bash
npm version prerelease
npm publish --tag next
git push
```

Then, in PageBuilder, install the latest prerelease version via:

``` bash
npm install --save tgam-patterns@next
```

Publishing prerelease versions with a custom tag means that `npm install tgam-patterns` and `npm install tgam-patterns@latest` will still install version `4.x` instead of `5.x`, which is ideal. See the following for more information:

- https://medium.com/@mbostock/prereleases-and-npm-e778fc5e2420
- https://docs.npmjs.com/adding-dist-tags-to-packages
