Skip to content

Commit

Permalink
Modernize Deno settings and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlia committed Dec 27, 2024
1 parent a0490c2 commit 33f6e82
Show file tree
Hide file tree
Showing 15 changed files with 1,226 additions and 519 deletions.
23 changes: 14 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,31 @@ on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
deno-version: v1.x
deno-version: v2.x
- run: hooks/pre-commit

# TODO: matrix
release:
if: github.event_name == 'push'
needs: [lint]
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: denoland/setup-deno@v1
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
with:
deno-version: v1.x
deno-version: v2.x
- if: github.ref_type == 'tag'
uses: dahlia/submark/setup@0.3.1
- run: ./build.sh "$GITHUB_REF_NAME"
- if: github.ref_type == 'tag'
run: '[[ "$(jq -r .version deno.json)" = "$GITHUB_REF_NAME" ]]'
shell: bash
- run: ./build.sh
shell: bash
- uses: actions/upload-artifact@v3
with:
name: dist
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
dist/
node_modules/
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"denoland.vscode-deno"
]
}
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"deno.config": "./deno.jsonc",
"deno.enable": true,
"deno.lint": true,
"deno.unstable": false,
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
Changelog
=========

Version 0.1.1
Version 0.2.0
-------------

To be released.

- Now it rquires Deno 2.0.0 or higher.

- Fixed a broken *run.sh* script due to a typo. No more the below error:

~~~~
Expand Down
13 changes: 3 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@ declare -A targets=(
root_dir="$(dirname "$0")"
dist_dir=dist

if [[ -z "${1:-}" ]]; then
echo error: too few arguments
echo usage: "$(basename "$0")" VERSION
exit 1
fi >&2

version="$1"
version="$(deno eval 'import m from "./deno.json" with { type: "json" }; console.log(m.version)')"
mkdir -p "$dist_dir"
for target in "${!targets[@]}"; do
echo "Building for $target..." >&2
Expand All @@ -32,10 +26,9 @@ for target in "${!targets[@]}"; do
--allow-write \
--allow-env \
--allow-run \
--unstable \
--config="$root_dir/deno.jsonc" \
--allow-import \
--allow-sys \
--check \
--lock="$root_dir/lock.json" \
--target="$target" \
--output="$tmpdir/$bin_name" \
"$root_dir/main.ts"
Expand Down
10 changes: 7 additions & 3 deletions import_map.json → deno.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
{
"name": "@hongminhee/mediawiki-rc-mastodon-bot",
"version": "0.2.0",
"exports": "./main.ts",
"nodeModulesDir": "auto",
"imports": {
"std/async": "https://deno.land/std@0.163.0/async/mod.ts",
"std/log": "https://deno.land/std@0.163.0/log/mod.ts",
"std/fmt/bytes": "https://deno.land/std@0.163.0/fmt/bytes.ts",
"aitertools": "https://x.nest.land/aitertools@0.4.0-dev.17+c2d4dc3/mod.ts",
"puppeteer": "https://deno.land/x/puppeteer@16.2.0/mod.ts",
"aitertools": "jsr:@hongminhee/aitertools@0.6.0",
"puppeteer": "npm:puppeteer@23.11.1",
"license": "https://deno.land/x/foss_license_texts_esm@0.2.1/licenses/AGPL-3.0-or-later.mjs",
"masto": "https://cdn.skypack.dev/masto@4.3.4?dts",
"masto": "npm:masto@5.11.4",
"mustache": "https://deno.land/x/mustache@v0.3.0/mustache.mjs",
"cliffy/command": "https://deno.land/x/cliffy@v0.24.2/command/mod.ts"
}
Expand Down
4 changes: 0 additions & 4 deletions deno.jsonc

This file was deleted.

Loading

0 comments on commit 33f6e82

Please sign in to comment.