Skip to content

Commit

Permalink
Finish the Node script for publishing the site
Browse files Browse the repository at this point in the history
Related to #196
  • Loading branch information
chasenlehara committed Jul 19, 2017
1 parent f9b7f73 commit e57353d
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 81 deletions.
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

14 changes: 7 additions & 7 deletions doc/guides/contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ a half day task. `~34` might take a week of experimentation.

## Suggest a feature

FuncUnit uses [Github Issues](https://github.com/bitovi/funcunit/issues/new) to track feature requests.
FuncUnit uses [Github Issues](https://github.com/bitovi/funcunit/issues/new) to track feature requests.

When creating an feature issue, it's very helpful to include:

Expand Down Expand Up @@ -210,8 +210,8 @@ The following details the directory structure of FuncUnit:
├── .jshintrc - Configures JSHint
├── .npmignore - Tells npm publish to ignore certain files
├── .travis.yml - Travis CI configuration
├── publish-docs.js - Publishes the documentation to gh-pages
├── readme.md - Automatically generated readme
├── Makefile - Publishes the doumentation to gh-pages
├── test.html - Main test page
├── test/ - Test files
| ├── test.js - Main test file
Expand Down Expand Up @@ -303,11 +303,11 @@ The FuncUnit theme is in `funcunit/site/theme`

Once the docs look right locally, commit your changes, then run:

```
> make
```shell
npm run document:publish
```

The make script will generate the documentation again and push out the `gh-pages` branch.
The `publish-docs.js` script will generate the documentation again and push out the `gh-pages` branch.


### Writing API documentation
Expand Down Expand Up @@ -414,7 +414,7 @@ use section because it's covered in [can-component].

#### For individual modules

FuncUnit has the same structure as all CanJS individual modules which allows making releases through NPM scripts.
FuncUnit has the same structure as all CanJS individual modules which allows making releases through NPM scripts.
All versions should follow the [Semantic Versioning](http://semver.org/) guidelines in the form of `MAJOR.MINOR.PATCH` for

- `MAJOR` version when you make incompatible API changes,
Expand Down Expand Up @@ -443,4 +443,4 @@ This will run the tests, build, bump the version number accordingly and publish

#### Travis

All repositories automatically run their tests in [Travis CI](https://travis-ci.org/) using the `npm test` command (browser tests use Firefox as their target browser).
All repositories automatically run their tests in [Travis CI](https://travis-ci.org/) using the `npm test` command (browser tests use Firefox as their target browser).
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
"release:major": "npm version major && npm publish",
"build": "node build.js",
"document": "./node_modules/.bin/documentjs",
"document:force": "./node_modules/.bin/documentjs --f",
"document:publish": "node publish-docs.js",
"develop": "done-serve --static --develop --port 8080",
"release:pre": "npm version prerelease && npm publish"
},
Expand All @@ -47,16 +49,17 @@
"syn": "^0.10.0"
},
"devDependencies": {
"less": "^1.7.0",
"documentjs": "^0.3.0-pre.4",
"can-define": "^0.8.0",
"can-zone": "^0.4.4",
"chai": "^3.5.0",
"documentjs": "^0.3.0-pre.4",
"done-serve": "^0.2.5",
"donejs-cli": "^0.9.5",
"generator-donejs": "^0.9.0",
"jasmine": "^2.5.2",
"jshint": "^2.9.1",
"less": "^1.7.0",
"shelljs": "^0.7.8",
"steal": "^0.16.35",
"steal-jasmine": "0.0.3",
"steal-mocha": "0.0.3",
Expand Down
50 changes: 0 additions & 50 deletions pub-docs.js

This file was deleted.

66 changes: 66 additions & 0 deletions publish-docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
var shell = require('shelljs');

if (!shell.which('git')) {
shell.echo('Sorry, this script requires git');
shell.exit(1);
}

console.info('Running git checkout -b gh-pages');
checkResultCode(shell.exec('git checkout -b gh-pages'));

console.info('Running rm -rf node_modules');
checkResultCode(shell.rm('-rf', 'node_modules'));

console.info('Running rm -rf site/node_modules');
checkResultCode(shell.rm('-rf', 'site/node_modules'));

console.info('Running rm -rf docs');
checkResultCode(shell.rm('-rf', 'docs'));

console.info('Running rm -rf guides');
checkResultCode(shell.rm('-rf', 'guides'));

console.info('Running $(MAKE) -C site build');
checkResultCode(shell.exec('cd site && npm install --no-shrinkwrap && npm run build && cd ..'));

console.info('Running npm install --no-shrinkwrap');
checkResultCode(shell.exec('npm install --no-shrinkwrap'));

console.info('Running npm run document:force');
checkResultCode(shell.exec('npm run document:force'));

console.info('Running git add -f docs/');
checkResultCode(shell.exec('git add -f docs/'));

console.info('Running git add -f guides/');
checkResultCode(shell.exec('git add -f guides/'));

console.info('Running git add -f site/static/');
checkResultCode(shell.exec('git add -f site/static/'));

console.info('Running git add -f examples/');
checkResultCode(shell.exec('git add -f examples/'));

console.info('Running git add -f index.html');
checkResultCode(shell.exec('git add -f index.html'));

console.info('Running git add -f CNAME');
checkResultCode(shell.exec('git add -f CNAME'));

console.info('Running git commit -m "Publish docs"');
checkResultCode(shell.exec('git commit -m "Publish docs"'));

console.info('Running git push -f origin gh-pages');
checkResultCode(shell.exec('git push -f origin gh-pages'));

console.info('Running git checkout -');
checkResultCode(shell.exec('git checkout -'));

console.info('Running git branch -D gh-pages');
checkResultCode(shell.exec('git branch -D gh-pages'));

function checkResultCode(result) {
if (result.code !== 0) {
shell.exit(result.code);
}
}
3 changes: 0 additions & 3 deletions site/Makefile

This file was deleted.

0 comments on commit e57353d

Please sign in to comment.