File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { build , context } from 'esbuild' ;
2+ import { readFileSync } from 'fs' ;
3+
4+ const pkg = JSON . parse ( readFileSync ( 'package.json' , 'utf8' ) ) ;
5+ const watch = process . argv . includes ( '--watch' ) ;
6+
7+ const banner = `// xPower Flow Card v${ pkg . version } \n// Copyright (C) 2025 BTNBx — MIT License\n` ;
8+
9+ const opts = {
10+ entryPoints : [ 'src/xpower-flow-card.js' ] ,
11+ outfile : 'xpower-flow-card.js' ,
12+ bundle : false ,
13+ minify : true ,
14+ sourcemap : false ,
15+ target : [ 'es2020' ] ,
16+ banner : { js : banner } ,
17+ logLevel : 'info' ,
18+ } ;
19+
20+ if ( watch ) {
21+ const ctx = await context ( opts ) ;
22+ await ctx . watch ( ) ;
23+ console . log ( 'Watching for changes...' ) ;
24+ } else {
25+ await build ( opts ) ;
26+ const { statSync } = await import ( 'fs' ) ;
27+ const s = statSync ( 'xpower-flow-card.js' ) ;
28+ console . log ( `Output: xpower-flow-card.js (${ ( s . size / 1024 ) . toFixed ( 1 ) } KB)` ) ;
29+ }
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " xpower-flow-card" ,
3+ "version" : " 1.2.4" ,
4+ "description" : " Universal power flow card for solar hybrid inverters in Home Assistant" ,
5+ "author" : " BTNBx" ,
6+ "license" : " MIT" ,
7+ "repository" : {
8+ "type" : " git" ,
9+ "url" : " https://github.com/BTNBx/xPower-Flow-Card"
10+ },
11+ "keywords" : [
12+ " home-assistant" ,
13+ " lovelace" ,
14+ " custom-card" ,
15+ " solar" ,
16+ " inverter" ,
17+ " energy" ,
18+ " deye" ,
19+ " sunsynk" ,
20+ " huawei" ,
21+ " fronius" ,
22+ " growatt" ,
23+ " victron" ,
24+ " solaredge"
25+ ],
26+ "scripts" : {
27+ "build" : " node build.mjs" ,
28+ "watch" : " node build.mjs --watch"
29+ },
30+ "devDependencies" : {
31+ "esbuild" : " ^0.25.0"
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments