-
Notifications
You must be signed in to change notification settings - Fork 1
Improve integration interface #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mechanoid
wants to merge
24
commits into
complate:master
Choose a base branch
from
mechanoid:improve-integration-interface
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
84c0bbf
remove complate-jsx as dependency
9e8378e
add npm5 package-lock file
9d09c77
change express integration interface
68dd433
add example express application for integration testing
ba2c92c
add default-layout and fix bundling
0ba7ed4
add missing linting dependency
7028b97
remove debug code
fde9a6f
rename param say what input is expected.
ab59b7c
remove package-lock for lib
cdc75b9
change render API to `complate` to not override standard functions
81080a8
ignore core lib package-lock file
cba1472
simplify dev dependencies
70e24d3
fix faucet configuration
8b37b08
refresh the given renderer in dev-env
8d1ee0c
remove fnd-specific trolling
93b8dc7
fix cache override
20358f7
add minimal README
0e803cd
fix eslint config for example project
54bc163
fix missing options interface
8c7f4bc
simplify rendererPath interface
d6ad4d9
wording
229fe52
rename rendererPath to bundlePath for reasons
fe339b5
remove redundant cache config
29bfce8
merged in build pipeline update
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| /node_modules | ||
| /.eslintcache | ||
| /example/dist | ||
| /package-lock.json | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # complate-express | ||
|
|
||
| Server-side rendered component based template-engine for express. | ||
|
|
||
| This library is based on [complate-stream](https://github.com/complate/complate-stream). | ||
|
|
||
| ## Quick Start Guide | ||
|
|
||
| Install complate-express in your express application | ||
|
|
||
| ``` | ||
| npm install complate-express | ||
| ``` | ||
|
|
||
| ``` | ||
| const express = require('express') | ||
| const complate = require('complate-express') | ||
|
|
||
| const app = express(); | ||
|
|
||
| // add complate middleware | ||
| app.use(complate('PATH_TO_COMPLATE_RENDERER_BUNDLE')) | ||
|
|
||
|
|
||
| app.get('/', (req, res) => { | ||
| // after adding the middleware, `res.complate` is available for rendering | ||
| res.complate('my-component', { config }) | ||
| }) | ||
| ``` | ||
|
|
||
| ## API | ||
|
|
||
| #### complate(bundlePath: String, options: Object) | ||
|
|
||
| **@param bundlePath**: is a path to the complate renderer Module. | ||
| The module will not be cached if `app.enabled("view cache")` is false, like it is in dev-mode. | ||
|
|
||
| **@param options**: `{ cache = false }` | ||
|
|
||
| Options: | ||
|
|
||
| - cache: forces the given bundle to be cached if set to `true` (otherwise `app.enabled('view cache')` kicks in) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| extends: | ||
| - fnd | ||
| - plugin:react/recommended | ||
| plugins: | ||
| - react | ||
| settings: | ||
| react: | ||
| pragma: createElement |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| const config = { | ||
| targetDir: "dist", | ||
| manifest: false, | ||
| bundles: [{ | ||
| entryPoint: "./views/bundle.js", | ||
| target: "bundle.js", | ||
| format: "cjs", | ||
| moduleName: "render", | ||
| transpiler: { | ||
| features: ["es2015", "jsx"], | ||
| jsx: { | ||
| "pragma": "createElement" | ||
| } | ||
| } | ||
| }] | ||
| }; | ||
|
|
||
| module.exports = { | ||
| js: config | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| "use strict"; | ||
| const path = require("path"); | ||
| const express = require("express"); | ||
| const complate = require("complate-express"); | ||
|
|
||
| const app = express(); | ||
|
|
||
| // view cache is set by default to true in production | ||
| // app.set('view cache', true) | ||
|
|
||
| // just hand in the complate middleware, to register the complate | ||
| // rendering function. In dev-env the bundle is not cached, so that | ||
| // it can be updated between incoming requests. | ||
| app.use(complate(path.resolve(__dirname, "dist", "bundle.js"))); | ||
|
|
||
| app.get("/", (req, res) => { | ||
| return res.complate("site-index", { title: "Hello World!" }); | ||
| }); | ||
|
|
||
| app.listen(5000); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... and yet you included
example/dist/bundle.js- I assume that's unintentional?Ah, I just noticed ba2c92c removes that file again - I wouldn't want to see it in the history at all though. (Don't worry about it for now; I'll probably rewrite some history anyway before merging this.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly, and ok, i'm not that fan of rewriting the hist, but sure.