mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
Compare commits
4 commits
5ed44826e1
...
bdabaa7546
Author | SHA1 | Date | |
---|---|---|---|
|
bdabaa7546 | ||
|
7255035de4 | ||
|
dd46d9d935 | ||
|
688848fa5b |
6 changed files with 141 additions and 21 deletions
|
@ -0,0 +1,65 @@
|
||||||
|
From 2f2ed36df2c55ca60c7074cf80f97cdc6d53f83e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alyxia Sother <alyxia@riseup.net>
|
||||||
|
Date: Mon, 22 May 2023 10:14:07 +0200
|
||||||
|
Subject: [PATCH] web: build local extensions as well
|
||||||
|
|
||||||
|
---
|
||||||
|
web/buildExtension.js | 35 +++++++++++++++++++++++++++++++++++
|
||||||
|
1 file changed, 35 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/web/buildExtension.js b/web/buildExtension.js
|
||||||
|
index 206408c..4984ab2 100644
|
||||||
|
--- a/web/buildExtension.js
|
||||||
|
+++ b/web/buildExtension.js
|
||||||
|
@@ -1,7 +1,37 @@
|
||||||
|
+const fs = require("fs");
|
||||||
|
+const os = require("os");
|
||||||
|
+const path = require("path");
|
||||||
|
const webpack = require("webpack");
|
||||||
|
process.env.BUILD_TYPE = "extension";
|
||||||
|
const config = require("./webpack.config.js");
|
||||||
|
|
||||||
|
+const PATH_TO_EXTS = path.join(
|
||||||
|
+ os.homedir(),
|
||||||
|
+ "Library/ApplicationSupport/hh3/ext"
|
||||||
|
+);
|
||||||
|
+const HH_EXT_DIR = path.join(__dirname, "../ext");
|
||||||
|
+let exts = fs.readdirSync(PATH_TO_EXTS);
|
||||||
|
+exts = exts.filter((e) => e !== ".git");
|
||||||
|
+
|
||||||
|
+function deleteF(path) {
|
||||||
|
+ const isDir = fs.lstatSync(path).isDirectory();
|
||||||
|
+ if (isDir) fs.rmSync(path, {recursive: true});
|
||||||
|
+ else fs.unlinkSync(path);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+for (const ext of exts) {
|
||||||
|
+ if (fs.existsSync(path.join(HH_EXT_DIR, ext)))
|
||||||
|
+ deleteF(path.join(HH_EXT_DIR, ext));
|
||||||
|
+
|
||||||
|
+ const source = path.join(PATH_TO_EXTS, ext);
|
||||||
|
+ const dest = path.join(HH_EXT_DIR, ext);
|
||||||
|
+
|
||||||
|
+ fs.cpSync(source, dest, {
|
||||||
|
+ recursive: true,
|
||||||
|
+ });
|
||||||
|
+ console.log(`${source} -> ${dest}`);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
webpack.webpack(config, (err, stats) => {
|
||||||
|
if (!stats?.compilation) {
|
||||||
|
console.log(err);
|
||||||
|
@@ -21,5 +51,10 @@ webpack.webpack(config, (err, stats) => {
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
+ for (let ext of exts) {
|
||||||
|
+ ext = path.join(HH_EXT_DIR, ext);
|
||||||
|
+ deleteF(ext);
|
||||||
|
+ console.log(`✕ ${ext}`);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
--
|
||||||
|
2.37.1 (Apple Git-137.1)
|
||||||
|
|
53
common/hellcooling/build-local-exts.diff
Normal file
53
common/hellcooling/build-local-exts.diff
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
diff --git a/web/buildExtension.js b/web/buildExtension.js
|
||||||
|
index 206408c..4984ab2 100644
|
||||||
|
--- a/web/buildExtension.js
|
||||||
|
+++ b/web/buildExtension.js
|
||||||
|
@@ -1,7 +1,37 @@
|
||||||
|
+const fs = require("fs");
|
||||||
|
+const os = require("os");
|
||||||
|
+const path = require("path");
|
||||||
|
const webpack = require("webpack");
|
||||||
|
process.env.BUILD_TYPE = "extension";
|
||||||
|
const config = require("./webpack.config.js");
|
||||||
|
|
||||||
|
+const PATH_TO_EXTS = path.join(
|
||||||
|
+ os.homedir(),
|
||||||
|
+ "Library/ApplicationSupport/hh3/ext"
|
||||||
|
+);
|
||||||
|
+const HH_EXT_DIR = path.join(__dirname, "../ext");
|
||||||
|
+let exts = fs.readdirSync(PATH_TO_EXTS);
|
||||||
|
+exts = exts.filter((e) => e !== ".git");
|
||||||
|
+
|
||||||
|
+function deleteF(path) {
|
||||||
|
+ const isDir = fs.lstatSync(path).isDirectory();
|
||||||
|
+ if (isDir) fs.rmSync(path, {recursive: true});
|
||||||
|
+ else fs.unlinkSync(path);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+for (const ext of exts) {
|
||||||
|
+ if (fs.existsSync(path.join(HH_EXT_DIR, ext)))
|
||||||
|
+ deleteF(path.join(HH_EXT_DIR, ext));
|
||||||
|
+
|
||||||
|
+ const source = path.join(PATH_TO_EXTS, ext);
|
||||||
|
+ const dest = path.join(HH_EXT_DIR, ext);
|
||||||
|
+
|
||||||
|
+ fs.cpSync(source, dest, {
|
||||||
|
+ recursive: true,
|
||||||
|
+ });
|
||||||
|
+ console.log(`${source} -> ${dest}`);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
webpack.webpack(config, (err, stats) => {
|
||||||
|
if (!stats?.compilation) {
|
||||||
|
console.log(err);
|
||||||
|
@@ -21,5 +51,10 @@ webpack.webpack(config, (err, stats) => {
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
+ for (let ext of exts) {
|
||||||
|
+ ext = path.join(HH_EXT_DIR, ext);
|
||||||
|
+ deleteF(ext);
|
||||||
|
+ console.log(`✕ ${ext}`);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
});
|
Binary file not shown.
0
common/hellcooling/install.sh
Normal file
0
common/hellcooling/install.sh
Normal file
|
@ -32,6 +32,7 @@
|
||||||
gnupg
|
gnupg
|
||||||
jq
|
jq
|
||||||
kubectl
|
kubectl
|
||||||
|
kubelogin-oidc
|
||||||
mosh
|
mosh
|
||||||
neovim
|
neovim
|
||||||
nixpkgs-fmt
|
nixpkgs-fmt
|
||||||
|
|
|
@ -6,6 +6,25 @@ _plugin() {
|
||||||
[ -z "$DOTFILES_LOAD_SILENT" ] && _perf_timer_stop "plugin $1"
|
[ -z "$DOTFILES_LOAD_SILENT" ] && _perf_timer_stop "plugin $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# based off of Dima's completion generation code, but made dynamic
|
||||||
|
# https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25
|
||||||
|
_addcomp() {
|
||||||
|
local command_name="$1"
|
||||||
|
local command_args="${2:-completion zsh}"
|
||||||
|
declare ${command_name}_bin="$(command_locate $command_name)"
|
||||||
|
local command_bin="${(P)${:-${command_name}_bin}}"
|
||||||
|
|
||||||
|
if [[ -n "${command_bin}" ]]; then
|
||||||
|
declare ${command_name}_comp_path="${ZSH_CACHE_DIR}/site-functions/_${command_name}"
|
||||||
|
local comp_path="${(P)${:-${command_name}_comp_path}}"
|
||||||
|
if [[ "$command_bin" -nt "$comp_path" || ! -s "$comp_path" ]]; then
|
||||||
|
_perf_timer_start "generate $command_name completions"
|
||||||
|
eval "$command_bin" "$command_args" >| "$comp_path"
|
||||||
|
_perf_timer_stop "generate $command_name completions"
|
||||||
|
fi
|
||||||
|
fi; unset comp_path
|
||||||
|
}
|
||||||
|
|
||||||
_plugin gitio 'denysdovhan/gitio-zsh'
|
_plugin gitio 'denysdovhan/gitio-zsh'
|
||||||
|
|
||||||
# Load the brilliant project management tool.
|
# Load the brilliant project management tool.
|
||||||
|
@ -15,27 +34,9 @@ _plugin project 'https://git.sr.ht/~keanucode/scripts/blob/master/project/projec
|
||||||
load="project.zsh" \
|
load="project.zsh" \
|
||||||
|
|
||||||
# Completions {{{
|
# Completions {{{
|
||||||
# from Dima, assuming it's based off of:
|
_addcomp gh "completion -s zsh"
|
||||||
# https://github.com/dmitmel/dotfiles/blob/19d80233265629b33cf57daf05a928239b0c73a8/zsh/plugins.zsh#L17-L25
|
_addcomp bw "completion --shell zsh"
|
||||||
if gh_bin="$(command_locate gh)" && [[ -n "$gh_bin" ]]; then
|
_addcomp kubectl
|
||||||
gh_comp_path="${ZSH_CACHE_DIR}/site-functions/_gh"
|
|
||||||
if [[ "$gh_bin" -nt "$gh_comp_path" || ! -s "$gh_comp_path" ]]; then
|
|
||||||
_perf_timer_start "generate gh completions"
|
|
||||||
"$gh_bin" completion -s zsh >| "$gh_comp_path"
|
|
||||||
_perf_timer_stop "generate gh completions"
|
|
||||||
fi
|
|
||||||
unset gh_comp_path
|
|
||||||
fi; unset gh_bin
|
|
||||||
|
|
||||||
if bw_bin="$(command_locate bw)" && [[ -n "$bw_bin" ]]; then
|
|
||||||
bw_comp_path="${ZSH_CACHE_DIR}/site-functions/_bw"
|
|
||||||
if [[ "$bw_bin" -nt "$bw_comp_path" || ! -s "$bw_comp_path" ]]; then
|
|
||||||
_perf_timer_start "generate bw completions"
|
|
||||||
"$bw_bin" completion --shell zsh >| "$bw_comp_path"
|
|
||||||
_perf_timer_stop "generate bw completions"
|
|
||||||
fi
|
|
||||||
unset bw_comp_path
|
|
||||||
fi; unset bw_bin
|
|
||||||
|
|
||||||
_plugin nim-compl 'https://raw.githubusercontent.com/nim-lang/Nim/devel/tools/nim.zsh-completion' from=url \
|
_plugin nim-compl 'https://raw.githubusercontent.com/nim-lang/Nim/devel/tools/nim.zsh-completion' from=url \
|
||||||
after_load='plugin-cfg-path fpath prepend ""'
|
after_load='plugin-cfg-path fpath prepend ""'
|
||||||
|
|
Loading…
Reference in a new issue