Skip to content

Commit

Permalink
Updated now deploy
Browse files Browse the repository at this point in the history
Updated scripts
Ran linter again globally
Updated git ignore file
  • Loading branch information
Marvin Heilemann committed Jan 20, 2020
1 parent 5563b6e commit 495bfee
Show file tree
Hide file tree
Showing 15 changed files with 120 additions and 250 deletions.
11 changes: 0 additions & 11 deletions .env.development

This file was deleted.

8 changes: 8 additions & 0 deletions .env.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Environment file for Gatsby's build/develop process.
# Don't forget to insert `siteMetadata` related stuff into
# the `gatsby/utils.js` function as well.
#
# https://www.gatsbyjs.org/docs/environment-variables/#defining-environment-variables

# External API's
RIOT_API_KEY=""
110 changes: 44 additions & 66 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,76 +1,54 @@
/_old
/tmp
.env.*
!.env.development
/reports
docker/nginx/certs
reports
.env.*
!.env.tmpl

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/
#
# GatsbyJS
#

# Optional npm cache directory
.npm
public

# Optional eslint cache
.eslintcache
#
# NodeJS
#

# Optional REPL history
.node_repl_history
node_modules
.cache

# Output of 'npm pack'
*.tgz
#
# Git
#

# dotenv environment variables file
.env
.git

# gatsby files
.cache/
public
#
# macOS
#

# Mac files
# General
.DS_Store

# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
1 change: 1 addition & 0 deletions .nowignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ newcert:
# Setup

create-env:
if test -f .env.production; \
then echo Production environment file already exist, exiting...; exit 0; \
else cp .env.development .env.production; echo Created production environment file; \
if test -f .env.build; \
then echo Environment file already exist, exiting...; exit 0; \
else cp .env.tmpl .env.build; echo Created environment file; \
fi

create-dirs:
Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,22 @@ for development.

## Deploy

Since I use [now](https://zeit.co/muuvmuuv/portfolio) for my website, it is
deployed there and fully automated.
I'm using [now](https://zeit.co/muuvmuuv/portfolio) to deploy my site.

```shell
npm run deploy
npm run deploy-prod
```

## Build

```shell
npm run build
```

To test the build run either `npm run serve` for a simple HTTP server to test if
everything is working or `make up` to start a live development NGINX web-server.
To test the website locally you can run either `npm run serve` to start a local
dev server by [Zeit Now](https://zeit.co/docs/now-cli#commands/dev) or build the
website and run `make up` to start a local NGINX docker container.

## Docker

Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- [ ] Test
- [ ] Everything pushed to master -> marvin.digital
- [ ] Everything pushed to development -> dev.marvin.digital
- [ ] Setup GitHub workflow to deploy with notification and version alias
- [x] replace React with [Preact][1] (check if it works when finished)
- [x] add version to GraphQL data not as file...
- [x] remove "build brotli from source" with a already finished build
Expand Down
25 changes: 15 additions & 10 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

/* eslint-disable import/first */
require('dotenv').config({
path: `.env.${process.env.NODE_ENV}`,
path: `.env.build`,
})

const { yellow, blue } = require('kleur')
const { versionMajorMinor, getVersion } = require('./gatsby/utils')
const { getVersion } = require('./gatsby/utils')
const { activeEnv, isDev } = require('./gatsby/environment')
const commonRemark = require('./gatsby/config/commonRemark')
const siteMetadata = require('./metadata')
Expand Down Expand Up @@ -210,21 +210,26 @@ module.exports = {
removeVersionOnly: true,
},
},
{
resolve: 'gatsby-plugin-react-axe',
options: {
// https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure
axeOptions: {},
},
},
// BUG: https://github.com/angeloashmore/gatsby-plugin-react-axe/issues/6
// {
// resolve: 'gatsby-plugin-react-axe',
// options: {
// showInProduction: false,
// // https://github.com/dequelabs/axe-core/blob/master/doc/API.md#api-name-axeconfigure
// axeOptions: {},
// },
// },
{
resolve: 'gatsby-plugin-webpack-bundle-analyzer',
options: {
analyzerMode: 'static',
production: true,
disable: isDev,
openAnalyzer: true,
reportFilename: `${__dirname}/reports/v${versionMajorMinor()}/treemap.html`,
reportFilename: `${__dirname}/reports/v${getVersion(
['major', 'minor'],
false
)}/treemap.html`,
},
},
],
Expand Down
29 changes: 13 additions & 16 deletions gatsby/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,22 @@ module.exports.slugify = (text, separator) => {
}

/**
* Return the app major and minor without patch version.
* Return the app version.
*
* @param {boolean} version select which version to return
* @param {boolean} noDots remove the dots
*/
module.exports.getVersion = () => {
const version = require('../package.json').version
return version
}
module.exports.getVersion = (
version = ['major', 'minor', 'patch'],
includeDots = true
) => {
const pkgVersion = require('../package.json').version

if (includeDots) return pkgVersion

/**
* Return the app major and minor without patch version.
*/
module.exports.versionMajorMinor = () => {
let version = this.getVersion()
const major = require('semver/functions/major')(version)
const minor = require('semver/functions/minor')(version)
if (!major || !minor) {
throw new Error('Major and minor could not be parsed!')
}
version = `${major}.${minor}`
return version
.map((v) => require(`semver/functions/${v}`)(pkgVersion))
.join('')
}

/**
Expand Down
4 changes: 2 additions & 2 deletions metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module.exports = {
siteTitleShort: 'M/D',
siteAuthor: `Marvin Heilemann`,
siteDescription: `Projects Marvin Heilemann has been working on now and in the past.`,
siteUrl: 'https://marvin.digital',
siteLanguage: 'en',
siteKeywords: [
'muuvmuuv',
'portfolio',
Expand All @@ -11,8 +13,6 @@ module.exports = {
'writings',
'photography',
],
siteUrl: process.env.SITE_URL,
siteLanguage: 'en',
menu: [
{
name: 'About',
Expand Down
18 changes: 5 additions & 13 deletions now.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
{
"version": 2,
"public": false,
"name": "portfolio",
"scope": "muuvmuuv",
"regions": [
"bru1"
],
"builds": [
{
"src": "package.json",
"use": "@now/static-build",
"config": {
"distDir": "public"
}
"public": false,
"build": {
"env": {
"RIOT_API_KEY": "@riot-api-key"
}
]
}
}
Loading

0 comments on commit 495bfee

Please sign in to comment.