1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * conjoon
5
+ * extjs-app-webmail
6
+ * Copyright (C) 2023 Thorsten Suckow-Homberg https://github.com/conjoon/extjs-app-webmail
7
+ *
8
+ * Permission is hereby granted, free of charge, to any person
9
+ * obtaining a copy of this software and associated documentation
10
+ * files (the "Software"), to deal in the Software without restriction,
11
+ * including without limitation the rights to use, copy, modify, merge,
12
+ * publish, distribute, sublicense, and/or sell copies of the Software,
13
+ * and to permit persons to whom the Software is furnished to do so,
14
+ * subject to the following conditions:
15
+ *
16
+ * The above copyright notice and this permission notice shall be included
17
+ * in all copies or substantial portions of the Software.
18
+ *
19
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
23
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
25
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+ */
27
+
28
+
29
+ import fs from "fs-extra" ;
30
+ import l8 from "@l8js/l8" ;
31
+
32
+
33
+ function getValueFromPackageJson ( dest , path ) {
34
+ const pkg = ( fs . readJsonSync ( dest ) ) ;
35
+ return l8 . unchain ( path , pkg ) ;
36
+ }
37
+
38
+ function updatePackageJson ( dest , obj ) {
39
+ let newPkg = fs . readJsonSync ( dest ) ;
40
+
41
+ newPkg . sencha . version = obj . version ;
42
+ newPkg . sencha . compatVersion = obj . version ;
43
+
44
+ fs . outputFileSync ( dest , `${ JSON . stringify ( newPkg , null , 4 ) } ` ) ;
45
+ }
46
+
47
+ const version = getValueFromPackageJson ( "package.json" , "version" ) ;
48
+
49
+ // eslint-disable-next-line no-console
50
+ console . log ( `Updating package.json with ${ version } ...` ) ;
51
+
52
+ updatePackageJson ( "package.json" , { version} ) ;
53
+
54
+ // eslint-disable-next-line no-undef
55
+ process . exit ( 0 ) ;
0 commit comments