Last active
June 7, 2021 14:29
-
-
Save neves/7469a0e433e49eb928bfb0cfad563b4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// este é o único arquivo que faz import externo | |
// assim as dependências ficam centralizadas em um único local | |
// também fica explício exatamente qual função está sendo utilizada de cada módulo | |
export * as v4 from "https://deno.land/std/uuid/v4.ts" | |
export { red } from "https://deno.land/std/fmt/colors.ts" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { red, v4 } from "./deps.js" | |
if (Deno.args.length === 0) { | |
console.log(` | |
Usage: (Add a UUID to the name of each param file) | |
deno run url/mod.js bundle.js bundle.css logo.png | |
`) | |
Deno.exit(1) | |
} | |
Deno.args | |
.map(addUUID) | |
.map(red) | |
.forEach(s => console.log(s)) | |
function addUUID(filename) { | |
const parts = filename.split(".") | |
const ext = parts.pop() | |
const name = parts.join(".") | |
const uuid = v4.generate() | |
return `${name}.${uuid}.${ext}` | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Para executar: