diff --git a/.travis.yml b/.travis.yml index cd1b5235ef9..2eaf68c511e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,6 @@ addons: packages: - g++-4.8 before_install: -- npm install shelljs -- node ./scripts/link.js - export CXX=g++-4.8 - "$CXX --version" script: "./scripts/build.sh" diff --git a/package.json b/package.json index bd3dad9ec16..ad5a4a57d09 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "lodash.template": "^4.3.0", "mitm": "^1.1.0", "mkdirp": "^0.5.1", - "mocha": "^3.0.1", + "mocha": "^2.5.3", "propprop": "^0.3.0", "proxyquire": "^1.7.10", "request": "^2.70.0", @@ -25,9 +25,7 @@ "through2": "^2.0.0" }, "scripts": { - "link-modules": "node ./scripts/link.js", - "install-module-dependencies": "node ./scripts/install.js", - "postinstall": "npm run link-modules && npm run install-module-dependencies", + "postinstall": "node ./scripts/install.js", "docs": "node ./scripts/docs/packages.js", "bundle": "node ./scripts/docs/bundle.js", "lint": "jshint scripts/ packages/ system-test/ test/ && jscs packages/ system-test/ test/", diff --git a/packages/bigquery/package.json b/packages/bigquery/package.json index a39b92df288..13d4cded251 100644 --- a/packages/bigquery/package.json +++ b/packages/bigquery/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/bigquery", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google BigQuery Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -68,7 +68,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js bigquery", + "publish-module": "node ../../scripts/publish.js bigquery", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/bigtable/package.json b/packages/bigtable/package.json index cad829fe52c..30725a4bd44 100644 --- a/packages/bigtable/package.json +++ b/packages/bigtable/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/bigtable", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Bigtable Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -74,7 +74,7 @@ "sinon": "^1.17.4" }, "scripts": { - "publish": "node ../../scripts/publish.js bigtable", + "publish-module": "node ../../scripts/publish.js bigtable", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/common/package.json b/packages/common/package.json index 12c0066fdc1..264050cafad 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/common", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Common components for Google Cloud APIs Node.js Client Libraries", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -66,7 +66,7 @@ "sinon": "^1.17.4" }, "scripts": { - "publish": "node ../../scripts/publish.js common", + "publish-module": "node ../../scripts/publish.js common", "test": "mocha test/*.js" }, "license": "Apache-2.0", diff --git a/packages/compute/package.json b/packages/compute/package.json index c54c67ee47c..58d4ec05cd9 100644 --- a/packages/compute/package.json +++ b/packages/compute/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/compute", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Compute Engine Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -67,7 +67,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js compute", + "publish-module": "node ../../scripts/publish.js compute", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/datastore/package.json b/packages/datastore/package.json index a263e973f87..fbd78365594 100644 --- a/packages/datastore/package.json +++ b/packages/datastore/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/datastore", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Datastore Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -70,7 +70,7 @@ "through2": "^2.0.0" }, "scripts": { - "publish": "node ../../scripts/publish.js datastore", + "publish-module": "node ../../scripts/publish.js datastore", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/dns/package.json b/packages/dns/package.json index ca4758e0222..b4ad975de0c 100644 --- a/packages/dns/package.json +++ b/packages/dns/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/dns", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud DNS Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -66,7 +66,7 @@ "tmp": "0.0.27" }, "scripts": { - "publish": "../../scripts/publish dns", + "publish-module": "node ../../scripts/publish.js dns", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/google-cloud/package.json b/packages/google-cloud/package.json index 2b6bbcac640..178491a33b4 100644 --- a/packages/google-cloud/package.json +++ b/packages/google-cloud/package.json @@ -1,6 +1,6 @@ { "name": "google-cloud", - "version": "0.37.0", + "version": "0.38.3", "author": "Google Inc.", "description": "Google Cloud APIs Client Library for Node.js", "contributors": [ @@ -35,7 +35,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -94,25 +94,25 @@ ], "dependencies": { "extend": "^3.0.0", - "@google-cloud/bigquery": "0.1.0", - "@google-cloud/bigtable": "0.1.0", - "@google-cloud/compute": "0.1.0", - "@google-cloud/datastore": "0.1.0", - "@google-cloud/dns": "0.1.0", - "@google-cloud/language": "0.1.0", - "@google-cloud/logging": "0.1.0", - "@google-cloud/prediction": "0.1.0", - "@google-cloud/pubsub": "0.1.0", - "@google-cloud/resource": "0.1.0", - "@google-cloud/storage": "0.1.0", - "@google-cloud/translate": "0.1.0", - "@google-cloud/vision": "0.1.0" + "@google-cloud/bigquery": "^0.1.1", + "@google-cloud/bigtable": "^0.1.1", + "@google-cloud/compute": "^0.1.1", + "@google-cloud/datastore": "^0.1.1", + "@google-cloud/dns": "^0.1.1", + "@google-cloud/language": "^0.1.1", + "@google-cloud/logging": "^0.1.1", + "@google-cloud/prediction": "^0.1.1", + "@google-cloud/pubsub": "^0.1.1", + "@google-cloud/resource": "^0.1.1", + "@google-cloud/storage": "^0.1.1", + "@google-cloud/translate": "^0.1.1", + "@google-cloud/vision": "^0.1.1" }, "devDependencies": { "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js google-cloud", + "publish-module": "node ../../scripts/publish.js google-cloud", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/language/package.json b/packages/language/package.json index 1fba4ae22d4..72c48e5de8c 100644 --- a/packages/language/package.json +++ b/packages/language/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/language", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Natural Language Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -66,7 +66,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "../../scripts/publish.js language", + "publish-module": "node ../../scripts/publish.js language", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/logging/package.json b/packages/logging/package.json index bc6ddb27e9c..f2c7c34e4de 100644 --- a/packages/logging/package.json +++ b/packages/logging/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/logging", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Logging Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -69,7 +69,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js logging", + "publish-module": "node ../../scripts/publish.js logging", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/prediction/package.json b/packages/prediction/package.json index edca3058bec..36131e51fa4 100644 --- a/packages/prediction/package.json +++ b/packages/prediction/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/prediction", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Prediction Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -69,7 +69,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js prediction", + "publish-module": "node ../../scripts/publish.js prediction", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/pubsub/package.json b/packages/pubsub/package.json index e363592c103..f4ae9fa3bac 100644 --- a/packages/pubsub/package.json +++ b/packages/pubsub/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/pubsub", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Pub/Sub Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -64,7 +64,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js pubsub", + "publish-module": "node ../../scripts/publish.js pubsub", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/resource/package.json b/packages/resource/package.json index 5ab801acfbc..c557deef32a 100644 --- a/packages/resource/package.json +++ b/packages/resource/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/resource", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Resource Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -61,7 +61,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js resource", + "publish-module": "node ../../scripts/publish.js resource", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/storage/package.json b/packages/storage/package.json index b33ffea7181..02001071730 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/storage", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Storage Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -78,7 +78,7 @@ "tmp": "0.0.27" }, "scripts": { - "publish": "node ../../scripts/publish.js storage", + "publish-module": "node ../../scripts/publish.js storage", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/translate/package.json b/packages/translate/package.json index 9b1659a3380..365064c9b93 100644 --- a/packages/translate/package.json +++ b/packages/translate/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/translate", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Translate Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -61,7 +61,7 @@ "proxyquire": "^1.7.10" }, "scripts": { - "publish": "node ../../scripts/publish.js translate", + "publish-module": "node ../../scripts/publish.js translate", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/packages/vision/package.json b/packages/vision/package.json index 7e13fa7a321..683dd66dbbc 100644 --- a/packages/vision/package.json +++ b/packages/vision/package.json @@ -1,6 +1,6 @@ { "name": "@google-cloud/vision", - "version": "0.1.0", + "version": "0.1.1", "author": "Google Inc.", "description": "Google Cloud Vision Client Library for Node.js", "contributors": [ @@ -31,7 +31,7 @@ ], "main": "./src/index.js", "files": [ - "./src/*", + "src", "AUTHORS", "CONTRIBUTORS", "COPYING" @@ -71,7 +71,7 @@ "tmp": "0.0.27" }, "scripts": { - "publish": "node ../../scripts/publish.js vision", + "publish-module": "node ../../scripts/publish.js vision", "test": "mocha test/*.js", "system-test": "mocha system-test/*.js --no-timeouts --bail" }, diff --git a/scripts/install.js b/scripts/install.js index ad58c393ba5..6263acca117 100755 --- a/scripts/install.js +++ b/scripts/install.js @@ -22,29 +22,22 @@ var path = require('path'); require('shelljs/global'); -// Install NPM dependencies, in up to 5 directories at a time -var queue = async.queue(installForDirectory, 5); +var directories = fs.readdirSync(path.join(__dirname, '../packages')); -var files = fs.readdirSync(path.join(__dirname, '../packages')); -files.forEach(function(file) { - queue.push(file); -}); - -/** - * Install NPM dependencies within a single directory. - * - * @param {string} directory The name of the directory in which to install - * dependencies. - * @param {function} callback The callback function. - */ -function installForDirectory(directory, callback) { - console.log(directory + '...installing dependencies'); +// This is a helper method which will auto-install all of the dependencies of +// each module. +async.eachLimit(directories, 5, function(directory, callback) { + console.log('Installing dependencies for ' + directory); exec('npm install', { async: true, cwd: path.join(__dirname, '../packages', directory) - }, function(err) { - console.log(directory + '...done'); - callback(err); - }); -} + }, callback); +}, function(err) { + if (err) { + console.error('All dependencies could not be installed'); + return; + } + + console.log('All dependencies installed'); +}); diff --git a/scripts/link.js b/scripts/link.js deleted file mode 100755 index 0b7fc36945a..00000000000 --- a/scripts/link.js +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * Copyright 2016 Google Inc. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -'use strict'; - -var path = require('path'); - -require('shelljs/global'); - -// Doesn't depend on any other google-cloud* packages -link('common'); - -// These only depend on @google-cloud/common -[ - 'bigtable', - 'compute', - 'datastore', - 'dns', - 'pubsub', - 'resource', - 'storage', - 'translate' -].forEach(function(packageName) { - link(packageName, '@google-cloud/common'); - link(packageName); -}); - -// Depends on @google-cloud/common, @google-cloud/storage -[ - 'bigquery', - 'language', - 'prediction', - 'vision' -].forEach(function(packageName) { - link(packageName, '@google-cloud/common'); - link(packageName, '@google-cloud/storage'); - link(packageName); -}); - -// Depends on @google-cloud/bigquery, @google-cloud/common, @google-cloud/pubsub, @google-cloud/storage -[ - 'bigquery', - 'common', - 'pubsub', - 'storage' -].forEach(function(packageName) { - link('logging', '@google-cloud/' + packageName); -}); -link('logging'); - -// Finally, link sub-packages into main package -[ - 'bigquery', - 'bigtable', - 'compute', - 'datastore', - 'dns', - 'language', - 'logging', - 'prediction', - 'pubsub', - 'resource', - 'storage', - 'translate', - 'vision' -].forEach(function(packageName) { - link('google-cloud', '@google-cloud/' + packageName); -}); - -function link(directory, target) { - exec(target ? 'npm link ' + target : 'npm link', { - cwd: path.join('packages', directory) - }); -} diff --git a/scripts/publish.js b/scripts/publish.js index 3e1c57e50d5..ef0399626b7 100755 --- a/scripts/publish.js +++ b/scripts/publish.js @@ -30,18 +30,13 @@ cp(path.join(__dirname, '../COPYING'), cwd); var args = process.argv.splice(1); var moduleName = args[1]; -var newVersion = args[2]; +var newVersion = args[2].replace(/^v*/, ''); var tagName = [moduleName, newVersion].join('-'); if (moduleName === 'google-cloud') { - tagName = newVersion; + tagName = ('v' + newVersion); } -// Create a git tag -exec('git tag -a ' + tagName + ' -m "' + moduleName + ' release for ' + newVersion + '"', { - cwd: cwd -}); - // Increment the version exec('npm --no-git-tag-version version ' + newVersion, { cwd: cwd @@ -52,17 +47,28 @@ console.log('Publishing package in 10 seconds. Exit process to abort'); setTimeout(function() { console.log('Publishing now'); + exec('rm -rf node_modules', { + cwd: cwd + }); + // Publish the module exec('npm publish', { cwd: cwd }); - console.log('echo "Now push to master: git push origin master --follow-tags"'); - // Remove the duplicated files rm([ path.join(cwd, 'AUTHORS'), path.join(cwd, 'CONTRIBUTORS'), path.join(cwd, 'COPYING') ]); + + exec('git commit -m "' + moduleName + ' @ ' + newVersion + ' tagged.'); + + // Create a git tag + exec('git tag -a ' + tagName + ' -m "' + moduleName + ' release for ' + newVersion + '"', { + cwd: cwd + }); + + console.log('Now push to master: git push origin master --follow-tags"'); }, 10000);