Skip to content

Commit

Permalink
heta update command
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny Metelkin committed Nov 24, 2023
1 parent 735039c commit d2d17c6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
6 changes: 3 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

## ideas

- generarion of 'platform.yml' by `heta init`
- generation of 'platform.yml' by `heta init`
- deprecated `include` statement
- `#move`, `#moveNS`
- `#deleteNS` action
Expand All @@ -57,9 +57,8 @@
- add "ignoreCompartment" property in Species
- do not translate base units in SBML export like second => _second
- automatic creation of modifiers in SBML
- avoid insert for existed elements: get warning or #forceInsert
- avoid insert for existed elements: get warning or #forceInsert
- `@Dose` class to use with simbiology/mrgsolve/nonmem doses
- `heta update` => `npm i heta-compiler`
- support null for properties: highlight, parse, heta standard
- stoichiometry as `@Const` and `@Record`
- updating properties with `one::s1.assignments.start_ 5.5;`
Expand All @@ -69,6 +68,7 @@
- _get
- _set
- _omit
- _merge

### Dose class

Expand Down
24 changes: 24 additions & 0 deletions bin/heta-update.js
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`);
}
});
1 change: 1 addition & 0 deletions bin/heta.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ program
.description(descriptionText)
.command('build [dir]', 'Compile Heta based platform and create set of export files.')
.command('init [dir]', 'Create template platform files in directory.')
.command('update', 'Update heta-compiler to the latest version.')
.parse(process.argv);
2 changes: 1 addition & 1 deletion bin/print-version-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function printVersionMessage(){
let msg = [
colors.magenta.italic('FYI. Newer version of heta-compiler is available.'),
colors.magenta.italic(`See changes here: ${changelogLink}`),
colors.magenta(`Run "npm i -g heta-compiler" to update ${currentVersion} => ${latestVersion}`),
colors.magenta(`Run "heta update" to update ${currentVersion} => ${latestVersion}`),
'',''
];
process.stdout.write(msg.join('\n'));
Expand Down

0 comments on commit d2d17c6

Please sign in to comment.