pulumi/scripts/reversion.js
joeduffy 88dcdd8d2b Substitute ${VERSION} on Windows builds too
This change refactors the way we do ${VERSION} substitution in both
the Node.js SDK's version.js and package.json, so that it can work on
Windows.  This is required now that we are actually parsing semvers.
2018-02-20 14:37:28 -08:00

17 lines
471 B
JavaScript

// Copyright 2018, Pulumi Corporation. All rights reserved.
var fs = require("fs");
if (process.argv.length < 4) {
console.error("error: missing arguments; usage: <script> <file> <version>");
process.exit(1);
}
var file = process.argv[2];
var data = fs.readFileSync(file).toString("utf8");
var version = process.argv[3];
if (version && version[0] === "v") {
version = version.substring(1);
}
fs.writeFileSync(file, data.replace(/\${VERSION}/g, version));