Skip to content

Instantly share code, notes, and snippets.

@neves
Last active June 7, 2021 14:29
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neves/7469a0e433e49eb928bfb0cfad563b4a to your computer and use it in GitHub Desktop.
Save neves/7469a0e433e49eb928bfb0cfad563b4a to your computer and use it in GitHub Desktop.
// 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"
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}`
}
@neves
Copy link
Author

neves commented May 25, 2020

Para executar:

deno run \
https://gist.githubusercontent.com/neves/7469a0e433e49eb928bfb0cfad563b4a/raw/e6dbc45c484d028c83081ff69f996242f795b912/mod.js \
*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment