-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove script templates - Modify script to make the necessary changes - Bump version to 1.3.2
- Loading branch information
1 parent
a15bec6
commit f2e060b
Showing
11 changed files
with
69 additions
and
224 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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 +1,73 @@ | ||
// This script updates the version for | ||
// the build scripts | ||
// Script to update the version number | ||
// Usage: node update-version.js A.B.C | ||
|
||
// Run with NodeJS | ||
"use strict"; | ||
|
||
const Path = require("path"); | ||
const FS = require("fs"); | ||
const Path = require("path"); | ||
|
||
function updateFile(file, callback) { | ||
const contents = FS.readFileSync(file).toString(); | ||
const newContents = callback(contents); | ||
FS.writeFileSync(file, newContents); | ||
console.log("UPDATED: " + file); | ||
} | ||
|
||
function main () { | ||
const version = process.argv[2]; | ||
function main() { | ||
const arg = process.argv[2] || ""; | ||
|
||
if (!version) { | ||
console.error("Usage: node update-version.js A.B.C"); | ||
return; | ||
if (!arg) { | ||
console.log("Usage: node update-version.js A.B.C"); | ||
return 1; | ||
} | ||
|
||
const templates = FS.readdirSync(Path.resolve(__dirname, "script-templates")); | ||
const parts = arg.split("."); | ||
|
||
for (let templateFile of templates) { | ||
const contents = FS.readFileSync(Path.resolve(__dirname, "script-templates", templateFile)).toString(); | ||
FS.writeFileSync(Path.resolve(__dirname, templateFile), contents.replace(/\{VERSION\}/g, version)); | ||
console.log("UPDATED: " + templateFile); | ||
if (parts.length !== 3) { | ||
console.log("Usage: node update-version.js A.B.C"); | ||
return 1; | ||
} | ||
|
||
const MAJOR = parseInt(parts[0], 10); | ||
const MINOR = parseInt(parts[1], 10); | ||
const REVISION = parseInt(parts[2], 10); | ||
|
||
if (isNaN(MAJOR) || isNaN(MINOR) || isNaN(REVISION) || MAJOR < 0 || MINOR < 0 || REVISION < 0) { | ||
console.log("Usage: node update-version.js A.B.C"); | ||
return 1; | ||
} | ||
|
||
const VERSION = MAJOR + "." + MINOR + "." + REVISION; | ||
const DATE = (new Date()).toISOString().split("T")[0]; | ||
|
||
console.log(`Changing version to ${VERSION} | Date: ${DATE}`); | ||
|
||
updateFile(Path.resolve(__dirname, "build.bat"), contents => { | ||
return contents | ||
.replace(/ImageToMapMC\-[0-9]+\.[0-9]+\.[0-9]+\-Windows\-x64\.zip/g, `ImageToMapMC-${VERSION}-Windows-x64.zip`); | ||
}); | ||
|
||
updateFile(Path.resolve(__dirname, "build32.bat"), contents => { | ||
return contents | ||
.replace(/ImageToMapMC\-[0-9]+\.[0-9]+\.[0-9]+\-Windows\-Win32\.zip/g, `ImageToMapMC-${VERSION}-Windows-Win32.zip`); | ||
}); | ||
|
||
updateFile(Path.resolve(__dirname, "build.sh"), contents => { | ||
return contents | ||
.replace(/ImageToMapMC\-[0-9]+\.[0-9]+\.[0-9]+\-linux\-x64\.tar\.gz/g, `ImageToMapMC-${VERSION}-linux-x64.tar.gz`); | ||
}); | ||
|
||
updateFile(Path.resolve(__dirname, "wix", "make-wix-installer.bat"), contents => { | ||
return contents | ||
.replace(/ImageToMapMC\-[0-9]+\.[0-9]+\.[0-9]+\-x64\.msi/g, `ImageToMapMC-${VERSION}-x64.msi`); | ||
}); | ||
|
||
updateFile(Path.resolve(__dirname, "wix", "Product.wxs"), contents => { | ||
return contents | ||
.replace(/Name=\"ImageToMapMC\" Version=\"[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\"/, `Name="ImageToMapMC" Version="${VERSION}.0"`); | ||
}); | ||
|
||
console.log("DONE!"); | ||
} | ||
|
||
main(); | ||
process.exit(main() || 0); |
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