1
1
import fs from 'fs' ;
2
2
import path from 'path' ;
3
3
4
-
5
4
function main ( ) {
6
- const folder = fs . realpathSync ( '.' ) ;
7
- const pkg = readPackageJson ( folder ) ;
8
- if ( pkg . gitHead ) {
9
- const fpath = path . join ( folder , 'package.json' ) ;
10
- console . debug ( `Deleting gitHead from ${ fpath } ...` ) ;
11
- delete pkg . gitHead ;
12
- fs . writeFileSync ( fpath , JSON . stringify ( pkg , null , 2 ) + '\n' ) ;
13
- }
14
- }
15
-
16
- function readJsonFile ( fpath ) {
17
- const content = fs . readFileSync ( fpath ) ;
18
- return JSON . parse ( content ) ;
19
- }
20
-
21
- function readPackageJson ( folder ) {
22
- const packageJsonPath = path . join ( folder , 'package.json' ) ;
23
- return readJsonFile ( packageJsonPath ) ;
5
+ const folder = fs . realpathSync ( '.' ) ;
6
+ const pkg = readPackageJson ( folder ) ;
7
+ if ( pkg . gitHead ) {
8
+ const fpath = path . join ( folder , 'package.json' ) ;
9
+ console . debug ( `Deleting gitHead from ${ fpath } ...` ) ;
10
+ delete pkg . gitHead ;
11
+ fs . writeFileSync ( fpath , JSON . stringify ( pkg , null , 2 ) + '\n' ) ;
24
12
}
25
-
26
- main ( ) ;
13
+ }
14
+
15
+ function readJsonFile ( fpath ) {
16
+ const content = fs . readFileSync ( fpath ) ;
17
+ return JSON . parse ( content ) ;
18
+ }
19
+
20
+ function readPackageJson ( folder ) {
21
+ const packageJsonPath = path . join ( folder , 'package.json' ) ;
22
+ return readJsonFile ( packageJsonPath ) ;
23
+ }
24
+
25
+ main ( ) ;
0 commit comments