From 759fd6cdfc02a5d159eea65f34fd1005b0f3ba99 Mon Sep 17 00:00:00 2001 From: Naoto Date: Sat, 22 Apr 2023 00:52:20 +0200 Subject: [PATCH] init --- volar-transpile.fish | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 volar-transpile.fish diff --git a/volar-transpile.fish b/volar-transpile.fish new file mode 100644 index 0000000..ca18d14 --- /dev/null +++ b/volar-transpile.fish @@ -0,0 +1,38 @@ +function generate_babel_config + echo -n '{ + "presets": ["@babel/preset-env"], + "targets": "node 13.13" + }' > babel.config.json +end + +function clean_babel_config + rm babel.config.json +end + +function extract_filenames + awk -F: '{print $1}' | sort | uniq +end + +function find_files + rg -uuu '\?\?' | rg '.js: ' | extract_filenames | rg -v 'ast\.js$' +end + +function transpile_file_list + xargs -I {} fish -c "babel '{}' --out-file '{}'; echo 'File {} done'" +end + +function transpile_dir + cd $argv[1] + generate_babel_config + find_files | transpile_file_list + clean_babel_config + cd - +end + +function transpile + transpile_dir $HOME/.bun/install/global/node_modules/vue-component-meta + transpile_dir $HOME/.bun/install/global/node_modules/@volar + transpile_dir $HOME/.bun/install/global/node_modules/@volar-plugins +end + +transpile