Skip to content

Commit

Permalink
fix: mock-cloud create config dir and set NODE_ENV (#1649)
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip authored May 20, 2020
1 parent 6493e71 commit 4977449
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/xarc-app-dev/lib/dev-admin/cdn-mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const Url = require("url");
const Fs = require("fs");
const chokidar = require("chokidar");
const mime = require("mime");
const mkdirp = require("mkdirp");

const LOADED_ASSETS = {};

const cdnMock = {
Expand Down Expand Up @@ -45,6 +47,7 @@ const cdnMock = {
return acc;
}, {});

mkdirp.sync("config");
Fs.writeFileSync("config/assets.json", `${JSON.stringify(mockAssets, null, 2)}\n`);
},

Expand Down
7 changes: 5 additions & 2 deletions packages/xarc-app/arch-clap.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const Path = require("path");
const assert = require("assert");
const requireAt = require("require-at");
const archetype = require("./config/archetype");
const { updateEnv } = require("xclap");
const { displayFeatures } = require("./lib/features");
const optionalRequire = require("optional-require")(require);
// make sure that -dev app archetype is also installed.
Expand Down Expand Up @@ -773,9 +774,11 @@ Individual .babelrc files were generated for you in src/client and src/server

"mock-cloud": {
desc: `Run app locally like it's deployed to cloud with CDN mock and HTTPS proxy.
You must run clap build first and set env vars like HOST, PORT, NODE_ENV=production yourself.
options: [all options will be passed to node when starting your app server]`,
- You must run clap build first and set env vars like HOST, PORT yourself.
- NODE_ENV is set to 'production' if it's not set.
- options: [all options will be passed to node when starting your app server]`,
task(context) {
updateEnv({ NODE_ENV: "production" }, { override: false });
const mockTask = xclap.concurrent([
"dev-proxy --mock-cdn",
xclap.serial(
Expand Down

0 comments on commit 4977449

Please sign in to comment.