-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] bundle_xml: improve the bundling o xml
This commit replace the parsing by hand of the arguments of the script bundling xml by the library minimist. It also add release note as a comment at the end of the bundled xml file. closes #2175 Signed-off-by: Pierre Rousseau (pro) <[email protected]>
- Loading branch information
1 parent
6b4d816
commit 5b8ff6c
Showing
4 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,8 +1,22 @@ | ||
const { version } = require("../../package.json"); | ||
const git = require("git-rev-sync"); | ||
const bundle = require("./bundle_xml_templates"); | ||
const parseArgs = require("minimist"); | ||
|
||
const DEFAULT_DIR = "dist"; | ||
|
||
const outDirFlagIndex = process.argv.findIndex((arg) => arg === "--outDir"); | ||
const outDir = outDirFlagIndex !== -1 ? process.argv[outDirFlagIndex + 1] : DEFAULT_DIR; | ||
const argv = parseArgs(process.argv.slice(2)); | ||
|
||
bundle.writeOwlTemplateBundleToFile(outDir || DEFAULT_DIR); | ||
let commitHash = ""; | ||
|
||
try { | ||
commitHash = git.short(); | ||
} catch (_) {} | ||
|
||
const OUTRO = ` | ||
__info__.version = '${version}'; | ||
__info__.date = '${new Date().toISOString()}'; | ||
__info__.hash = '${commitHash}'; | ||
`; | ||
|
||
bundle.writeOwlTemplateBundleToFile(argv.outDir || DEFAULT_DIR, OUTRO); |