diff --git a/config/webpack.dev.config.js b/config/webpack.dev.config.js index 9cfd18741..d0717c1b0 100644 --- a/config/webpack.dev.config.js +++ b/config/webpack.dev.config.js @@ -87,7 +87,7 @@ module.exports = { ], resolve: { alias: { - payload: path.resolve(__dirname, '../src'), + payload: path.resolve(__dirname, '../'), local: path.resolve(__dirname, '../demo') } } diff --git a/demo/client/index.js b/demo/client/index.js index cc5e7495c..79c35b584 100644 --- a/demo/client/index.js +++ b/demo/client/index.js @@ -1,16 +1,21 @@ import React from 'react'; import { render } from 'react-dom'; -import App from 'payload/client/components/App'; +import { Test, Test2 } from 'payload'; -import Routes from './Routes'; -import store from './store'; +// import App from 'payload/client/components/App'; + +// import Routes from './Routes'; +// import store from './store'; + +console.log(Test); const Index = () => { return ( - - - + + + + ); }; diff --git a/index.js b/index.js index a0ea870d9..138a7bb08 100644 --- a/index.js +++ b/index.js @@ -1,41 +1 @@ -const path = require('path'); -const Collection = require('./Collection'); - -class Payload { - constructor(options) { - this.express = options.express; - this.mongoose = options.mongoose; - this.baseURL = options.baseURL; - - this.views = path.join(__dirname, 'views'); - - this.collections = {}; - - this.express.get('/payload/admin', (req, res) => { - res.render('admin', - { - title: 'Payload Admin' - }); - }); - } - - newCollection(key) { - if (key in this.collections) { - // TODO: Have discussion about how errors should be handled - return new Error(`${key} already exists in collections`); - } - - return new Collection(this, key); - } - - getCollection(key) { - if (!(key in this.collections)) { - // TODO: Have discussion about how errors should be handled - return new Error(`${key} does not exist or has not been registered yet`); - } - - return this.collections[key]; - } -} - -module.exports = Payload; +export * from './src/client/Components'; diff --git a/src/client/components/Test.js b/src/client/components/Test.js new file mode 100644 index 000000000..7367d13cb --- /dev/null +++ b/src/client/components/Test.js @@ -0,0 +1,9 @@ +import React from 'react'; + +const Test = () => { + return ( +

Test

+ ); +}; + +export default Test; diff --git a/src/client/components/Test2.js b/src/client/components/Test2.js new file mode 100644 index 000000000..bb7fed62a --- /dev/null +++ b/src/client/components/Test2.js @@ -0,0 +1,7 @@ +import React from 'react'; + +export default () => { + return ( +

Test2

+ ); +}; diff --git a/src/client/components/index.js b/src/client/components/index.js new file mode 100644 index 000000000..68b184e91 --- /dev/null +++ b/src/client/components/index.js @@ -0,0 +1,7 @@ +import Test from './Test'; +import Test2 from './Test2'; + +export { + Test, + Test2 +};