-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Other: Added version scheme warning to everything CLI so that we don'…
…t need this overly explicit in README
- Loading branch information
Showing
7 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{ | ||
"name": "protobufjs", | ||
"version": "6.5.1", | ||
"versionScheme": "~", | ||
"description": "Protocol Buffers for JavaScript (& TypeScript).", | ||
"author": "Daniel Wirtz <[email protected]>", | ||
"license": "BSD-3-Clause", | ||
|
@@ -33,6 +34,7 @@ | |
"lint": "eslint src runtime", | ||
"pages": "node scripts/pages", | ||
"prepublish": "node scripts/prepublish", | ||
"postinstall": "node scripts/postinstall", | ||
"prof": "node bench/prof", | ||
"test": "tape -r ./lib/tape-adapter tests/*.js tests/node/*.js | tap-spec", | ||
"types": "node bin/pbts --main --global protobuf --out index.d.ts src && tsc tests/comp_typescript.ts --lib es2015 --noEmit --strictNullChecks && tsc tests/data/test.ts --lib es2015 --noEmit --strictNullChecks", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
var path = require("path"), | ||
pkg = require(path.join(__dirname, "..", "package.json")); | ||
|
||
if (!pkg.versionScheme) | ||
return; | ||
|
||
var fs = require("fs"); | ||
|
||
var warn = process.stderr.isTTY | ||
? "\x1b[30m\x1b[43mWARN\x1b[0m \x1b[35m" + path.basename(process.argv[1], ".js") + "\x1b[0m" | ||
: "WARN " + path.basename(process.argv[1], ".js"); | ||
|
||
var basePkg; | ||
try { | ||
basePkg = JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "package.json"))); | ||
} catch (e) { | ||
return; | ||
} | ||
|
||
[ | ||
"dependencies", | ||
"devDependencies", | ||
"optionalDependencies", | ||
"peerDependencies" | ||
] | ||
.forEach(function(check) { | ||
var version = basePkg && basePkg[check] && basePkg[check][pkg.name]; | ||
if (typeof version === "string" && version.charAt(0) !== pkg.versionScheme) | ||
process.stderr.write(pkg.name + " " + warn + " " + pkg.name + "@" + version + " is configured as a dependency of " + basePkg.name + ". use " + pkg.name + "@" + pkg.versionScheme + version.substring(1) + " instead for API compatibility.\n"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters