Skip to content

Commit fd36968

Browse files
read adaptorVersion from package, fall back to adaptor path
1 parent 18125d9 commit fd36968

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

lib/cli.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,18 @@ switch (argv._[0]) {
171171
break;
172172

173173
case 'execute':
174-
const adaptorVersion = argv.language.substring(
175-
argv.language.lastIndexOf('/') + 1
176-
);
174+
const fs = require('fs');
175+
let adaptorVersion;
176+
try {
177+
const path = argv.language;
178+
const rawdata = fs.readFileSync(
179+
path.substring(0, path.lastIndexOf('Adaptor') - 1) + '/package.json'
180+
);
181+
const package = JSON.parse(rawdata);
182+
adaptorVersion = `${package.name}#v${package.version}`;
183+
} catch (error) {
184+
adaptorVersion = argv.language;
185+
}
177186

178187
const debug = `│ ◰ ◱ ◲ ◳ OpenFn/core ~ ${adaptorVersion} (Node ${process.version}) │`;
179188
console.log('╭' + '─'.repeat(debug.length - 2) + '╮');

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "core",
3-
"version": "1.3.7",
3+
"version": "1.3.8",
44
"description": "The central job processing program used in the OpenFn platform.",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)