Check version before trying to upload to store.
This commit is contained in:
parent
56c1207dfa
commit
1e6fe65e51
61
npm-shrinkwrap.json
generated
61
npm-shrinkwrap.json
generated
@ -20,6 +20,11 @@
|
||||
"version": "2.4.2",
|
||||
"from": "lodash@>=2.4.1 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz"
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"from": "readable-stream@>=1.0.24 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -170,12 +175,25 @@
|
||||
"crc32-stream": {
|
||||
"version": "0.2.0",
|
||||
"from": "crc32-stream@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-0.2.0.tgz"
|
||||
"resolved": "https://registry.npmjs.org/crc32-stream/-/crc32-stream-0.2.0.tgz",
|
||||
"dependencies": {
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"from": "readable-stream@>=1.0.24 <1.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"crx": {
|
||||
"version": "3.0.3",
|
||||
"from": "crx@>=3.0.3 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/crx/-/crx-3.0.3.tgz"
|
||||
"resolved": "https://registry.npmjs.org/crx/-/crx-3.0.3.tgz",
|
||||
"dependencies": {
|
||||
"es6-promise": {
|
||||
"version": "2.3.0",
|
||||
"from": "es6-promise@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.3.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"cryptiles": {
|
||||
"version": "2.0.5",
|
||||
@ -272,9 +290,9 @@
|
||||
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.0.tgz"
|
||||
},
|
||||
"es6-promise": {
|
||||
"version": "2.3.0",
|
||||
"from": "es6-promise@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.3.0.tgz"
|
||||
"version": "3.0.2",
|
||||
"from": "es6-promise@>=3.0.2 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz"
|
||||
},
|
||||
"escape-string-regexp": {
|
||||
"version": "1.0.5",
|
||||
@ -310,6 +328,11 @@
|
||||
"version": "2.1.0",
|
||||
"from": "lodash@>=2.1.0 <2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.1.0.tgz"
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "0.2.14",
|
||||
"from": "minimatch@>=0.2.12 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -566,7 +589,13 @@
|
||||
"lazystream": {
|
||||
"version": "0.1.0",
|
||||
"from": "lazystream@>=0.1.0 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz"
|
||||
"resolved": "https://registry.npmjs.org/lazystream/-/lazystream-0.1.0.tgz",
|
||||
"dependencies": {
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"from": "readable-stream@>=1.0.2 <1.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"load-json-file": {
|
||||
"version": "1.1.0",
|
||||
@ -614,9 +643,9 @@
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.10.tgz"
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "0.2.14",
|
||||
"from": "minimatch@>=0.2.12 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz"
|
||||
"version": "2.0.10",
|
||||
"from": "minimatch@>=2.0.0 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz"
|
||||
},
|
||||
"minimist": {
|
||||
"version": "1.2.0",
|
||||
@ -751,9 +780,9 @@
|
||||
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz"
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"from": "readable-stream@>=1.0.24 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz"
|
||||
"version": "1.1.14",
|
||||
"from": "readable-stream@>=1.1.0 <1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz"
|
||||
},
|
||||
"redent": {
|
||||
"version": "1.0.0",
|
||||
@ -766,9 +795,9 @@
|
||||
"resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz"
|
||||
},
|
||||
"request": {
|
||||
"version": "2.71.0",
|
||||
"version": "2.72.0",
|
||||
"from": "request@>=2.69.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.71.0.tgz"
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.72.0.tgz"
|
||||
},
|
||||
"request-promise": {
|
||||
"version": "2.0.1",
|
||||
@ -956,6 +985,10 @@
|
||||
"version": "2.4.2",
|
||||
"from": "lodash@>=2.4.1 <2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-2.4.2.tgz"
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"from": "readable-stream@>=1.0.26 <1.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
"jszip": "^3.0.0",
|
||||
"lodash": "^4.11.1",
|
||||
"marked": "^0.3.5",
|
||||
"request": "^2.72.0",
|
||||
"webstore-upload": "0.0.7"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
@ -1,31 +1,34 @@
|
||||
var fs = require('fs');
|
||||
var webstore_upload = require('webstore-upload');
|
||||
var request = require('request');
|
||||
|
||||
var pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
|
||||
var v = JSON.parse(fs.readFileSync('version.json', 'utf8'));
|
||||
var secrets = JSON.parse(fs.readFileSync(`../${pkg.meta.path}.keys/chrome-store.json`, 'utf8'));
|
||||
|
||||
webstore_upload({
|
||||
accounts: {
|
||||
default: {
|
||||
publish: true,
|
||||
client_id: secrets.installed.client_id,
|
||||
client_secret: secrets.installed.client_secret,
|
||||
}
|
||||
},
|
||||
extensions: {
|
||||
extension: {
|
||||
appID: pkg.meta.chromeStoreID,
|
||||
zip: `dist/builds/${pkg.name}.zip`
|
||||
}
|
||||
request(`https://chrome.google.com/webstore/detail/${pkg.meta.chromeStoreID}`, function (error, response, body) {
|
||||
|
||||
if (body && body.indexOf(`<meta itemprop="version" content="${v.version}" />`) > 0 && process.argv[2] !== 'force') {
|
||||
console.log(`Version ${v.version} already uploaded.`);
|
||||
return;
|
||||
}
|
||||
}, 'default').catch(function(err) {
|
||||
var code;
|
||||
try {
|
||||
code = JSON.parse(err).more.error.itemError[0].error_code;
|
||||
} catch(err2) {
|
||||
}
|
||||
// PKG_INVALID_VERSION_NUMBER occurs when re-uploading an old version
|
||||
if (code !== 'PKG_INVALID_VERSION_NUMBER') {
|
||||
|
||||
webstore_upload({
|
||||
accounts: {
|
||||
default: {
|
||||
publish: true,
|
||||
client_id: secrets.installed.client_id,
|
||||
client_secret: secrets.installed.client_secret,
|
||||
}
|
||||
},
|
||||
extensions: {
|
||||
extension: {
|
||||
appID: pkg.meta.chromeStoreID,
|
||||
zip: `dist/builds/${pkg.name}.zip`
|
||||
}
|
||||
}
|
||||
}, 'default').catch(function() {
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user