Update meson (#647)

* Update meson

* update

* Use build_always_stale instead of manually defining files to track.

* Clean up tsconfig
This commit is contained in:
Jas Singh
2024-12-28 03:48:52 -08:00
committed by GitHub
parent ba7e0dfd52
commit a7b553725c
7 changed files with 35 additions and 49 deletions

1
env.d.ts vendored
View File

@@ -1,4 +1,5 @@
declare const SRC: string;
declare const DATADIR: string;
declare module 'inline:*' {
const content: string;

View File

@@ -1,57 +1,37 @@
project('hyprpanel')
project(
'hyprpanel',
default_options: [
'prefix=/usr',
],
)
bindir = get_option('prefix') / get_option('bindir')
datadir = get_option('prefix') / get_option('datadir') / 'hyprpanel'
prefix = get_option('prefix')
bindir = prefix / get_option('bindir')
datadir = prefix / get_option('datadir') / meson.project_name()
ags = find_program('ags', required: true)
find_program('gjs', required: true)
src_file_list_process = run_command(
'find',
'src',
'-type', 'f',
'(',
'-name', '*.ts',
'-o',
'-name', '*.tsx',
'-o',
'-name', '*.scss',
')',
)
if src_file_list_process.returncode() != 0
error('Failed to find source files.')
endif
src_file_list = src_file_list_process.stdout().split('\n')
all_sources = []
foreach file : src_file_list
file_stripped = file.strip()
if file_stripped != ''
all_sources += meson.project_source_root() / file_stripped
endif
endforeach
custom_target(
'hyprpanel_bundle',
input: all_sources,
input: files('app.ts'),
command: [
ags,
'bundle',
'--define', 'DATADIR="' + datadir + '"',
'--root', meson.project_source_root(),
meson.project_source_root() / 'app.ts',
'@OUTPUT@',
'--src', meson.project_source_root(),
],
output: 'hyprpanel.js',
output: meson.project_name() + '.js',
install: true,
install_dir: datadir,
build_always_stale: true,
)
configure_file(
input: 'scripts/hyprpanel_launcher.sh.in',
output: 'hyprpanel',
output: meson.project_name(),
configuration: {'DATADIR': datadir},
install: true,
install_dir: bindir,

10
package-lock.json generated
View File

@@ -8,6 +8,9 @@
"name": "hyprpanel",
"version": "1.0.0",
"license": "MIT",
"dependencies": {
"astal": "/usr/share/astal/gjs"
},
"devDependencies": {
"@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^8.5.0",
@@ -21,6 +24,9 @@
"typescript": "^5.6.2"
}
},
"../../../../usr/share/astal/gjs": {
"license": "LGPL-2.1"
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -593,6 +599,10 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/astal": {
"resolved": "../../../../usr/share/astal/gjs",
"link": true
},
"node_modules/available-typed-arrays": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",

View File

@@ -2,10 +2,7 @@
"name": "hyprpanel",
"version": "1.0.0",
"description": "A customizable panel built for Hyprland.",
"main": "config.js",
"directories": {
"lib": "lib"
},
"main": "app.ts",
"scripts": {
"lint": "eslint --config .eslintrc.js .",
"lint:fix": "eslint --config .eslintrc.js . --fix",
@@ -14,6 +11,9 @@
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"astal": "/usr/share/astal/gjs"
},
"devDependencies": {
"@types/node": "^22.5.4",
"@typescript-eslint/eslint-plugin": "^8.5.0",

View File

@@ -1,7 +1,5 @@
#!/bin/sh
export HYPRPANEL_DATADIR="@DATADIR@"
if [ "$#" -eq 0 ]; then
exec gjs -m "@DATADIR@/hyprpanel.js"
else

View File

@@ -28,11 +28,13 @@ export function ensureFile(path: string): void {
}
}
const dataDir = typeof DATADIR !== 'undefined' ? DATADIR : SRC;
Object.assign(globalThis, {
CONFIG: `${GLib.get_user_config_dir()}/hyprpanel/config.json`,
TMP: `${GLib.get_tmp_dir()}/hyprpanel`,
USER: GLib.get_user_name(),
SRC_DIR: GLib.getenv('HYPRPANEL_DATADIR') ?? SRC,
SRC_DIR: dataDir,
});
ensureDirectory(TMP);

View File

@@ -19,11 +19,6 @@
"types": [],
"experimentalDecorators": true,
"jsx": "react-jsx",
"jsxImportSource": "/usr/share/astal/gjs/gtk3",
"paths": {
"astal": ["/usr/share/astal/gjs"],
"astal/*": ["/usr/share/astal/gjs/*"]
}
},
"exclude": ["astal/gtk3/jsx-runtime.ts"]
"jsxImportSource": "astal/gtk3"
}
}