diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..8687b62fd
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,22 @@
+language: node_js
+node_js:
+ - "8"
+
+os:
+ - linux
+
+deploy:
+ provider: pages
+ skip-cleanup: true
+ github-token: $GITHUB_TOKEN
+ keep-history: true
+ on:
+ branch: gh-pages
+ script:
+ - /bin/bash ./update-readmes.sh
+ - /bin/bash ./update-community-readmes.sh
+ - /bin/bash ./update-v4-readmes.sh
+ - npm test
+ email: slnode@ca.ibm.com
+ name: StrongLoop Bot
+
diff --git a/Gemfile b/Gemfile
index d96a2e8a7..5a32a9c7e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -4,3 +4,4 @@ gem 'rouge'
gem 'github-pages'
gem 'jekyll'
gem 'jekyll-redirect-from'
+gem 'jekyll-relative-links'
diff --git a/Gemfile.lock b/Gemfile.lock
index 77d7b6391..0aa435572 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -217,7 +217,8 @@ DEPENDENCIES
github-pages
jekyll
jekyll-redirect-from
+ jekyll-relative-links
rouge
BUNDLED WITH
- 1.15.1
+ 1.16.0
diff --git a/Jenkinsfile b/Jenkinsfile
deleted file mode 100644
index 08780e5fa..000000000
--- a/Jenkinsfile
+++ /dev/null
@@ -1,43 +0,0 @@
-#!groovy
-
-def gitEnv = [
- 'GIT_COMMITTER_NAME=StrongLoop Bot',
- 'GIT_COMMITTER_EMAIL=slnode@ca.ibm.com',
- 'GIT_AUTHOR_NAME=StrongLoop Bot',
- 'GIT_AUTHOR_EMAIL=slnode@ca.ibm.com',
-]
-
-env.CHANGE_BRANCH = env.CHANGE_BRANCH ?: env.BRANCH_NAME
-
-node('linux && git') {
- stage('checkout') {
- checkout scm
- }
- stage('download updates') {
- sh './update-readmes.sh'
- sh './update-v4-readmes.sh'
- sh './update-community-readmes.sh'
- }
- stage('check updates') {
- sh 'git status'
- }
- stage('commit updates') {
- if (sh(returnStatus: true, script: 'git diff --quiet') != 0) {
- echo "Updates found, committing and pushing back up to github..."
- // this will add new files if the readme list grows, but removing
- // existing files will have to be done by a human for now.
- sh 'git add pages/en/lb2/readmes'
- sh 'git add pages/en/lb3/readmes'
- sh 'git add pages/en/lb4/readmes'
- sh 'git add pages/en/community/readmes'
- withEnv(gitEnv) {
- sh 'git commit -m "Update READMEs from other repos"'
- }
- sshagent(credentials: ['loopback-io-deploy']) {
- sh 'git push origin HEAD:$CHANGE_BRANCH'
- }
- } else {
- echo "No updates to commit"
- }
- }
-}
diff --git a/README.md b/README.md
index 0a9c410d8..5696bc8bc 100644
--- a/README.md
+++ b/README.md
@@ -70,6 +70,17 @@ summary: A brief tutorial on creating an Angular client app using the Loopback A
{% include readmes/loopback-example-angular.md %}
```
+## Incorporating updates from loopback-next
+
+We use a node script `update-lb4-docs` to copy over contents from loopback-next
+repository using `@loopback/docs` package. The script is responsible for copying
+over the markdown documentation and related tables, as well as the sidebar used
+for LoopBack 4 content. The changes are then picked up as part of Travis CI's
+builds along with README update scripts and deployed to GitHub Pages once
+successful. The `upgrade-swagger-ui.js` script is also run as part of the
+builds. If you'd like to make documentation changes for LoopBack 4, please do so
+on its own [repository](https://github.com/strongloop/loopback-next/).
+
### Linting Readmes
There is an additional `npm script` that "lints" the readmes for markdown formatting problems. It is currently "experimental", see [this issue](https://github.com/strongloop/loopback.io/issues/49#issuecomment-253672668) for more info.
diff --git a/_config.yml b/_config.yml
index fcac376d2..3f411cc14 100644
--- a/_config.yml
+++ b/_config.yml
@@ -8,6 +8,7 @@ whitelist:
plugins:
- jekyll-redirect-from
+ - jekyll-relative-links
topnav_title: LoopBack
# this appears on the top navigation bar next to the home button
@@ -21,6 +22,8 @@ company_name: IBM / StrongLoop
github_editme_path: strongloop/loopback.io/blob/gh-pages/pages
# if you're using Github, provide the basepath to the branch you've created for reviews, following the sample here. if not, leave this value blank.
+lb4_editme_path: strongloop/loopback-next/blob/master/docs/site
+
google_analytics: UA-102515604-1
disqus_shortname:
@@ -38,6 +41,7 @@ exclude:
- node_modules
- Jenkinsfile
- update-readmes.sh
+ - update-v4-readmes.sh
# these are the files and directories that jekyll will exclude from the build
feedback_email: rmckinn@us.ibm.com
diff --git a/_includes/content/lb4-artifact-commands.html b/_includes/content/lb4-artifact-commands.html
deleted file mode 100644
index 9ddd9ecfb..000000000
--- a/_includes/content/lb4-artifact-commands.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
- | Commands |
- Description |
- See |
-
-
-
-lb4 controller
- | Add a new controller to a LoopBack 4 application
- | Controller generator
- |
-
-
diff --git a/_includes/content/lb4-project-commands.html b/_includes/content/lb4-project-commands.html
deleted file mode 100644
index 4981d2683..000000000
--- a/_includes/content/lb4-project-commands.html
+++ /dev/null
@@ -1,26 +0,0 @@
-
diff --git a/_layouts/page.html b/_layouts/page.html
index 61cb50d2d..65f40d1f7 100644
--- a/_layouts/page.html
+++ b/_layouts/page.html
@@ -8,8 +8,12 @@
{% endif %}
diff --git a/images/lb4/10000000.png b/images/lb4/10000000.png
deleted file mode 100644
index bcde30c8e..000000000
Binary files a/images/lb4/10000000.png and /dev/null differ
diff --git a/images/lb4/10000001.png b/images/lb4/10000001.png
deleted file mode 100644
index a3ec9eed5..000000000
Binary files a/images/lb4/10000001.png and /dev/null differ
diff --git a/images/lb4/10000002.png b/images/lb4/10000002.png
deleted file mode 100644
index 449b1ed0c..000000000
Binary files a/images/lb4/10000002.png and /dev/null differ
diff --git a/images/lb4/loopback-component.png b/images/lb4/loopback-component.png
deleted file mode 100644
index f96798718..000000000
Binary files a/images/lb4/loopback-component.png and /dev/null differ
diff --git a/images/lb4/loopback-composition.png b/images/lb4/loopback-composition.png
deleted file mode 100644
index 98200d18a..000000000
Binary files a/images/lb4/loopback-composition.png and /dev/null differ
diff --git a/images/lb4/loopback-ecosystem.png b/images/lb4/loopback-ecosystem.png
deleted file mode 100644
index 7010b07b1..000000000
Binary files a/images/lb4/loopback-ecosystem.png and /dev/null differ
diff --git a/images/lb4/loopback-extension.png b/images/lb4/loopback-extension.png
deleted file mode 100644
index 8ac5eb5d3..000000000
Binary files a/images/lb4/loopback-extension.png and /dev/null differ
diff --git a/images/lb4/loopback-ioc.png b/images/lb4/loopback-ioc.png
deleted file mode 100644
index 41a47326e..000000000
Binary files a/images/lb4/loopback-ioc.png and /dev/null differ
diff --git a/images/lb4/loopback-overview.png b/images/lb4/loopback-overview.png
deleted file mode 100644
index 86d6b3af8..000000000
Binary files a/images/lb4/loopback-overview.png and /dev/null differ
diff --git a/images/lb4/loopback-stack.png b/images/lb4/loopback-stack.png
deleted file mode 100644
index 377fda955..000000000
Binary files a/images/lb4/loopback-stack.png and /dev/null differ
diff --git a/package.json b/package.json
index cbd55b701..ef44e6c65 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,9 @@
"start": "bundle exec jekyll serve --incremental",
"fetch-readmes": "get-readmes --repos=./_data --out=./_includes/readmes",
"lint-readmes": "markdownlint _includes/readmes/",
- "postinstall": "node ./api-explorer/upgrade-swagger-ui.js"
+ "postinstall": "npm run swagger-ui && npm run copydocs",
+ "swagger-ui": "node ./api-explorer/upgrade-swagger-ui.js",
+ "copydocs": "node update-lb4-docs.js"
},
"engines": {
"node": ">=8"
@@ -17,6 +19,7 @@
},
"devDependencies": {
"fs-extra": "^5.0.0",
+ "@loopback/docs": "latest",
"getreadmes": "github:strongloop/get-readmes",
"markdownlint-cli": "github:sequoia/markdownlint-cli",
"swagger-ui-dist": "^3.4.4"
diff --git a/update-lb4-docs.js b/update-lb4-docs.js
new file mode 100644
index 000000000..fb6db2950
--- /dev/null
+++ b/update-lb4-docs.js
@@ -0,0 +1,61 @@
+const fs = require('fs-extra');
+const path = require('path');
+
+const srcDocs = path.resolve(__dirname,'node_modules/@loopback/docs/site');
+const destDocs = path.resolve(__dirname, 'pages/en/lb4');
+const srcSidebars = path.resolve(srcDocs, 'sidebars');
+const destSidebars= path.resolve(__dirname, '_data/sidebars');
+
+/**
+ * Utility function to remove a directory.
+ * @param {string} dir - The path of the directory to remove.
+ */
+function removeDir(dir) {
+ try {
+ fs.removeSync(dir);
+ } catch (err) {
+ console.error('failed to cleanup %s due to %s',
+ dir, err.stack);
+ process.exit(1);
+ }
+}
+/**
+ * Utility function to copy contents of a source directory to
+ * a target directory. If certain files already exist, it will
+ * overwrite them.
+ * @param {string} src - The path of the source directory to copy from.
+ * @param {string} dest - The path of the target directory to copy to.
+ */
+function copyDocs(src, dest) {
+ try {
+ fs.copySync(src, dest, {overwrite: true});
+ } catch (err) {
+ console.error('failed to copy latest docs %s from %s', src, err.stack);
+ process.exit(1);
+ }
+}
+
+// copy the latest docs from @loopback/docs to pages/en/lb4 directory
+copyDocs(srcDocs, destDocs);
+
+//copy over sidebar for LoopBack 4
+copyDocs(srcSidebars, destSidebars);
+
+//clean up sidebar dir
+removeDir(srcSidebars);
+
+
+
+const fileToUpdate = path.resolve(destDocs, 'Testing-the-API.md');
+
+// bug in `jekyll-relative-links` plugin; probably safe to remove when
+// https://github.com/benbalter/jekyll-relative-links/issues/5
+// is resolved
+try {
+ let contents = fs.readFileSync(fileToUpdate, 'utf-8');
+ contents = contents.replace('include previous.md', 'include previous.html');
+ fs.writeFileSync(fileToUpdate, contents, 'utf-8');
+} catch (err) {
+ console.error('failed to replace relative link %s', err.stack);
+ process.exit(1);
+}