Skip to content

Commit 5c3985f

Browse files
committed
Reactium v1.1.0: Break out major SDK features into Reactium plugins:
* @atomic-reactor/reactium-api@1.0.0 * @atomic-reactor/reactium-capability@1.0.0 * @atomic-reactor/reactium-role@1.0.0 * @atomic-reactor/reactium-user@1.0.1 * @atomic-reactor/reactium-setting@1.0.0 * @atomic-reactor/reactium-service-worker@1.0.0
1 parent ab71ed6 commit 5c3985f

File tree

26 files changed

+164
-4516
lines changed

26 files changed

+164
-4516
lines changed

.core/app/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ export const App = async () => {
3030

3131
await deps().loadAll('allHooks');
3232

33+
Reactium.Hook.runSync('sdk-init', Reactium);
34+
await Reactium.Hook.run('sdk-init', Reactium);
35+
3336
const hookableComponent = name => props => {
3437
const Component = useHookComponent(name);
3538
return <Component {...props} />;
@@ -56,8 +59,6 @@ export const App = async () => {
5659
*/
5760
await Reactium.Hook.run('dependencies-load');
5861

59-
Reactium.ServiceWorker.init();
60-
6162
/**
6263
* @api {Hook} zone-defaults zone-defaults
6364
* @apiName zone-defaults

.core/index.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,22 @@ const globals = async () => {
109109
global.LOG = global.BOOT;
110110
};
111111

112+
const reactiumBootHooks = async () => {
113+
// include boot DDD artifacts
114+
globby([
115+
`${rootPath}/.core/**/reactium-boot.js`,
116+
`${rootPath}/src/**/reactium-boot.js`,
117+
`${rootPath}/reactium_modules/**/reactium-boot.js`,
118+
`${rootPath}/node_modules/**/reactium-plugin/**/reactium-boot.js`,
119+
]).map(item => {
120+
const p = path.normalize(item);
121+
require(p);
122+
});
123+
124+
ReactiumBoot.Hook.runSync('sdk-init', ReactiumBoot);
125+
await ReactiumBoot.Hook.run('sdk-init', ReactiumBoot);
126+
};
127+
112128
global.rootPath = path.resolve(__dirname, '..');
113129

114130
const ssrStartup = async () => {
@@ -168,11 +184,13 @@ const ssrStartup = async () => {
168184
};
169185

170186
const apiConfig = async () => {
171-
const apiConfig = ReactiumBoot.API.ActiniumConfig;
187+
if (ReactiumBoot.API && ReactiumBoot.API.ActiniumConfig) {
188+
const apiConfig = ReactiumBoot.API.ActiniumConfig;
172189

173-
global.parseAppId = apiConfig.parseAppId;
174-
global.actiniumAppId = apiConfig.actiniumAppId;
175-
global.restAPI = apiConfig.restAPI;
190+
global.parseAppId = apiConfig.parseAppId;
191+
global.actiniumAppId = apiConfig.actiniumAppId;
192+
global.restAPI = apiConfig.restAPI;
193+
}
176194

177195
global.app = express();
178196
};
@@ -195,7 +213,7 @@ const registeredMiddleware = async () => {
195213
order: Enums.priority.highest,
196214
});
197215

198-
if (restAPI && process.env.PROXY_ACTINIUM_API !== 'off') {
216+
if (global.restAPI && process.env.PROXY_ACTINIUM_API !== 'off') {
199217
ReactiumBoot.Server.Middleware.register('api', {
200218
name: 'api',
201219
use: proxy('/api', {
@@ -211,7 +229,7 @@ const registeredMiddleware = async () => {
211229
});
212230
}
213231

214-
if (restAPI && process.env.PROXY_ACTINIUM_API !== 'off') {
232+
if (global.restAPI && process.env.PROXY_ACTINIUM_API !== 'off') {
215233
ReactiumBoot.Server.Middleware.register('api-socket-io', {
216234
name: 'api-socket-io',
217235
use: proxy('/actinium.io', {
@@ -354,17 +372,6 @@ const registeredDevMiddleware = () => {
354372
// set app variables
355373
app.set('x-powered-by', false);
356374

357-
// include boot DDD artifacts
358-
globby([
359-
`${rootPath}/.core/**/reactium-boot.js`,
360-
`${rootPath}/src/**/reactium-boot.js`,
361-
`${rootPath}/reactium_modules/**/reactium-boot.js`,
362-
`${rootPath}/node_modules/**/reactium-plugin/**/reactium-boot.js`,
363-
]).map(item => {
364-
const p = path.normalize(item);
365-
require(p);
366-
});
367-
368375
// development mode
369376
if (process.env.NODE_ENV === 'development') {
370377
const webpack = require('webpack');
@@ -508,6 +515,7 @@ const bootup = async () => {
508515
const logger = console;
509516
try {
510517
await globals();
518+
await reactiumBootHooks();
511519
await ssrStartup();
512520
await apiConfig();
513521
await startServer();

.core/reactium-config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const globby = require('./globby-patch');
44
const rootPath = path.resolve(__dirname, '..');
55
const gulpConfig = require('./gulp.config');
66

7-
const version = '4.0.1';
7+
const version = '4.1.0';
88

99
const defaultLibraryExternals = {
1010
axios: {

.core/sdk/api/actinium/config.js

Lines changed: 0 additions & 42 deletions
This file was deleted.

.core/sdk/api/actinium/index.js

Lines changed: 0 additions & 67 deletions
This file was deleted.

.core/sdk/api/index.js

Lines changed: 0 additions & 58 deletions
This file was deleted.

0 commit comments

Comments
 (0)