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