1- const chalk = require ( 'chalk' ) ;
2- const commandLineArgs = require ( 'command-line-args' ) ;
1+ import chalk from 'chalk' ;
2+ import commandLineArgs from 'command-line-args' ;
3+ import fs from 'fs' ;
34
4- const calculate = require ( './calculate' ) ;
5- const { fail } = require ( './feedback' ) ;
6- const help = require ( './help' ) ;
7- const package = require ( '../package.json' ) ;
8- const { query, update } = require ( './authorities' ) ;
9- const validate = require ( './validate' ) ;
5+ import calculate from './calculate.js' ;
6+ import { fail } from './feedback.js' ;
7+ import help from './help.js' ;
8+ import { query , update } from './authorities.js' ;
9+ import validate from './validate.js' ;
10+
11+ import { __dirname } from './util.js' ;
12+
13+ const module = JSON . parse ( fs . readFileSync ( __dirname + '/../package.json' ) ) ;
1014
1115const mainArgs = [
1216 { name : 'authority' , alias : 'a' , type : String , description : 'The ID of the issuing authority' } ,
@@ -33,7 +37,7 @@ args.dateOfExpiry = argv[1];
3337if ( args . help ) {
3438 help ( mainArgs ) ;
3539} else if ( args . version ) {
36- console . log ( package . version )
40+ console . log ( module . version ) ;
3741} else if ( args . update ) {
3842 update ( ) ;
3943} else if ( typeof args . query !== 'undefined' ) {
0 commit comments