@@ -11,21 +11,10 @@ import { exec } from 'child_process';
11
11
12
12
import Handlebars from 'handlebars' ;
13
13
import { promisify } from 'util' ;
14
- import { currentFileDir } from '../cli.js' ;
14
+ import { getVersion } from '../cli.js' ;
15
15
16
16
const execAsync = promisify ( exec ) ;
17
17
18
-
19
- function getVersion ( ) {
20
- const ADMIN_FORTH_ABSOLUTE_PATH = path . join ( currentFileDir ( import . meta. url ) , '..' , '..' ) ;
21
-
22
- const package_json = JSON . parse ( fs . readFileSync ( path . join ( ADMIN_FORTH_ABSOLUTE_PATH , 'package.json' ) , 'utf8' ) ) ;
23
-
24
- const ADMINFORTH_VERSION = package_json . version ;
25
-
26
- return ADMINFORTH_VERSION ;
27
- }
28
-
29
18
function detectAdminforthVersion ( ) {
30
19
try {
31
20
const version = getVersion ( ) ;
@@ -35,18 +24,16 @@ function detectAdminforthVersion() {
35
24
}
36
25
37
26
if ( version . includes ( 'next' ) ) {
38
- console . log ( "Installing next version of AdminForth" ) ;
39
27
return 'next' ;
40
28
}
41
- console . log ( "Installing latest version of AdminForth" ) ;
42
29
return 'latest' ;
43
30
} catch ( err ) {
44
31
console . warn ( '⚠️ Could not detect AdminForth version, defaulting to "latest".' ) ;
45
32
return 'latest' ;
46
33
}
47
34
}
48
35
49
- const getAdminforthVersion = detectAdminforthVersion ( ) ;
36
+ const adminforthVersion = detectAdminforthVersion ( ) ;
50
37
51
38
52
39
export function parseArgumentsIntoOptions ( rawArgs ) {
@@ -240,7 +227,7 @@ async function writeTemplateFiles(dirname, cwd, options) {
240
227
dest : 'package.json' ,
241
228
data : {
242
229
appName,
243
- adminforthVersion : getAdminforthVersion ,
230
+ adminforthVersion : adminforthVersion ,
244
231
} ,
245
232
} ,
246
233
{
0 commit comments