From bc7216ad9b9177e518128a79f6cab33785325b74 Mon Sep 17 00:00:00 2001 From: ucpr Date: Sun, 28 May 2023 16:54:41 +0900 Subject: [PATCH 1/5] feat: add dotfiles managemant cli --- Makefile | 9 +++-- cli/deno.jsonc | 5 +++ cli/deno.lock | 69 +++++++++++++++++++++++++++++++++++ cli/import_map.json | 7 ++++ cli/lib/file.ts | 10 +++++ cli/lib/healthcheck.ts | 57 +++++++++++++++++++++++++++++ main.ts => cli/lib/linkMap.ts | 50 ++----------------------- cli/lib/logo.ts | 15 ++++++++ cli/lib/setup.ts | 23 ++++++++++++ cli/main.ts | 27 ++++++++++++++ 10 files changed, 222 insertions(+), 50 deletions(-) create mode 100644 cli/deno.jsonc create mode 100644 cli/deno.lock create mode 100644 cli/import_map.json create mode 100644 cli/lib/file.ts create mode 100644 cli/lib/healthcheck.ts rename main.ts => cli/lib/linkMap.ts (53%) create mode 100644 cli/lib/logo.ts create mode 100644 cli/lib/setup.ts create mode 100644 cli/main.ts diff --git a/Makefile b/Makefile index b7d4be7..3ce013b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -.PHONY: link -link: PERMISSIONS ?= --allow-env --allow-read --allow-write -link: - deno run $(PERMISSIONS) main.ts +.PHONY: cli +cli: IMPORT_MAP ?= --import-map=import_map.json +cli: PERMISSIONS ?= --allow-env --allow-read --allow-write +cli: + cd cli && deno run $(IMPORT_MAP) $(PERMISSIONS) main.ts logo diff --git a/cli/deno.jsonc b/cli/deno.jsonc new file mode 100644 index 0000000..3c5130f --- /dev/null +++ b/cli/deno.jsonc @@ -0,0 +1,5 @@ +{ + "tasks": { + "dev": "deno run --watch main.ts" + } +} diff --git a/cli/deno.lock b/cli/deno.lock new file mode 100644 index 0000000..a49920c --- /dev/null +++ b/cli/deno.lock @@ -0,0 +1,69 @@ +{ + "version": "2", + "remote": { + "https://deno.land/std@0.170.0/fmt/colors.ts": "03ad95e543d2808bc43c17a3dd29d25b43d0f16287fe562a0be89bf632454a12", + "https://deno.land/std@0.177.1/_util/asserts.ts": "178dfc49a464aee693a7e285567b3d0b555dc805ff490505a8aae34f9cfb1462", + "https://deno.land/std@0.177.1/_util/os.ts": "d932f56d41e4f6a6093d56044e29ce637f8dcc43c5a90af43504a889cf1775e3", + "https://deno.land/std@0.177.1/path/_constants.ts": "e49961f6f4f48039c0dfed3c3f93e963ca3d92791c9d478ac5b43183413136e0", + "https://deno.land/std@0.177.1/path/_interface.ts": "6471159dfbbc357e03882c2266d21ef9afdb1e4aa771b0545e90db58a0ba314b", + "https://deno.land/std@0.177.1/path/_util.ts": "d7abb1e0dea065f427b89156e28cdeb32b045870acdf865833ba808a73b576d0", + "https://deno.land/std@0.177.1/path/common.ts": "ee7505ab01fd22de3963b64e46cff31f40de34f9f8de1fff6a1bd2fe79380000", + "https://deno.land/std@0.177.1/path/glob.ts": "d479e0a695621c94d3fd7fe7abd4f9499caf32a8de13f25073451c6ef420a4e1", + "https://deno.land/std@0.177.1/path/mod.ts": "4b83694ac500d7d31b0cdafc927080a53dc0c3027eb2895790fb155082b0d232", + "https://deno.land/std@0.177.1/path/posix.ts": "8b7c67ac338714b30c816079303d0285dd24af6b284f7ad63da5b27372a2c94d", + "https://deno.land/std@0.177.1/path/separator.ts": "0fb679739d0d1d7bf45b68dacfb4ec7563597a902edbaf3c59b50d5bcadd93b1", + "https://deno.land/std@0.177.1/path/win32.ts": "d186344e5583bcbf8b18af416d13d82b35a317116e6460a5a3953508c3de5bba", + "https://deno.land/x/cliffy@v0.25.7/_utils/distance.ts": "02af166952c7c358ac83beae397aa2fbca4ad630aecfcd38d92edb1ea429f004", + "https://deno.land/x/cliffy@v0.25.7/command/_errors.ts": "a9bd23dc816b32ec96c9b8f3057218241778d8c40333b43341138191450965e5", + "https://deno.land/x/cliffy@v0.25.7/command/_utils.ts": "9ab3d69fabab6c335b881b8a5229cbd5db0c68f630a1c307aff988b6396d9baf", + "https://deno.land/x/cliffy@v0.25.7/command/command.ts": "a2b83c612acd65c69116f70dec872f6da383699b83874b70fcf38cddf790443f", + "https://deno.land/x/cliffy@v0.25.7/command/completions/_bash_completions_generator.ts": "43b4abb543d4dc60233620d51e69d82d3b7c44e274e723681e0dce2a124f69f9", + "https://deno.land/x/cliffy@v0.25.7/command/completions/_fish_completions_generator.ts": "d0289985f5cf0bd288c05273bfa286b24c27feb40822eb7fd9d7fee64e6580e8", + "https://deno.land/x/cliffy@v0.25.7/command/completions/_zsh_completions_generator.ts": "14461eb274954fea4953ee75938821f721da7da607dc49bcc7db1e3f33a207bd", + "https://deno.land/x/cliffy@v0.25.7/command/completions/bash.ts": "053aa2006ec327ccecacb00ba28e5eb836300e5c1bec1b3cfaee9ddcf8189756", + "https://deno.land/x/cliffy@v0.25.7/command/completions/complete.ts": "58df61caa5e6220ff2768636a69337923ad9d4b8c1932aeb27165081c4d07d8b", + "https://deno.land/x/cliffy@v0.25.7/command/completions/fish.ts": "9938beaa6458c6cf9e2eeda46a09e8cd362d4f8c6c9efe87d3cd8ca7477402a5", + "https://deno.land/x/cliffy@v0.25.7/command/completions/mod.ts": "aeef7ec8e319bb157c39a4bab8030c9fe8fa327b4c1e94c9c1025077b45b40c0", + "https://deno.land/x/cliffy@v0.25.7/command/completions/zsh.ts": "8b04ab244a0b582f7927d405e17b38602428eeb347a9968a657e7ea9f40e721a", + "https://deno.land/x/cliffy@v0.25.7/command/deprecated.ts": "bbe6670f1d645b773d04b725b8b8e7814c862c9f1afba460c4d599ffe9d4983c", + "https://deno.land/x/cliffy@v0.25.7/command/deps.ts": "275b964ce173770bae65f6b8ebe9d2fd557dc10292cdd1ed3db1735f0d77fa1d", + "https://deno.land/x/cliffy@v0.25.7/command/help/_help_generator.ts": "f7c349cb2ddb737e70dc1f89bcb1943ca9017a53506be0d4138e0aadb9970a49", + "https://deno.land/x/cliffy@v0.25.7/command/help/mod.ts": "09d74d3eb42d21285407cda688074c29595d9c927b69aedf9d05ff3f215820d3", + "https://deno.land/x/cliffy@v0.25.7/command/mod.ts": "d0a32df6b14028e43bb2d41fa87d24bc00f9662a44e5a177b3db02f93e473209", + "https://deno.land/x/cliffy@v0.25.7/command/type.ts": "24e88e3085e1574662b856ccce70d589959648817135d4469fab67b9cce1b364", + "https://deno.land/x/cliffy@v0.25.7/command/types.ts": "ae02eec0ed7a769f7dba2dd5d3a931a61724b3021271b1b565cf189d9adfd4a0", + "https://deno.land/x/cliffy@v0.25.7/command/types/action_list.ts": "33c98d449617c7a563a535c9ceb3741bde9f6363353fd492f90a74570c611c27", + "https://deno.land/x/cliffy@v0.25.7/command/types/boolean.ts": "3879ec16092b4b5b1a0acb8675f8c9250c0b8a972e1e4c7adfba8335bd2263ed", + "https://deno.land/x/cliffy@v0.25.7/command/types/child_command.ts": "f1fca390c7fbfa7a713ca15ef55c2c7656bcbb394d50e8ef54085bdf6dc22559", + "https://deno.land/x/cliffy@v0.25.7/command/types/command.ts": "325d0382e383b725fd8d0ef34ebaeae082c5b76a1f6f2e843fee5dbb1a4fe3ac", + "https://deno.land/x/cliffy@v0.25.7/command/types/enum.ts": "2178345972adf7129a47e5f02856ca3e6852a91442a1c78307dffb8a6a3c6c9f", + "https://deno.land/x/cliffy@v0.25.7/command/types/file.ts": "8618f16ac9015c8589cbd946b3de1988cc4899b90ea251f3325c93c46745140e", + "https://deno.land/x/cliffy@v0.25.7/command/types/integer.ts": "29864725fd48738579d18123d7ee78fed37515e6dc62146c7544c98a82f1778d", + "https://deno.land/x/cliffy@v0.25.7/command/types/number.ts": "aeba96e6f470309317a16b308c82e0e4138a830ec79c9877e4622c682012bc1f", + "https://deno.land/x/cliffy@v0.25.7/command/types/string.ts": "e4dadb08a11795474871c7967beab954593813bb53d9f69ea5f9b734e43dc0e0", + "https://deno.land/x/cliffy@v0.25.7/command/upgrade/mod.ts": "17e2df3b620905583256684415e6c4a31e8de5c59066eb6d6c9c133919292dc4", + "https://deno.land/x/cliffy@v0.25.7/command/upgrade/provider.ts": "d6fb846043232cbd23c57d257100c7fc92274984d75a5fead0f3e4266dc76ab8", + "https://deno.land/x/cliffy@v0.25.7/command/upgrade/provider/deno_land.ts": "24f8d82e38c51e09be989f30f8ad21f9dd41ac1bb1973b443a13883e8ba06d6d", + "https://deno.land/x/cliffy@v0.25.7/command/upgrade/provider/github.ts": "99e1b133dd446c6aa79f69e69c46eb8bc1c968dd331c2a7d4064514a317c7b59", + "https://deno.land/x/cliffy@v0.25.7/command/upgrade/provider/nest_land.ts": "0e07936cea04fa41ac9297f32d87f39152ea873970c54cb5b4934b12fee1885e", + "https://deno.land/x/cliffy@v0.25.7/command/upgrade/upgrade_command.ts": "3640a287d914190241ea1e636774b1b4b0e1828fa75119971dd5304784061e05", + "https://deno.land/x/cliffy@v0.25.7/flags/_errors.ts": "f1fbb6bfa009e7950508c9d491cfb4a5551027d9f453389606adb3f2327d048f", + "https://deno.land/x/cliffy@v0.25.7/flags/_utils.ts": "340d3ecab43cde9489187e1f176504d2c58485df6652d1cdd907c0e9c3ce4cc2", + "https://deno.land/x/cliffy@v0.25.7/flags/_validate_flags.ts": "16eb5837986c6f6f7620817820161a78d66ce92d690e3697068726bbef067452", + "https://deno.land/x/cliffy@v0.25.7/flags/deprecated.ts": "a72a35de3cc7314e5ebea605ca23d08385b218ef171c32a3f135fb4318b08126", + "https://deno.land/x/cliffy@v0.25.7/flags/flags.ts": "68a9dfcacc4983a84c07ba19b66e5e9fccd04389fad215210c60fb414cc62576", + "https://deno.land/x/cliffy@v0.25.7/flags/types.ts": "7452ea5296758fb7af89930349ce40d8eb9a43b24b3f5759283e1cb5113075fd", + "https://deno.land/x/cliffy@v0.25.7/flags/types/boolean.ts": "4c026dd66ec9c5436860dc6d0241427bdb8d8e07337ad71b33c08193428a2236", + "https://deno.land/x/cliffy@v0.25.7/flags/types/integer.ts": "b60d4d590f309ddddf066782d43e4dc3799f0e7d08e5ede7dc62a5ee94b9a6d9", + "https://deno.land/x/cliffy@v0.25.7/flags/types/number.ts": "610936e2d29de7c8c304b65489a75ebae17b005c6122c24e791fbed12444d51e", + "https://deno.land/x/cliffy@v0.25.7/flags/types/string.ts": "e89b6a5ce322f65a894edecdc48b44956ec246a1d881f03e97bbda90dd8638c5", + "https://deno.land/x/cliffy@v0.25.7/table/border.ts": "2514abae4e4f51eda60a5f8c927ba24efd464a590027e900926b38f68e01253c", + "https://deno.land/x/cliffy@v0.25.7/table/cell.ts": "1d787d8006ac8302020d18ec39f8d7f1113612c20801b973e3839de9c3f8b7b3", + "https://deno.land/x/cliffy@v0.25.7/table/deps.ts": "5b05fa56c1a5e2af34f2103fd199e5f87f0507549963019563eae519271819d2", + "https://deno.land/x/cliffy@v0.25.7/table/layout.ts": "46bf10ae5430cf4fbb92f23d588230e9c6336edbdb154e5c9581290562b169f4", + "https://deno.land/x/cliffy@v0.25.7/table/mod.ts": "e74f69f38810ee6139a71132783765feb94436a6619c07474ada45b465189834", + "https://deno.land/x/cliffy@v0.25.7/table/row.ts": "5f519ba7488d2ef76cbbf50527f10f7957bfd668ce5b9169abbc44ec88302645", + "https://deno.land/x/cliffy@v0.25.7/table/table.ts": "ec204c9d08bb3ff1939c5ac7412a4c9ed7d00925d4fc92aff9bfe07bd269258d", + "https://deno.land/x/cliffy@v0.25.7/table/utils.ts": "187bb7dcbcfb16199a5d906113f584740901dfca1007400cba0df7dcd341bc29" + } +} diff --git a/cli/import_map.json b/cli/import_map.json new file mode 100644 index 0000000..4ea553f --- /dev/null +++ b/cli/import_map.json @@ -0,0 +1,7 @@ +{ + "imports": { + "cliffy/command": "https://deno.land/x/cliffy@v0.25.7/command/mod.ts", + "cliffy/table": "https://deno.land/x/cliffy@v0.25.7/table/mod.ts", + "lib/": "./lib/" + } +} diff --git a/cli/lib/file.ts b/cli/lib/file.ts new file mode 100644 index 0000000..ec42c1b --- /dev/null +++ b/cli/lib/file.ts @@ -0,0 +1,10 @@ +async function exists(path: string): Promise { + try { + const file = await Deno.stat(path); + return file.isFile || file.isDirectory; + } catch (_err) { + return false; + } +} + +export { exists }; diff --git a/cli/lib/healthcheck.ts b/cli/lib/healthcheck.ts new file mode 100644 index 0000000..b6afa6a --- /dev/null +++ b/cli/lib/healthcheck.ts @@ -0,0 +1,57 @@ +import { Table } from "cliffy/table"; +import { exists } from "lib/file.ts"; +import { LinkMap, linkMap } from "lib/linkMap.ts"; + +type TableBody = Array>; + +const healthyText = "✅"; +const unhealthyText = "❌"; + +async function healthcheck(linkMap: LinkMap) { + const header = ["Name", "Target", "Symlink", "Status", "Reason"]; + const body = await checkSymlinks(linkMap); + new Table() + .header(header) + .body(body) + .padding(1) + .indent(2) + .border(true) + .render(); +} + +async function checkSymlinks( + linkMap: LinkMap, +): Promise { + const result: TableBody = []; + for (const [name, config] of linkMap) { + const x: Array = []; + let reason = ""; + let healthy = ""; + + // check symlink and target exist + if (await exists(config.target) && await exists(config.symlink)) { + healthy = healthyText; + } else { + healthy = unhealthyText; + } + // check why it's unhealthy + if (!await exists(config.target) && !await exists(config.symlink)) { + reason = "Target and symlink do not exist"; + } else if (!await exists(config.target)) { + reason = "Target does not exist"; + } else if (!await exists(config.symlink)) { + reason = "Symlink does not exist"; + } else { + reason = ""; + } + x.push(name, config.target, config.symlink, healthy, reason); + result.push(x); + } + return result; +} + +export { healthcheck }; + +if (import.meta.main) { + console.log(await healthcheck(linkMap)); +} diff --git a/main.ts b/cli/lib/linkMap.ts similarity index 53% rename from main.ts rename to cli/lib/linkMap.ts index e972383..39b5d0d 100644 --- a/main.ts +++ b/cli/lib/linkMap.ts @@ -8,9 +8,11 @@ interface config { platform: platform; } +export type LinkMap = Map; + const home = Deno.env.get("HOME") || "~/"; const currentDir = Deno.cwd(); -const linkMap: Map = new Map([ +const linkMap: LinkMap = new Map([ ["neovim", { target: join(currentDir, "nvim"), symlink: join(home, ".config", "nvim"), @@ -48,48 +50,4 @@ const linkMap: Map = new Map([ }], ]); -function logo() { - console.log(` - - _ _ __ _ _ - __| | ___ | |_ / _(_) | ___ ___ - / _ |/ _ \\| __| |_| | |/ _ \\/ __| -| (_| | (_) | |_| _| | | __/\\__ \\ - \\__,_|\\___/ \\__|_| |_|_|\\___||___/ - - https://github.com/ucpr/dotfiles - -`); -} - -async function initialize() { - if (!await exists(join(home, ".config"))) { - await Deno.mkdir(join(home, ".config")); - } -} - -async function exists(path: string): Promise { - try { - const file = await Deno.stat(path); - return file.isFile || file.isDirectory; - } catch (_err) { - return false; - } -} - -if (import.meta.main) { - logo(); - - console.log("initializing..."); - await initialize(); - - for (const [key, value] of linkMap) { - console.log(`Linking ${key}...`); - if (await exists(value.symlink)) { - console.log(`${key} symlink already exists, skipping...`); - continue; - } - await Deno.symlink(value.target, value.symlink); - console.log(`Linked ${key}!`); - } -} +export { linkMap }; diff --git a/cli/lib/logo.ts b/cli/lib/logo.ts new file mode 100644 index 0000000..3499259 --- /dev/null +++ b/cli/lib/logo.ts @@ -0,0 +1,15 @@ +function logo() { + console.log(` + + _ _ __ _ _ + __| | ___ | |_ / _(_) | ___ ___ + / _ |/ _ \\| __| |_| | |/ _ \\/ __| +| (_| | (_) | |_| _| | | __/\\__ \\ + \\__,_|\\___/ \\__|_| |_|_|\\___||___/ + + https://github.com/ucpr/dotfiles + +`); +} + +export { logo }; diff --git a/cli/lib/setup.ts b/cli/lib/setup.ts new file mode 100644 index 0000000..f155e4a --- /dev/null +++ b/cli/lib/setup.ts @@ -0,0 +1,23 @@ +import { LinkMap } from "lib/linkMap.ts"; +import { exists } from "lib/file.ts"; + +async function initializeDirs() { + if (!await exists(join(home, ".config"))) { + await Deno.mkdir(join(home, ".config")); + } +} +async function setup(linkMap: LinkMap) { + await initializeDirs(); + + for (const [key, value] of linkMap) { + console.log(`Linking ${key}...`); + if (await exists(value.symlink)) { + console.log(`${key} symlink already exists, skipping...`); + continue; + } + await Deno.symlink(value.target, value.symlink); + console.log(`Linked ${key}!`); + } +} + +export { setup }; diff --git a/cli/main.ts b/cli/main.ts new file mode 100644 index 0000000..ee10228 --- /dev/null +++ b/cli/main.ts @@ -0,0 +1,27 @@ +import { Command } from "cliffy/command"; +import { healthcheck } from "lib/healthcheck.ts"; +import { setup } from "lib/setup.ts"; +import { logo } from "lib/logo.ts"; +import { linkMap } from "lib/linkMap.ts"; + +const cliName = "df-cli"; +const cliDescription = "Command line tool for ucpr's dotfiles management"; +const version = "0.1.0"; + +await new Command() + .name(cliName) + .version(version) + .description(cliDescription) + .command("logo", "Print the logo") + .action(() => { + logo(); + }) + .command("setup", "Setup the dotfiles") + .action(() => { + setup(linkMap); + }) + .command("healthcheck", "Check the health of the dotfiles") + .action(() => { + healthcheck(linkMap); + }) + .parse(Deno.args); -- knotmirror 0.0.1 From 1e67ff442d046978ff3c0b20bafc2b876879652a Mon Sep 17 00:00:00 2001 From: ucpr Date: Sun, 28 May 2023 16:58:58 +0900 Subject: [PATCH 2/5] ci: fix working dir --- .github/workflows/deno-ci.yaml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deno-ci.yaml b/.github/workflows/deno-ci.yaml index de3419b..1565728 100644 --- a/.github/workflows/deno-ci.yaml +++ b/.github/workflows/deno-ci.yaml @@ -8,23 +8,20 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] version: [vx.x.x] - runs-on: ${{ matrix.os }} - + defaults: + run: + working-directory: ./cli steps: - name: Checkout repo uses: actions/checkout@v3.5.2 - - name: Setup Deno uses: denoland/setup-deno@v1.1.2 with: deno-version: ${{ matrix.version }} - - name: Check format run: deno fmt --check - - name: Check lint run: deno lint - - name: Run run: make link -- knotmirror 0.0.1 From 587222be701d7315451305b60e5a7162d509d66e Mon Sep 17 00:00:00 2001 From: ucpr Date: Sun, 28 May 2023 17:00:54 +0900 Subject: [PATCH 3/5] ci: fix command --- .github/workflows/deno-ci.yaml | 2 +- Makefile | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deno-ci.yaml b/.github/workflows/deno-ci.yaml index 1565728..d38fa1b 100644 --- a/.github/workflows/deno-ci.yaml +++ b/.github/workflows/deno-ci.yaml @@ -24,4 +24,4 @@ jobs: - name: Check lint run: deno lint - name: Run - run: make link + run: make setup diff --git a/Makefile b/Makefile index 3ce013b..930af11 100644 --- a/Makefile +++ b/Makefile @@ -3,3 +3,9 @@ cli: IMPORT_MAP ?= --import-map=import_map.json cli: PERMISSIONS ?= --allow-env --allow-read --allow-write cli: cd cli && deno run $(IMPORT_MAP) $(PERMISSIONS) main.ts logo + +.PHONY: setup +setup: IMPORT_MAP ?= --import-map=import_map.json +setup: PERMISSIONS ?= --allow-env --allow-read --allow-write +setup: + cd cli && deno run $(IMPORT_MAP) $(PERMISSIONS) main.ts setup -- knotmirror 0.0.1 From 45c7b4000ea9a6c4219b1b022a6670537b8c6faa Mon Sep 17 00:00:00 2001 From: ucpr Date: Sun, 28 May 2023 17:10:24 +0900 Subject: [PATCH 4/5] fix: fix dotfiles dir --- cli/lib/linkMap.ts | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/cli/lib/linkMap.ts b/cli/lib/linkMap.ts index 39b5d0d..47f6c46 100644 --- a/cli/lib/linkMap.ts +++ b/cli/lib/linkMap.ts @@ -11,40 +11,55 @@ interface config { export type LinkMap = Map; const home = Deno.env.get("HOME") || "~/"; -const currentDir = Deno.cwd(); +const dotfilesDir = await (async (): Promise => { + const command = new Deno.Command( + "git", + { + args: ["rev-parse", "--show-toplevel"], + }, + ); + const { code, stdout, stderr } = await command.output(); + if (code === 0) { + return new TextDecoder().decode(stdout).trim(); + } else { + console.error(new TextDecoder().decode(stderr)); + return ""; + } +})(); + const linkMap: LinkMap = new Map([ ["neovim", { - target: join(currentDir, "nvim"), + target: join(dotfilesDir, "nvim"), symlink: join(home, ".config", "nvim"), platform: "common", }], ["wezterm", { - target: join(currentDir, "wezterm"), + target: join(dotfilesDir, "wezterm"), symlink: join(home, ".config", "wezterm"), platform: "common", }], [".zshrc", { - target: join(currentDir, ".zshrc"), + target: join(dotfilesDir, ".zshrc"), symlink: join(home, ".zshrc"), platform: "common", }], ["zsh", { - target: join(currentDir, "zsh"), + target: join(dotfilesDir, "zsh"), symlink: join(home, ".config", "zsh"), platform: "common", }], ["k9s", { - target: join(currentDir, "k9s"), + target: join(dotfilesDir, "k9s"), symlink: join(home, ".k9s"), platform: "common", }], ["gitconfig", { - target: join(currentDir, "git/.gitconfig"), + target: join(dotfilesDir, "git/.gitconfig"), symlink: join(home, ".gitconfig"), platform: "common", }], ["gitmessage", { - target: join(currentDir, "git/.gitmessage"), + target: join(dotfilesDir, "git/.gitmessage"), symlink: join(home, ".gitmessage"), platform: "common", }], -- knotmirror 0.0.1 From 99cc958eb0ec636d16c585be91ab87b4e4500a09 Mon Sep 17 00:00:00 2001 From: ucpr Date: Sun, 28 May 2023 17:11:29 +0900 Subject: [PATCH 5/5] fix: fix permission --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 930af11..892c9ed 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ .PHONY: cli cli: IMPORT_MAP ?= --import-map=import_map.json -cli: PERMISSIONS ?= --allow-env --allow-read --allow-write +cli: PERMISSIONS ?= --allow-env --allow-read --allow-write --allow-run cli: cd cli && deno run $(IMPORT_MAP) $(PERMISSIONS) main.ts logo .PHONY: setup setup: IMPORT_MAP ?= --import-map=import_map.json -setup: PERMISSIONS ?= --allow-env --allow-read --allow-write +setup: PERMISSIONS ?= --allow-env --allow-read --allow-write --allow-run setup: cd cli && deno run $(IMPORT_MAP) $(PERMISSIONS) main.ts setup -- knotmirror 0.0.1