Build documentation with Travis it works as expected

This commit is contained in:
Aurelsicoko 2017-10-10 11:11:17 +02:00
parent f9666f21cb
commit 364e6c39ad
3 changed files with 27 additions and 2 deletions

View File

@ -20,4 +20,5 @@ install:
- npm run setup
script:
- npm run doc
- npm run test

View File

@ -12,6 +12,7 @@
"eslint-plugin-jsx-a11y": "^2.2.3",
"eslint-plugin-react": "^6.8.0",
"eslint-plugin-redux-saga": "^0.3.0",
"gitbook-cli": "^2.3.2",
"istanbul": "~0.4.2",
"lerna": "^2.0.0",
"mocha": "~2.4.5",
@ -23,6 +24,7 @@
"scripts": {
"clean": "npm run removesymlinkdependencies && rm -rf package-lock.json && rm -rf packages/*/package-lock.json",
"clean:all": "npm run removesymlinkdependencies && rm -rf package-lock.json && rm -rf packages/*/package-lock.json && rm -rf packages/*/node_modules",
"doc": "node ./scripts/documentation.js",
"release": "npm run clean:all && npm install && npm run createsymlinkdependencies && lerna exec --concurrency 1 -- npm install && npm run removesymlinkdependencies && node ./scripts/publish.js $TAG",
"createsymlinkdependencies": "node ./scripts/createSymlinkDependencies.js",
"removesymlinkdependencies": "node ./scripts/removeSymlinkDependencies.js",
@ -56,6 +58,5 @@
"node": ">= 7.0.0",
"npm": ">= 3.0.0"
},
"license": "MIT",
"dependencies": {}
"license": "MIT"
}

23
scripts/documentation.js Normal file
View File

@ -0,0 +1,23 @@
const _ = require('lodash');
const fs = require('fs');
const path = require('path');
const shell = require('shelljs');
try {
const versions = fs.readdirSync(path.resolve(process.cwd(), 'docs'), 'utf8');
_.forEach(versions, (version) => {
console.log(`Strapi install plugins version ${version}`);
shell.exec(`${path.join(process.cwd(), 'node_modules', '.bin', 'gitbook')} install ${path.join(process.cwd(), 'docs', version)}`);
console.log(`Strapi build version ${version}`);
shell.exec(`${path.join(process.cwd(), 'node_modules', '.bin', 'gitbook')} build ${path.join(process.cwd(), 'docs', version)}`);
});
console.log('Documentation has been built with success');
} catch (err) {
if (err.stdout) {
return console.log(err.stdout.toString('utf8'));
}
console.log(err);
}