Skip to content

Commit

Permalink
fix(load cache): only persist in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
estrattonbailey committed May 1, 2021
1 parent bb7ae3b commit 0d024c1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ prog
.example(`build files/**/*.js build`)
.example(`build -c ${CONFIG_DEFAULT}`)
.action(async (files, output, opts) => {
process.env.PRESTA_ENV = 'production'

registerRuntime()

console.clear()
Expand All @@ -72,6 +74,8 @@ prog
.example(`watch files/**/*.js build`)
.example(`watch -c ${CONFIG_DEFAULT}`)
.action(async (files, output, opts) => {
process.env.PRESTA_ENV = 'development'

registerRuntime()

console.clear()
Expand Down
5 changes: 4 additions & 1 deletion lib/loadCache.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
const fs = require('fs')
const path = require('path')

const PRESTA_ENV = process.env.PRESTA_ENV || 'production'

function write (filepath, json) {
fs.writeFileSync(filepath, JSON.stringify(json), 'utf-8')
if (PRESTA_ENV !== 'production')
fs.writeFileSync(filepath, JSON.stringify(json), 'utf-8')
}

function createCache (name, { dir = process.cwd() } = {}) {
Expand Down

0 comments on commit 0d024c1

Please sign in to comment.