...
 
Commits (3)
0 silly input [ 'clean' ]
1 silly flags { _: [ 'run' ],
1 silly flags 'reject-cycles': false,
1 silly flags rejectCycles: false,
1 silly flags parallel: true,
1 silly flags script: 'clean',
1 silly flags args: [] }
2 verbose rootPath /home/chris/workspace/wax-prosemirror
3 info version 2.11.0
4 silly existsSync /home/chris/workspace/wax-prosemirror/VERSION
5 error EPACKAGES Errored while collecting packages and package graph
6 error JSONError: Unexpected token } in JSON at position 646 while parsing near '...own": "^1.6.2", }, "devDependencie...' in wax-prosemirror-components/package.json
6 error at module.exports (/home/chris/workspace/wax-prosemirror/node_modules/parse-json/index.js:26:19)
6 error at parse (/home/chris/workspace/wax-prosemirror/node_modules/load-json-file/index.js:8:29)
6 error at Function.module.exports.sync.fp [as sync] (/home/chris/workspace/wax-prosemirror/node_modules/load-json-file/index.js:11:29)
6 error at Function.module.exports.sync (/home/chris/workspace/wax-prosemirror/node_modules/lerna/node_modules/read-pkg/index.js:40:25)
6 error at /home/chris/workspace/wax-prosemirror/node_modules/lerna/lib/PackageUtilities.js:138:47
6 error at Array.forEach (<anonymous>)
6 error at /home/chris/workspace/wax-prosemirror/node_modules/lerna/lib/PackageUtilities.js:132:86
6 error at Array.forEach (<anonymous>)
6 error at Function.getPackages (/home/chris/workspace/wax-prosemirror/node_modules/lerna/lib/PackageUtilities.js:131:22)
......@@ -46,7 +46,7 @@ export default class Application {
bootServices() {
const services = this.config.get("config.services");
services.forEach((plugin) => {
services.forEach(plugin => {
if (plugin.boot) {
plugin.boot();
}
......@@ -62,16 +62,23 @@ export default class Application {
return this.schema.getSchema();
}
resetApp() {
this.container = {};
this.config = {};
this.PmPlugins = {};
this.schema = {};
}
static create(config) {
/* Merge Core Config with User Config */
const appConfig = deepmerge({ config: defaultConfig }, config, {
customMerge: (key) => {
customMerge: key => {
if (key === "services") {
return (coreService, configService) => {
return coreService.concat(configService);
};
}
},
}
});
/*
......@@ -79,22 +86,28 @@ export default class Application {
*/
const container = new Container();
/*
Set base bindings for the App to work
*/
container.bind("PmPlugins").to(PmPlugins).inSingletonScope();
container
.bind("PmPlugins")
.to(PmPlugins)
.inSingletonScope();
container.bind("Wax").toFactory(() => new Application(container));
container.bind("config").toConstantValue(appConfig);
container.bind("Config").to(Config).inSingletonScope();
container
.bind("Config")
.to(Config)
.inSingletonScope();
/*
Start the App
*/
const app = container.get("Wax");
app.setConfig();
appConfig.config.PmPlugins.forEach((configPlugin) => {
appConfig.config.PmPlugins.forEach(configPlugin => {
app.PmPlugins.add(configPlugin.key, configPlugin);
});
app.registerServices();
......
......@@ -54,7 +54,9 @@ const Wax = props => {
const [application, setApplication] = useState();
useEffect(() => {
setApplication(createApplication(props));
const newApplication = createApplication(props);
setApplication(newApplication);
return () => newApplication.resetApp();
}, []);
const {
......
......@@ -53,6 +53,8 @@ export default props => {
);
if (debug) applyDevTools(view);
if (autoFocus) view.focus();
return () => view.destroy();
}, []);
const dispatchTransaction = transaction => {
......