8000 GitHub - jespertheend/dev: Run first time setup within your development script
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jespertheend/dev

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dev

This module allows you to run several actions and cache the result. The idea is to use this as a 'first time setup' script within the script you use for starting a local development server.

For instance, say you have a development script dev.ts that starts a local http/websocket server or starts watching some files. But your project depends on some remote files, maybe you have some client code that runs in the browser for example. You could create a separate script like install.ts or init.ts, and ask all contributors to run this when they start working on the project. But contributors will have to run it again every time something is changed.

So instead, this module allows you to perform these steps inside the dev.ts script. So that things are kept up to date at all times. To prevent these steps from being run every time you start dev.ts, the results are cached, and only if something is changed will steps be performed again.

Usage

import { downloadFile, downloadNpmPackage, vendor } from "https://deno.land/x/dev@v0.4.0/mod.js";
import { dev } from "https://deno.land/x/dev/mod.js";
import { serve } from "https://deno.land/std/http/server.ts";
import { serveDir } from "https://deno.land/std/http/file_server.ts";

await downloadFile({
	url: "https://example.com/shim.js",
	destination: "path/to/frontend/deps/shim.js",
});
await downloadNpmPackage({
	package: "package-name@1.2.3",
	destination: "path/to/backend/deps/package-name/1.2.3",
});
await vendor({
	outDir: "path/to/backend/deps/vendor/",
	entryPoints: [
		"https://example.com/someLibrary.js",
	],
});

serve((req) => {
	return serveDir(req, {
		fsRoot: "path/to/frontend",
	});
});

About

Run first time setup within your development script

Resources

License

Stars

Watchers

Forks

Packages

No packages published
0