Skip to content

Commit 1780beb

Browse files
grncdraciccarello
authored andcommitted
Allow installing typedoc from git repo (#834)
The `prepare` script was introduced in npm 5 to distinguish between build steps and other prepublish tasks (which should be run from the `prepublishOnly` script. npm no longer runs the `prepublish` script when installing from git repositories, but it will install dev deps and run `prepare` if it's present. Both are run before publishing. This change simplifies the grunt config into a build (default) and test task. BREAKING CHANGE: This will require npm 4+ when trying to install typedoc from a git url
1 parent c392b1a commit 1780beb

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
sudo: false
22
language: node_js
3+
34
node_js:
45
- 6
56
- 10
7+
8+
9+
before_install:
10+
- npm install --global npm@
11+
before_install: >
12+
node_version=$(node -v);
13+
if [ ${node_version:1:1} = 6 ]; then
14+
npm install --global npm@^4
15+
else
16+
npm install --global npm@latest
17+
fi

gruntfile.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ module.exports = function(grunt)
105105
grunt.loadNpmTasks('grunt-tslint');
106106
grunt.loadNpmTasks('grunt-mocha-istanbul');
107107

108-
grunt.registerTask('default', ['tslint', 'ts:typedoc', 'string-replace:version']);
109-
grunt.registerTask('build_and_test', ['default', 'copy', 'mocha_istanbul:coverage']);
108+
grunt.registerTask('default', ['ts:typedoc', 'string-replace:version']);
109+
grunt.registerTask('test', ['tslint', 'copy', 'mocha_istanbul:coverage']);
110+
grunt.registerTask('build_and_test', ['default', 'test']);
110111
grunt.registerTask('specs', ['clean:specsBefore', 'update-specs', 'clean:specsAfter']);
111112

112113
grunt.registerTask('update-specs', function() {

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,10 @@
7474
"LICENSE"
7575
],
7676
"scripts": {
77-
"test": "mocha -t 10000 --exit dist/test",
77+
"test": "grunt test",
7878
"build": "grunt build_and_test",
79-
"prepublish": "npm run build",
79+
"prepublishOnly": "grunt build_and_test",
80+
"prepare": "grunt default",
8081
"grunt": "grunt",
8182
"clean": "rm -rf node_modules package-lock.json lib coverage .tscache"
8283
},

0 commit comments

Comments
 (0)