Skip to content

Commit 49ed111

Browse files
authored
Merge pull request #1 from ara-framework/develop
Latest changes
2 parents 1ec9ea4 + 01dbc68 commit 49ed111

13 files changed

Lines changed: 318 additions & 22 deletions

File tree

.eslintrc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"extends": [
33
"airbnb-base"
4-
]
4+
],
5+
"rules": {
6+
"no-console": 0
7+
}
58
}

.gitignore

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,6 @@ lib
3232
npm-shrinkwrap.json
3333
yarn.lock
3434
package-lock.json
35-
© 2019 GitHub, Inc.
36-
Terms
37-
Privacy
38-
Security
39-
Status
40-
Help
41-
Contact GitHub
42-
Pricing
43-
API
44-
Training
45-
Blog
46-
About
35+
36+
# Ara bins
37+
.ara

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can install the package from npm.
1010
npm i -g ara-cli
1111
```
1212

13-
##Usage
13+
## Usage
1414

1515
### Create Ara Project
1616

@@ -21,11 +21,58 @@ ara new:project ara-demo
2121
### Create Nova Microfrontend
2222

2323
```bash
24-
ara new:nova
24+
ara new:nova <project-folder>
2525
```
2626

27-
By default the scaffolding for nova uses a Vue.js template but you can use more passing the flah `-t, --template`
27+
By default the scaffolding for nova uses a Vue.js template but you can use more passing the flag `-t, --template`
28+
29+
Supported templates:
30+
- vue
31+
- angular
32+
- svelte
33+
- preact
34+
- hyperapp
2835

2936
```bash
30-
ara new:nova -t angular
37+
ara new:nova -t angular <nova-folder>
38+
```
39+
40+
### Run Hypernova (Nova) Lambda locally
41+
42+
Run command:
43+
44+
```shell
45+
ara run:lambda
46+
```
47+
48+
Serve the client script locally using an S3 local server:
49+
50+
```shell
51+
ara run:lambda --asset
52+
```
53+
54+
### Run Nova Proxy
55+
56+
Nova Proxy needs a configuration file:
57+
58+
```json
59+
{
60+
"locations": [
61+
{
62+
"path": "/",
63+
"host": "http://localhost:8000",
64+
"modifyResponse": true
65+
}
66+
]
67+
}
68+
69+
Before to run the command we need to set the `HYPERNOVA_BATCH` variable using the Nova service endpoint.
70+
71+
```shell
72+
export HYPERNOVA_BATCH=http://localhost:3000/batch
73+
```
74+
75+
The command uses a configuration file named `nova-proxy.json` in the folder where the command is running, otherwise you need to pass the `--config` parameter with a different path.
76+
```
77+
ara run:proxy --config ./nova-proxy.json
3178
```

package.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ara-cli",
3-
"version": "0.1.0",
3+
"version": "1.0.0-alpha.1",
44
"description": "Ara Framework Command Line Interface",
55
"keywords": [
66
"ara",
@@ -21,10 +21,17 @@
2121
"lint": "eslint ."
2222
},
2323
"dependencies": {
24+
"aws-sdk": "^2.509.0",
2425
"cac": "^6.5.2",
2526
"chalk": "^2.4.2",
27+
"download": "^7.1.0",
28+
"execa": "^2.0.4",
2629
"majo": "^0.7.1",
27-
"sao": "^1.6.1"
30+
"ora": "^3.4.0",
31+
"s3rver": "^3.3.0",
32+
"sao": "^1.6.1",
33+
"serverless-offline": "^5.10.1",
34+
"webpack": "^4.39.2"
2835
},
2936
"devDependencies": {
3037
"eslint": "^5.16.0",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM marconi1992/nova-cluster:1.1.0
2+
3+
COPY views.json views.json
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM marconi1992/hypernova-proxy:1.0.2
2+
3+
COPY config.json config.json
4+
5+
ENV CONFIG_FILE=config.json
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"locations": []
3+
}

src/generators/project/template/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/index.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/usr/bin/env node
22
const cli = require('cac')();
3-
4-
const path = require('path');
53
const sao = require('sao');
4+
const path = require('path');
65

76
const generateProject = require('./generators/project');
7+
const runLambda = require('./run/lambda');
8+
const serveAsset = require('./run/asset');
9+
const runProxy = require('./run/proxy');
810

911
cli.command('new:project <outDir>', 'New Project')
1012
.action(outDir => generateProject(outDir));
@@ -15,11 +17,32 @@ cli.command('new:nova <outDir>', 'New Micro-Frontend')
1517
const appPath = path.join(process.cwd(), outDir);
1618
const options = {
1719
outDir: appPath,
20+
update: true,
1821
generator: `ara-framework/create-hypernova-${template}`,
1922
};
2023

2124
return sao(options)
2225
.run();
2326
});
2427

28+
cli.command('run:lambda', 'Run Hypernova lambda function')
29+
.option('-h, --handler <handler>', 'Template Type.')
30+
.option('--asset', 'Serves client-side entry point.')
31+
.action(({ handler = 'handler', asset }) => {
32+
const webpackfile = path.join(process.cwd(), 'webpack.config.js');
33+
let webpackConf = require(webpackfile);// eslint-disable-line
34+
35+
webpackConf = Array.isArray(webpackConf) ? webpackConf : [webpackConf];
36+
37+
runLambda(handler, webpackConf);
38+
39+
if (asset) {
40+
serveAsset(webpackConf);
41+
}
42+
});
43+
44+
cli.command('run:proxy', 'Run Nova Proxy')
45+
.option('--config [config]', 'Configuration file')
46+
.action(({ config = './nova-proxy.json' }) => runProxy(config, path.join(__dirname, '../.ara')));
47+
2548
cli.parse();

0 commit comments

Comments
 (0)