Skip to content

Commit

Permalink
Feature/Cloud entry (#876)
Browse files Browse the repository at this point in the history
* Implement cloud build configuration and entry point in run.js for origin examples
* Fix package.json on examples
  • Loading branch information
IhostVlad authored Nov 21, 2018
1 parent a54b03c commit e37e7b4
Show file tree
Hide file tree
Showing 23 changed files with 325 additions and 8 deletions.
30 changes: 30 additions & 0 deletions examples/hacker-news/config.cloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { declareRuntimeEnv } from 'resolve-scripts'

export default {
target: 'cloud',
mode: 'production',
staticPath: declareRuntimeEnv('CLOUD_STATIC_URL'),
subscribeAdapter: {
module: 'resolve-subscribe-mqtt',
options: {}
},
storageAdapter: {
module: 'resolve-storage-dynamo',
options: {
tableName: declareRuntimeEnv('DYNAMODB_TABLE_NAME'),
skipInit: true
}
},
readModelAdapters: [
{
name: 'default',
module: 'resolve-readmodel-mysql',
options: {
host: declareRuntimeEnv('SQL_HOST'),
database: declareRuntimeEnv('SQL_DATABASE'),
user: declareRuntimeEnv('SQL_USER'),
password: declareRuntimeEnv('SQL_PASSWORD')
}
}
]
}
5 changes: 5 additions & 0 deletions examples/hacker-news/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"build": "babel-node ./run.js build",
"cloud": "babel-node ./run.js cloud",
"start": "babel-node ./run.js start",
"dev": "babel-node ./run.js dev",
"import": "babel-node ./import",
Expand Down Expand Up @@ -40,8 +41,12 @@
"resolve-es": "0.17.4",
"resolve-redux": "0.17.4",
"resolve-scripts": "0.17.4",
"resolve-storage-dynamo": "0.17.4",
"resolve-storage-lite": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-readmodel-mysql": "0.17.4",
"resolve-subscribe-mqtt": "0.17.4",
"resolve-subscribe-socket.io": "0.17.4",
"resolve-module-comments": "0.17.4",
"resolve-module-auth": "0.17.4",
"sanitizer": "0.1.3",
Expand Down
14 changes: 14 additions & 0 deletions examples/hacker-news/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import resolveModuleComments from 'resolve-module-comments'
import resolveModuleAuth from 'resolve-module-auth'

import appConfig from './config.app'
import cloudConfig from './config.cloud'
import devConfig from './config.dev'
import prodConfig from './config.prod'
import testFunctionalConfig from './config.test-functional'
Expand Down Expand Up @@ -70,6 +71,19 @@ void (async () => {
break
}

case 'cloud': {
await build(
merge(
defaultResolveConfig,
appConfig,
cloudConfig,
moduleComments,
moduleAuth
)
)
break
}

case 'start': {
await start(
merge(
Expand Down
30 changes: 30 additions & 0 deletions examples/hello-world/config.cloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { declareRuntimeEnv } from 'resolve-scripts'

export default {
target: 'cloud',
mode: 'production',
staticPath: declareRuntimeEnv('CLOUD_STATIC_URL'),
subscribeAdapter: {
module: 'resolve-subscribe-mqtt',
options: {}
},
storageAdapter: {
module: 'resolve-storage-dynamo',
options: {
tableName: declareRuntimeEnv('DYNAMODB_TABLE_NAME'),
skipInit: true
}
},
readModelAdapters: [
{
name: 'default',
module: 'resolve-readmodel-mysql',
options: {
host: declareRuntimeEnv('SQL_HOST'),
database: declareRuntimeEnv('SQL_DATABASE'),
user: declareRuntimeEnv('SQL_USER'),
password: declareRuntimeEnv('SQL_PASSWORD')
}
}
]
}
9 changes: 8 additions & 1 deletion examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"build": "babel-node ./run.js build",
"cloud": "babel-node ./run.js cloud",
"dev": "babel-node ./run.js dev",
"start": "babel-node ./run.js start",
"test": "jest --testMatch=**/test/unit/*.test.js --verbose",
Expand All @@ -18,9 +19,15 @@
"react-dom": "16.6.0",
"react-helmet": "5.2.0",
"redux": "4.0.0",
"resolve-bus-memory": "0.17.4",
"resolve-redux": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-scripts": "0.17.4",
"resolve-storage-dynamo": "0.17.4",
"resolve-storage-lite": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-readmodel-mysql": "0.17.4",
"resolve-subscribe-mqtt": "0.17.4",
"resolve-subscribe-socket.io": "0.17.4",
"redux-devtools-extension": "2.13.5"
},
"devDependencies": {
Expand Down
6 changes: 6 additions & 0 deletions examples/hello-world/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'resolve-scripts'

import appConfig from './config.app'
import cloudConfig from './config.cloud'
import devConfig from './config.dev'
import prodConfig from './config.prod'
import testFunctionalConfig from './config.test_functional'
Expand All @@ -26,6 +27,11 @@ void (async () => {
break
}

case 'cloud': {
await build(merge(defaultResolveConfig, appConfig, cloudConfig))
break
}

case 'start': {
await start(merge(defaultResolveConfig, appConfig, prodConfig))
break
Expand Down
30 changes: 30 additions & 0 deletions examples/shopping-list-advanced/config.cloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { declareRuntimeEnv } from 'resolve-scripts'

export default {
target: 'cloud',
mode: 'production',
staticPath: declareRuntimeEnv('CLOUD_STATIC_URL'),
subscribeAdapter: {
module: 'resolve-subscribe-mqtt',
options: {}
},
storageAdapter: {
module: 'resolve-storage-dynamo',
options: {
tableName: declareRuntimeEnv('DYNAMODB_TABLE_NAME'),
skipInit: true
}
},
readModelAdapters: [
{
name: 'default',
module: 'resolve-readmodel-mysql',
options: {
host: declareRuntimeEnv('SQL_HOST'),
database: declareRuntimeEnv('SQL_DATABASE'),
user: declareRuntimeEnv('SQL_USER'),
password: declareRuntimeEnv('SQL_PASSWORD')
}
}
]
}
12 changes: 9 additions & 3 deletions examples/shopping-list-advanced/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"build": "babel-node ./run.js build",
"dev": "babel-node ./run.js dev",
"cloud": "babel-node ./run.js cloud",
"start": "babel-node ./run.js start",
"start:native": "cd native && npm run start",
"test": "npm run test:domain && npm run test:web && npm run test:native",
Expand All @@ -19,11 +20,16 @@
"deepmerge": "2.2.1",
"redux": "4.0.0",
"react": "16.6.0",
"resolve-module-auth": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-bus-memory": "0.17.4",
"resolve-redux": "0.17.4",
"resolve-scripts": "0.17.4",
"resolve-subscribe-socket.io": "0.17.4"
"resolve-storage-dynamo": "0.17.4",
"resolve-storage-lite": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-readmodel-mysql": "0.17.4",
"resolve-subscribe-mqtt": "0.17.4",
"resolve-subscribe-socket.io": "0.17.4",
"resolve-module-auth": "0.17.4"
},
"devDependencies": {
"@babel/core": "7.0.0",
Expand Down
9 changes: 9 additions & 0 deletions examples/shopping-list-advanced/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import createAuthModule from 'resolve-module-auth'

import devConfig from './config.dev'
import cloudConfig from './config.cloud'
import prodConfig from './config.prod'
import testFunctionalConfig from './config.test_functional'
import adjustWebpackConfigs from './config.adjust_webpack'
Expand Down Expand Up @@ -58,6 +59,14 @@ void (async () => {
break
}

case 'cloud': {
await build(
merge(defaultResolveConfig, appConfig, cloudConfig, authModule),
adjustWebpackConfigs.bind(null, authModule)
)
break
}

case 'start': {
await start(
merge(defaultResolveConfig, appConfig, prodConfig, authModule)
Expand Down
30 changes: 30 additions & 0 deletions examples/shopping-list/config.cloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { declareRuntimeEnv } from 'resolve-scripts'

export default {
target: 'cloud',
mode: 'production',
staticPath: declareRuntimeEnv('CLOUD_STATIC_URL'),
subscribeAdapter: {
module: 'resolve-subscribe-mqtt',
options: {}
},
storageAdapter: {
module: 'resolve-storage-dynamo',
options: {
tableName: declareRuntimeEnv('DYNAMODB_TABLE_NAME'),
skipInit: true
}
},
readModelAdapters: [
{
name: 'default',
module: 'resolve-readmodel-mysql',
options: {
host: declareRuntimeEnv('SQL_HOST'),
database: declareRuntimeEnv('SQL_DATABASE'),
user: declareRuntimeEnv('SQL_USER'),
password: declareRuntimeEnv('SQL_PASSWORD')
}
}
]
}
9 changes: 8 additions & 1 deletion examples/shopping-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"build": "babel-node ./run.js build",
"cloud": "babel-node ./run.js cloud",
"dev": "babel-node ./run.js dev",
"start": "babel-node ./run.js start",
"test": "jest --testMatch=**/test/unit/*.test.js --verbose",
Expand All @@ -22,9 +23,15 @@
"react-router": "4.3.1",
"react-router-dom": "4.3.1",
"redux": "4.0.0",
"resolve-bus-memory": "0.17.4",
"resolve-redux": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-scripts": "0.17.4",
"resolve-storage-dynamo": "0.17.4",
"resolve-storage-lite": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-readmodel-mysql": "0.17.4",
"resolve-subscribe-mqtt": "0.17.4",
"resolve-subscribe-socket.io": "0.17.4",
"react-router-redux": "5.0.0-alpha.9",
"redux-devtools-extension": "2.13.5",
"uuid": "3.3.2"
Expand Down
6 changes: 6 additions & 0 deletions examples/shopping-list/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'resolve-scripts'

import appConfig from './config.app'
import cloudConfig from './config.cloud'
import devConfig from './config.dev'
import prodConfig from './config.prod'
import testFunctionalConfig from './config.test_functional'
Expand All @@ -26,6 +27,11 @@ void (async () => {
break
}

case 'cloud': {
await build(merge(defaultResolveConfig, appConfig, cloudConfig))
break
}

case 'start': {
await start(merge(defaultResolveConfig, appConfig, prodConfig))
break
Expand Down
30 changes: 30 additions & 0 deletions examples/with-postcss/config.cloud.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { declareRuntimeEnv } from 'resolve-scripts'

export default {
target: 'cloud',
mode: 'production',
staticPath: declareRuntimeEnv('CLOUD_STATIC_URL'),
subscribeAdapter: {
module: 'resolve-subscribe-mqtt',
options: {}
},
storageAdapter: {
module: 'resolve-storage-dynamo',
options: {
tableName: declareRuntimeEnv('DYNAMODB_TABLE_NAME'),
skipInit: true
}
},
readModelAdapters: [
{
name: 'default',
module: 'resolve-readmodel-mysql',
options: {
host: declareRuntimeEnv('SQL_HOST'),
database: declareRuntimeEnv('SQL_DATABASE'),
user: declareRuntimeEnv('SQL_USER'),
password: declareRuntimeEnv('SQL_PASSWORD')
}
}
]
}
9 changes: 8 additions & 1 deletion examples/with-postcss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"build": "babel-node ./run.js build",
"cloud": "babel-node ./run.js cloud",
"dev": "babel-node ./run.js dev",
"start": "babel-node ./run.js start",
"test": "jest --testMatch=**/test/unit/*.test.js --verbose",
Expand All @@ -18,9 +19,15 @@
"react-dom": "16.6.0",
"react-helmet": "5.2.0",
"redux": "4.0.0",
"resolve-readmodel-memory": "0.17.4",
"resolve-bus-memory": "0.17.4",
"resolve-redux": "0.17.4",
"resolve-scripts": "0.17.4",
"resolve-storage-dynamo": "0.17.4",
"resolve-storage-lite": "0.17.4",
"resolve-readmodel-memory": "0.17.4",
"resolve-readmodel-mysql": "0.17.4",
"resolve-subscribe-mqtt": "0.17.4",
"resolve-subscribe-socket.io": "0.17.4",
"redux-devtools-extension": "2.13.5"
},
"devDependencies": {
Expand Down
9 changes: 9 additions & 0 deletions examples/with-postcss/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from 'resolve-scripts'

import appConfig from './config.app'
import cloudConfig from './config.cloud'
import devConfig from './config.dev'
import prodConfig from './config.prod'
import testFunctionalConfig from './config.test_functional'
Expand All @@ -33,6 +34,14 @@ void (async () => {
break
}

case 'cloud': {
await build(
merge(defaultResolveConfig, appConfig, cloudConfig),
adjustWebpackConfigs
)
break
}

case 'start': {
await start(merge(defaultResolveConfig, appConfig, prodConfig))
break
Expand Down
Loading

0 comments on commit e37e7b4

Please sign in to comment.