Skip to content
Snippets Groups Projects
Commit 23ba4093 authored by Jure's avatar Jure
Browse files

docs: update components README

parent 26c7b27b
No related branches found
No related tags found
No related merge requests found
......@@ -4,20 +4,51 @@
## Conventions
### Front end components
### Client components
Package layout
* `src/` contains ES6/JSX/SASS sources (pointed to by `pkg.esnext`)
* `dist/` contains ES5/CSS files in CommonJS module format (pointed to by `pkg.main`)
* `dist/esm/` contains ES5/CSS files in ES module format (pointed to by `pkg.module`)
* `src/` contains ES6/JSX/SASS sources (pointed to by `main`)
All modules forming part of the public API of the component should be exported from the index.js. Deep imports are discouraged (e.g. `package-name/some/file`).
### Backend components
The component's `index.js` should export e.g.:
```js
module.exports = {
client: {
components: [() => require('./LoginContainer')],
},
}
```
### Server components
Should specify a minimum required version of Node and have no transpiling.
The component's `index.js` should export e.g.:
```js
module.exports = {
server: () => app => require('./InkBackend')(app),
}
```
An instace of the Express.js server gets passed to the component as `app`.
### Model components
A model component's `index.js` should export e.g.:
```js
module.exports = {
typeDefs: require('./typeDefs'),
resolvers: require('./resolvers'),
modelName: 'Manuscript',
model: require('./manuscript'),
}
```
## Publishing
Be sure to switch to a separate branch for Lerna releases, as the master branch is protected from push, so your releases will fail.
Be sure to switch to a separate branch for Lerna releases (e.g. `release`), as the master branch is protected from push, so your releases will fail.
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment