feat(ags): improve types
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
8871cc8f01
commit
ccd437a275
10 changed files with 60 additions and 54 deletions
|
@ -31,6 +31,7 @@ in {
|
|||
configPath,
|
||||
packages,
|
||||
pname,
|
||||
delete ? [],
|
||||
}: let
|
||||
withGirNames =
|
||||
map (package: {
|
||||
|
@ -48,15 +49,18 @@ in {
|
|||
then "AstalPowerProfiles-0.1"
|
||||
else if package.pname == "gtk4"
|
||||
then "Gtk-4.0"
|
||||
else if package.pname == "libadwaita"
|
||||
then "Adw-1"
|
||||
else (concatMapStrings capitalise (splitString "-" package.pname)) + "-0.1";
|
||||
})
|
||||
packages;
|
||||
in {
|
||||
"${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}".source =
|
||||
pkgs.callPackage
|
||||
./mk-types {
|
||||
"${configPath}${optionalString (length packages == 1) "/${toLower (elemAt withGirNames 0).girName}"}" = {
|
||||
force = true;
|
||||
source = pkgs.callPackage ./mk-types {
|
||||
inherit (self.inputs) ts-for-gir-src;
|
||||
inherit pname withGirNames;
|
||||
inherit delete pname withGirNames;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,9 +4,10 @@
|
|||
withGirNames,
|
||||
buildNpmPackage,
|
||||
ts-for-gir-src,
|
||||
delete ? [],
|
||||
...
|
||||
}: let
|
||||
inherit (lib) concatMapStringsSep;
|
||||
inherit (lib) concatMapStringsSep optionalString;
|
||||
|
||||
buildPhase = ''
|
||||
npx @ts-for-gir/cli generate ${concatMapStringsSep " " (p: p.girName) withGirNames} \
|
||||
|
@ -31,6 +32,9 @@ in
|
|||
'';
|
||||
|
||||
installPhase = ''
|
||||
${optionalString (delete != []) (
|
||||
"rm -f " + concatMapStringsSep " " (file: "./types/${file}.d.ts") delete
|
||||
)}
|
||||
cp -r ./types $out
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
npmDepsHash = "sha256-FzWSWDEqsJxhYOhfSvmZU+/hqw44wm60nM7l32ut1+Y=";
|
||||
npmDepsHash = "sha256-qn1+dIo7p1+PYlR2qAmnCrR8xE93mYbwNCjDYISgnqU=";
|
||||
}
|
||||
|
|
16
modules/ags/config/env.d.ts
vendored
16
modules/ags/config/env.d.ts
vendored
|
@ -1,6 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
const SRC: string;
|
||||
declare const SRC: string;
|
||||
|
||||
declare module 'inline:*' {
|
||||
const content: string;
|
||||
|
@ -8,18 +6,18 @@ declare module 'inline:*' {
|
|||
export default content;
|
||||
}
|
||||
|
||||
declare module '*.sass' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module '*.scss' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module '*.blp' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module '*.css' {
|
||||
const content: string;
|
||||
|
||||
|
|
BIN
modules/ags/config/package-lock.json
generated
BIN
modules/ags/config/package-lock.json
generated
Binary file not shown.
|
@ -5,7 +5,6 @@
|
|||
"dependencies": {
|
||||
"@eslint/js": "9.17.0",
|
||||
"@stylistic/eslint-plugin": "2.12.1",
|
||||
"@types/node": "22.10.2",
|
||||
"eslint": "9.17.0",
|
||||
"eslint-plugin-jsdoc": "50.6.1",
|
||||
"fzf": "0.5.2",
|
||||
|
|
30
modules/ags/gtk4/env.d.ts
vendored
30
modules/ags/gtk4/env.d.ts
vendored
|
@ -1,21 +1,25 @@
|
|||
declare const SRC: string
|
||||
declare const SRC: string;
|
||||
|
||||
declare module "inline:*" {
|
||||
const content: string
|
||||
export default content
|
||||
declare module 'inline:*' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.scss" {
|
||||
const content: string
|
||||
export default content
|
||||
declare module '*.scss' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.blp" {
|
||||
const content: string
|
||||
export default content
|
||||
declare module '*.blp' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module "*.css" {
|
||||
const content: string
|
||||
export default content
|
||||
declare module '*.css' {
|
||||
const content: string;
|
||||
|
||||
export default content;
|
||||
}
|
||||
|
|
BIN
modules/ags/gtk4/package-lock.json
generated
BIN
modules/ags/gtk4/package-lock.json
generated
Binary file not shown.
1
modules/ags/gtk4/package-lock.json
generated
Symbolic link
1
modules/ags/gtk4/package-lock.json
generated
Symbolic link
|
@ -0,0 +1 @@
|
|||
../config/package-lock.json
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"name": "ags",
|
||||
"version": "0.0.0",
|
||||
"main": "app.ts",
|
||||
"dependencies": {
|
||||
"@eslint/js": "9.17.0",
|
||||
"@stylistic/eslint-plugin": "2.12.1",
|
||||
"@types/node": "22.10.2",
|
||||
"eslint": "9.17.0",
|
||||
"eslint-plugin-jsdoc": "50.6.1",
|
||||
"fzf": "0.5.2",
|
||||
"jiti": "2.4.2",
|
||||
"typescript-eslint": "8.19.0"
|
||||
}
|
||||
}
|
1
modules/ags/gtk4/package.json
Symbolic link
1
modules/ags/gtk4/package.json
Symbolic link
|
@ -0,0 +1 @@
|
|||
../config/package.json
|
|
@ -5,11 +5,11 @@ self: {
|
|||
pkgs,
|
||||
...
|
||||
}: let
|
||||
inherit (self.inputs) ags gtk-session-lock;
|
||||
inherit (self.inputs) ags astal gtk-session-lock;
|
||||
|
||||
gtkSessionLock = gtk-session-lock.packages.${pkgs.system}.default;
|
||||
|
||||
inherit (lib) attrValues boolToString getExe optionalAttrs optionals;
|
||||
inherit (lib) attrValues boolToString filter getExe optionalAttrs optionals;
|
||||
|
||||
inherit (osConfig.networking) hostName;
|
||||
|
||||
|
@ -37,7 +37,7 @@ in {
|
|||
};
|
||||
astalLibs = attrValues {
|
||||
inherit
|
||||
(ags.inputs.astal.packages.${pkgs.system})
|
||||
(astal.packages.${pkgs.system})
|
||||
io
|
||||
astal3
|
||||
astal4
|
||||
|
@ -59,6 +59,7 @@ in {
|
|||
|
||||
inherit
|
||||
(pkgs)
|
||||
libadwaita
|
||||
gtk4 # Needed to build types
|
||||
;
|
||||
};
|
||||
|
@ -118,7 +119,7 @@ in {
|
|||
;
|
||||
|
||||
mkTsConf = gtkVer: let
|
||||
inherit (ags.packages.${pkgs.system}) gjs;
|
||||
inherit (astal.packages.${pkgs.system}) gjs;
|
||||
in
|
||||
pkgs.writers.writeJSON "tsconfig.json" {
|
||||
"$schema" = "https://json.schemastore.org/tsconfig";
|
||||
|
@ -127,6 +128,7 @@ in {
|
|||
"strict" = true;
|
||||
"target" = "ES2022";
|
||||
"module" = "ES2022";
|
||||
"lib" = ["ES2022"];
|
||||
"moduleResolution" = "Bundler";
|
||||
"noEmit" = true;
|
||||
"jsx" = "react-jsx";
|
||||
|
@ -141,19 +143,28 @@ in {
|
|||
(buildGirTypes {
|
||||
pname = "ags";
|
||||
configPath = "${cfg.configDir}/@girs";
|
||||
packages = cfg.astalLibs;
|
||||
packages = filter (x:
|
||||
x.pname != "astal4" && x.pname != "libadwaita")
|
||||
cfg.astalLibs;
|
||||
delete = ["gdk-4.0" "gtk-4.0" "gsk-4.0"];
|
||||
})
|
||||
// (buildGirTypes {
|
||||
pname = "ags";
|
||||
configPath = "${gtk4ConfigDir}/@girs";
|
||||
packages = cfg.astalLibs;
|
||||
packages = filter (x:
|
||||
x.pname != "astal3" && x.pname != "gtk-session-lock")
|
||||
cfg.astalLibs;
|
||||
})
|
||||
// {
|
||||
"${cfg.configDir}/node_modules".source =
|
||||
buildNodeModules ./config (import ./config).npmDepsHash;
|
||||
"${cfg.configDir}/node_modules" = {
|
||||
force = true;
|
||||
source = buildNodeModules ./config (import ./config).npmDepsHash;
|
||||
};
|
||||
|
||||
"${gtk4ConfigDir}/node_modules".source =
|
||||
buildNodeModules ./config (import ./config).npmDepsHash;
|
||||
"${gtk4ConfigDir}/node_modules" = {
|
||||
force = true;
|
||||
source = buildNodeModules ./config (import ./config).npmDepsHash;
|
||||
};
|
||||
|
||||
"${cfg.configDir}/tsconfig.json".source = mkTsConf 3;
|
||||
|
||||
|
|
Loading…
Reference in a new issue