Skip to content

Commit

Permalink
feat: add nest.lang registry publication
Browse files Browse the repository at this point in the history
  • Loading branch information
srackham committed Sep 19, 2020
1 parent 20be87b commit 509cddd
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Drake Changelog

## 1.4.1 / 2020-09-??
- Publish Drake to [nest.land](https://nest.land/package/drake) (in addition to
[deno.land](https://deno.land/x/drake)).

## 1.4.0 / 2020-09-17
- Add `--cache FILE` command-line option.

Expand Down Expand Up @@ -49,7 +53,7 @@
- APIs that are can be used in non-drakefiles are exposed via `lib.ts`.
- Log message format consistency.
- Tightened `env` runtime parameter checks.
- A lot of code refactoring including spliting `deps.ts` into separate test and runtime deps.
- A lot of code refactoring including splitting `deps.ts` into separate test and runtime deps.
- Upgraded to Deno version 1.0.1, `std/0.52.0`.

## 1.0.0 / 2020-05-15
Expand Down
32 changes: 32 additions & 0 deletions Drakefile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
env,
glob,
quote,
readFile,
run,
sh,
task,
Expand Down Expand Up @@ -50,11 +51,21 @@ function checkVers(task: any) {
}
}

function checkEgg() {
const egg = JSON.parse(readFile("egg.json"));
if (env("vers") !== egg.version) {
abort(
`egg.json version ${egg.version} does not match version ${env("vers")}`,
);
}
}

desc(
"Create Git version number tag",
);
task("tag", ["test"], async function () {
checkVers(this);
checkEgg();
if (vers() !== env("vers")) {
abort(`${env("vers")} does not match version ${vers()} in mod.ts`);
}
Expand All @@ -68,4 +79,25 @@ task("push", ["test"], async function () {
await sh("git push -u --tags origin master");
});

desc("Publish tagged version to nest.land registry");
task("publish-nestland", [], async function () {
checkVers(this);
// Publication is staged from temporary directory.
const tmpDir = Deno.makeTempDirSync({ prefix: "drake-egg-" });
try {
await sh(`git clone . "${tmpDir}"`);
const savedDir = Deno.cwd();
try {
Deno.chdir(tmpDir);
await sh(`git checkout --quiet v${env("vers")}`);
checkEgg();
await sh("eggs publish");
} finally {
Deno.chdir(savedDir);
}
} finally {
Deno.removeSync(tmpDir, { recursive: true });
}
});

run();
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ A Drakefile uses Drake APIs imported from the Drake `mod.ts` module file. The mo

import { desc, run, task } from "https://deno.land/x/drake@v1.4.0/mod.ts";

- [nest.land](https://nest.land/package/drake) (a blockchain based Deno modules registry).
**NOTE**: Drake version numbers in `nest.land` URLs are not prefixed with a 'v' character:

import { desc, run, task } from "https://x.nest.land/drake@1.4.0/mod.ts";

Some Drake APIs are useful in non-drakefiles, use `lib.ts` (not `mod.ts`) to
import them into non-drakefile modules.

Expand Down
15 changes: 15 additions & 0 deletions egg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "drake",
"description": "Drake is a Make-like task runner for Deno",
"version": "1.4.1",
"stable": true,
"files": [
"mod.ts",
"lib.ts",
"CHANGELOG.md",
"LICENSE",
"README.md",
"lib/*.ts"
],
"repository": "https://github.com/srackham/drake"
}
1 change: 1 addition & 0 deletions examples/minimal-drakefile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { desc, run, task } from "https://deno.land/x/drake@v1.4.0/mod.ts";
// import { desc, run, task } from "https://x.nest.land/drake@1.3.2/mod.ts";

desc("Minimal Drake task");
task("hello", [], function () {
Expand Down

0 comments on commit 509cddd

Please sign in to comment.