Skip to content

Commit

Permalink
feat: 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorten committed Jan 3, 2022
1 parent 13a121e commit 7e2b0aa
Show file tree
Hide file tree
Showing 13 changed files with 51 additions and 23 deletions.
6 changes: 6 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# ChangeLog

## [2.0.0] - 03-01-2022

- feat: support Deno 1.17.1
- feat: upgrade std to 0.119.0
- feat: make generated dependencies use latest version

## [1.3.0] - 25-05-2021

- feat: support Deno 1.11.2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- run: make deps
- uses: denolib/setup-deno@v2
with:
deno-version: 1.11.2
deno-version: 1.17.1
- run: make typedoc
- run: make ci
- uses: stefanzweifel/git-auto-commit-action@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-egg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v2
- uses: denolib/setup-deno@v2
with:
deno-version: 1.11.2
- run: deno install -A -f --unstable -n eggs https://x.nest.land/eggs@0.3.8/eggs.ts
deno-version: 1.17.1
- run: deno install -A -f --unstable -n eggs https://x.nest.land/eggs@0.3.10/eggs.ts
- run: |
export PATH="/home/runner/.deno/bin:$PATH"
eggs link ${NEST_LAND_KEY}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
deno-version: [1.11.2]
deno-version: [1.17.1]

runs-on: ${{ matrix.os }}

Expand All @@ -25,7 +25,7 @@ jobs:
strategy:
matrix:
os: [windows-latest]
deno-version: [1.11.2]
deno-version: [1.17.1]

runs-on: ${{ matrix.os }}

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ fmt-check:
@deno fmt --check $(FILES_TO_FORMAT)

install:
@deno install -f -q --allow-read --allow-write --unstable ./opine-cli.ts
@deno install -f -q --allow-read --allow-write --allow-net --unstable ./opine-cli.ts

lint:
@deno lint --unstable $(FILES_TO_FORMAT)

test:
@deno test --allow-run --allow-read --allow-write ./test/
@deno test --allow-run --allow-read --allow-net --allow-write ./test/

typedoc:
@rm -rf docs
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
</p>
<p align="center">
<a href="https://deno.land/x/opinecli"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Flatest-version%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli latest /x/ version" /></a>
<a href="https://github.com/denoland/deno/blob/main/Releases.md"><img src="https://img.shields.io/badge/deno-^1.11.2-brightgreen?logo=deno" alt="Minimum supported Deno version" /></a>
<a href="https://github.com/denoland/deno/blob/main/Releases.md"><img src="https://img.shields.io/badge/deno-^1.17.1-brightgreen?logo=deno" alt="Minimum supported Deno version" /></a>
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/opinecli/opine-cli.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fdep-count%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli dependency count" /></a>
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/opinecli/opine-cli.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fupdates%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli dependency outdatedness" /></a>
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/opinecli/opine-cli.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fcache-size%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli cached size" /></a>
Expand All @@ -37,7 +37,7 @@
## Installation

```console
$ deno install -f -q --allow-read --allow-write --allow-net --unstable https://deno.land/x/opinecli@1.3.0/opine-cli.ts
$ deno install -f -q --allow-read --allow-write --allow-net --unstable https://deno.land/x/opinecli@2.0.0/opine-cli.ts
```

And follow any suggestions to update your `PATH` environment variable.
Expand Down
8 changes: 4 additions & 4 deletions deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export {
fromFileUrl,
join,
sep,
} from "https://deno.land/std@0.99.0/path/mod.ts";
export { Command } from "https://deno.land/x/cliffy@v0.19.2/command/mod.ts";
export { Confirm } from "https://deno.land/x/cliffy@v0.19.2/prompt/mod.ts";
export { renderToString } from "https://deno.land/x/dejs@0.9.3/mod.ts";
} from "https://deno.land/std@0.119.0/path/mod.ts";
export { Command } from "https://deno.land/x/cliffy@v0.20.1/command/mod.ts";
export { Confirm } from "https://deno.land/x/cliffy@v0.20.1/prompt/mod.ts";
export { renderToString } from "https://deno.land/x/dejs@0.10.2/mod.ts";
4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ <h1 align="center">Opine CLI</h1>
</p>
<p align="center">
<a href="https://deno.land/x/opinecli"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Flatest-version%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli latest /x/ version" /></a>
<a href="https://github.com/denoland/deno/blob/main/Releases.md"><img src="https://img.shields.io/badge/deno-^1.11.2-brightgreen?logo=deno" alt="Minimum supported Deno version" /></a>
<a href="https://github.com/denoland/deno/blob/main/Releases.md"><img src="https://img.shields.io/badge/deno-^1.17.1-brightgreen?logo=deno" alt="Minimum supported Deno version" /></a>
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/opinecli/opine-cli.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fdep-count%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli dependency count" /></a>
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/opinecli/opine-cli.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fupdates%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli dependency outdatedness" /></a>
<a href="https://deno-visualizer.danopia.net/dependencies-of/https/deno.land/x/opinecli/opine-cli.ts"><img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Fcache-size%2Fx%2Fopinecli%2Fopine-cli.ts" alt="opine-cli cached size" /></a>
Expand All @@ -101,7 +101,7 @@ <h2>Table of Contents</h2>
<a href="#installation" id="installation" style="color: inherit; text-decoration: none;">
<h2>Installation</h2>
</a>
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> deno install -f -q --allow-read --allow-write --allow-net --unstable https://deno.land/x/opinecli@1.3.0/opine-cli.ts</span>
<pre><code class="language-console"><span class="hljs-meta">$</span><span class="bash"> deno install -f -q --allow-read --allow-write --allow-net --unstable https://deno.land/x/opinecli@2.0.0/opine-cli.ts</span>
</code></pre>
<p>And follow any suggestions to update your <code>PATH</code> environment variable.</p>
<a href="#quick-start" id="quick-start" style="color: inherit; text-decoration: none;">
Expand Down
2 changes: 1 addition & 1 deletion egg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opinecli",
"description": "Opine's application generator.",
"version": "1.3.0",
"version": "2.0.0",
"repository": "https://github.com/cmorten/opine-cli",
"stable": true,
"entry": "./opine-cli.ts",
Expand Down
25 changes: 23 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,16 @@ async function createApplication(

switch (program.options.view) {
case "eta": {
const etaVersion = await getLatestVersion(
"https://deno.land/x/eta/mod.ts",
);
app.locals.view = {
engine: "eta",
render: "renderFile",
};
deps.locals.view = {
render:
`export { renderFile } from "https://deno.land/x/eta@v1.12.2/mod.ts";`,
`export { renderFile } from "https://deno.land/x/eta${etaVersion}/mod.ts";`,
};

flags += " --unstable";
Expand All @@ -161,13 +164,16 @@ async function createApplication(
}
case "ejs":
default: {
const ejsVersion = await getLatestVersion(
"https://deno.land/x/dejs/mod.ts",
);
app.locals.view = {
engine: "ejs",
render: "renderFileToString",
};
deps.locals.view = {
render:
`export { renderFileToString } from "https://deno.land/x/dejs@0.9.3/mod.ts";`,
`export { renderFileToString } from "https://deno.land/x/dejs${ejsVersion}/mod.ts";`,
};

copyTemplateMulti(
Expand All @@ -189,6 +195,13 @@ async function createApplication(
await copyTemplate("js/gitignore", join(directory, ".gitignore"));
}

deps.locals.opineVersion = await getLatestVersion(
"https://deno.land/x/opine/mod.ts",
);
deps.locals.stdVersion = await getLatestVersion(
"https://deno.land/std/version.ts",
);

write(join(directory, "app.ts"), await app.render());
write(join(directory, "deps.ts"), await deps.render());

Expand Down Expand Up @@ -347,3 +360,11 @@ function getTemplateDirectory(): string {

return join(__dirname, "templates");
}

async function getLatestVersion(moduleUrl: string): Promise<string> {
const res = await fetch(moduleUrl);

await res.text();

return res.url.match(/\/.*(@.*)\//)?.[1] ?? "";
}
6 changes: 3 additions & 3 deletions src/templates/js/deps.ts.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ export {
dirname,
fromFileUrl,
join,
} from "https://deno.land/std@0.99.0/path/mod.ts";
} from "https://deno.land/std<%- stdVersion %>/path/mod.ts";
export {
json,
opine,
Router,
serveStatic,
urlencoded,
} from "https://deno.land/x/opine@1.5.3/mod.ts";
<% if (view) { %>export type { ErrorRequestHandler } from "https://deno.land/x/opine@1.5.3/mod.ts";
} from "https://deno.land/x/opine<%- opineVersion %>/mod.ts";
<% if (view) { %>export type { ErrorRequestHandler } from "https://deno.land/x/opine<%- opineVersion %>/mod.ts";
export { createError } from "https://deno.land/x/http_errors@2.1.0/mod.ts";<% } %>
<% if (view) { %><% if (view.render) { %><%- view.render %><% } %><% } %>
1 change: 1 addition & 0 deletions test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const denoRunCommandPrefix = [
"run",
"--allow-read",
"--allow-write",
"--allow-net",
"--unstable",
];

Expand Down
4 changes: 2 additions & 2 deletions version.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Version of Opine CLI.
*/
export const VERSION = "1.3.0";
export const VERSION = "2.0.0";

/**
* Supported version of Deno.
*/
export const DENO_SUPPORTED_VERSIONS = ["1.11.2"];
export const DENO_SUPPORTED_VERSIONS = ["1.17.1"];

0 comments on commit 7e2b0aa

Please sign in to comment.