Skip to content

Commit

Permalink
feat(deploy): Venia can be built and deployed separately (magento#498)
Browse files Browse the repository at this point in the history
- Change all Venia devDependencies to dependencies, so it can be build
from node_modules with only "production deps"
- Add a "venia" CLI to the package which builds and launches a server

This change enables a downstream user to create a package which launches
Venia as simple as this:

```sh
$ npm install -g @magento/venia-concept
$ NODE_ENV=production venia build
$ NODE_ENV=production MAGENTO_BACKEND_URL=https://magento.internal venia start
```

This enables a deployment that does not require cloning, hoisting, and
building the entire pwa-studio repository.
  • Loading branch information
zetlen authored Nov 13, 2018
1 parent c4315be commit 9b7c467
Show file tree
Hide file tree
Showing 3 changed files with 17,111 additions and 822 deletions.
23 changes: 23 additions & 0 deletions packages/venia-concept/bin/venia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env node

const execa = require('execa');

const cwd = require('path').resolve('../', __dirname);

function npmRun(cmd) {
execa.shell(`npm run -s ${cmd}`, {
cwd,
stdio: 'inherit',
buffer: false
});
}

const commands = ['build', 'start'];
const command = process.argv.pop();
if (!commands.includes(command)) {
console.error(
`Unrecognized command or flag '${command}'. Run 'venia start' to start, or 'venia build' to build.`
);
}

npmRun(command);
Loading

0 comments on commit 9b7c467

Please sign in to comment.