39 lines
830 B
Fish
39 lines
830 B
Fish
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
|