-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evgeny Metelkin
committed
Nov 24, 2023
1 parent
735039c
commit d2d17c6
Showing
4 changed files
with
29 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env node | ||
const { Command } = require('commander'); | ||
const program = new Command(); | ||
const { exec } = require('child_process'); | ||
const { name, version } = require('../package.json'); | ||
|
||
program | ||
.name('heta init') | ||
.description('Update heta-compiler to the latest version.') | ||
.parse(process.argv); | ||
|
||
exec(`npm install --global ${name}`, (err, stdout, stderr) => { | ||
if (stderr) { | ||
process.stdout.write(stderr); | ||
process.exit(1); // BRAKE | ||
} | ||
|
||
let newVersion = stdout.match(/\w+@([\d.]*)/)[1]; // '0.99.0'; | ||
if (newVersion === version) { | ||
process.stdout.write(`${name} is already up to date ${version}\n`); | ||
} else { | ||
process.stdout.write(`${name} was updated from ${version} to ${newVersion}\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