Skip to content

Commit a4930f7

Browse files
feat: [RUN-130] Update to Deno 2 (#39)
1 parent e6c87be commit a4930f7

File tree

12 files changed

+197
-199
lines changed

12 files changed

+197
-199
lines changed

.buildkite/pipeline.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ common:
22
- deno_matrix: &deno_matrix
33
matrix:
44
# - "ubuntu"
5-
- "ubuntu-1.42.1"
5+
- "ubuntu-2.0.4"
66
plugins:
77
- docker#v5.10.0:
88
image: "denoland/deno:{{matrix}}"
@@ -51,14 +51,14 @@ steps:
5151
label: ":godmode: test project minimal"
5252
build:
5353
message: "test runreal ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}"
54-
env:
54+
env:
5555
RUNREAL_FROM_SOURCE: true
5656
RUNREAL_FROM_REF: $BUILDKITE_COMMIT
5757
- trigger: "test-project-minimal-p4"
5858
label: ":godmode: test project minimal [p4]"
5959
build:
6060
message: "test runreal ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}"
61-
env:
61+
env:
6262
RUNREAL_FROM_SOURCE: true
6363
RUNREAL_FROM_REF: $BUILDKITE_COMMIT
6464

@@ -71,13 +71,13 @@ steps:
7171
label: ":goberserk: test project full"
7272
build:
7373
message: "test runreal ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}"
74-
env:
74+
env:
7575
RUNREAL_FROM_SOURCE: true
7676
RUNREAL_FROM_REF: $BUILDKITE_COMMIT
7777
- trigger: "test-project-full-p4"
7878
label: ":goberserk: test project full [p4]"
7979
build:
8080
message: "test runreal ${BUILDKITE_BRANCH}-${BUILDKITE_COMMIT}"
81-
env:
81+
env:
8282
RUNREAL_FROM_SOURCE: true
8383
RUNREAL_FROM_REF: $BUILDKITE_COMMIT

.github/workflows/generate-schema.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
deno-version: [1.41.3]
19+
deno-version: [2.0.4]
2020

2121
steps:
2222
- name: Checkout
@@ -25,7 +25,7 @@ jobs:
2525
ref: ${{ github.event.pull_request.head.ref }}
2626

2727
- name: Setup Deno ${{ matrix.deno-version }}
28-
uses: denoland/setup-deno@v1
28+
uses: denoland/setup-deno@v2
2929
with:
3030
deno-version: ${{ matrix.deno-version }}
3131
- name: Run generate-schema

.github/workflows/release.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ env:
1515
jobs:
1616
release:
1717
runs-on: ubuntu-latest
18-
18+
1919
strategy:
2020
matrix:
21-
deno-version: [1.42.1]
21+
deno-version: [2.0.4]
2222

2323
steps:
2424
- uses: google-github-actions/release-please-action@v3
@@ -34,13 +34,13 @@ jobs:
3434
3535
- uses: actions/checkout@v4
3636
if: ${{ steps.release.outputs.release_created }}
37-
37+
3838
- name: Setup Deno ${{ matrix.deno-version }}
3939
if: ${{ steps.release.outputs.release_created }}
40-
uses: denoland/setup-deno@v1
40+
uses: denoland/setup-deno@v2
4141
with:
4242
deno-version: ${{ matrix.deno-version }}
43-
43+
4444
- name: Deno Compile [windows]
4545
if: ${{ steps.release.outputs.release_created }}
4646
run: deno task compile-win
@@ -59,7 +59,7 @@ jobs:
5959
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6060
run: gh release upload ${{ steps.release.outputs.tag_name }} ./build/runreal-win-x64.exe ./build/runreal-macos-arm ./build/runreal-linux-x64 schema.json
6161

62-
- name: Cache Deno dependencies
62+
- name: Cache Deno dependencies
6363
if: ${{ steps.release.outputs.release_created }}
6464
uses: actions/cache@v3
6565
with:

deno.jsonc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,16 @@
2525
"singleQuote": true,
2626
"proseWrap": "preserve",
2727
"semiColons": false
28+
},
29+
"imports": {
30+
"@cliffy/command": "jsr:@cliffy/command@1.0.0-rc.7",
31+
"@rebeccastevens/deepmerge": "jsr:@rebeccastevens/deepmerge@^7.1.3",
32+
"@std/assert": "jsr:@std/assert@^1.0.6",
33+
"@std/dotenv": "jsr:@std/dotenv@^0.225.2",
34+
"@std/fmt": "jsr:@std/fmt@^1.0.3",
35+
"@std/jsonc": "jsr:@std/jsonc@^1.0.1",
36+
"@std/path": "jsr:@std/path@^1.0.7",
37+
"@std/streams": "jsr:@std/streams@^1.0.7",
38+
"@std/testing": "jsr:@std/testing@^1.0.3",
2839
}
2940
}

deno.lock

Lines changed: 151 additions & 169 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/commands/workflow/exec.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ async function executeCommand(step: { command: string; args: string[] }) {
2424
await execCmd(baseCmd, [...step.command.split(' ').slice(1), ...step.args])
2525
}
2626
} catch (e) {
27-
console.log(`[error] failed to exec :runreal ${step.command} ${step.args.join(' ')}: => ${e.message}`)
27+
if (e instanceof Error) {
28+
console.log(`[error] failed to exec :runreal ${step.command} ${step.args.join(' ')}: => ${e.message}`)
29+
}
2830
throw e
2931
}
3032
}
@@ -50,7 +52,7 @@ export const exec = new Command<GlobalOptions>()
5052
.description('run')
5153
.arguments('<workflow>')
5254
.action(async (options, workflow) => {
53-
const { dryRun, mode } = options as ExecOptions
55+
const { dryRun, mode } = options
5456
const cfg = config.get(options as CliOptions) as any
5557

5658
const run = cfg.workflows.find((w: any) => w.name === workflow)

src/deps.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1-
export * as path from 'https://deno.land/std@0.222.1/path/mod.ts'
2-
export { mergeReadableStreams } from 'https://deno.land/std@0.204.0/streams/merge_readable_streams.ts'
3-
export * as fmt from 'https://deno.land/std@0.204.0/fmt/colors.ts'
4-
export * as dotenv from 'https://deno.land/std@0.204.0/dotenv/mod.ts'
5-
export { parse } from 'https://deno.land/std@0.204.0/jsonc/parse.ts'
1+
export * as path from 'jsr:@std/path'
2+
export { mergeReadableStreams } from 'jsr:@std/streams'
3+
4+
export * as dotenv from 'jsr:@std/dotenv'
5+
export * as fmt from 'jsr:@std/fmt/colors'
6+
7+
export { parse } from 'jsr:@std/jsonc'
8+
// Maybe use npm specifier
69

710
export { xml2js } from 'https://deno.land/x/xml2js@1.0.0/mod.ts'
8-
export { Command, EnumType, ValidationError } from 'https://deno.land/x/cliffy@v1.0.0-rc.3/command/mod.ts'
9-
export { deepmerge } from 'https://deno.land/x/deepmergets@v5.1.0/dist/deno/index.ts'
11+
export { Command, EnumType, ValidationError } from 'jsr:@cliffy/command@1.0.0-rc.7'
12+
export { deepmerge } from 'jsr:@rebeccastevens/deepmerge'
1013
export { readNdjson } from 'https://deno.land/x/ndjson@1.1.0/mod.ts'
1114

1215
import { monotonicFactory } from 'https://deno.land/x/ulid@v0.3.0/mod.ts'
1316
const ulid = monotonicFactory()
1417
export { ulid }
1518

16-
export { z } from 'https://deno.land/x/zod@v3.22.4/mod.ts'
19+
export { z } from 'https://deno.land/x/zod@v3.23.8/mod.ts'
1720
export { globber } from 'https://deno.land/x/globber@0.1.0/mod.ts'
1821
export { zodToJsonSchema } from 'npm:zod-to-json-schema'

src/lib/source.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export class Perforce extends Base {
6565
}
6666
return parts.join('/')
6767
}
68-
safeRef(): string {
68+
override safeRef(): string {
6969
return this.changelist()
7070
}
7171
safeFullRef(): string {

src/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ export class DefaultMap<K, V> extends Map<K, V> {
351351
super(entries)
352352
}
353353

354-
get(key: K): V {
354+
override get(key: K): V {
355355
if (!super.has(key)) {
356356
super.set(key, this.defaultFn(key))
357357
}

tests/config.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { assert, assertEquals } from 'https://deno.land/std/assert/mod.ts'
1+
import { assert, assertEquals } from '@std/assert'
22
import { Config } from '../src/lib/config.ts'
33
import { path, ulid } from '../src/deps.ts'
44
import { CliOptions } from '../src/lib/types.ts'
5-
import { FakeTime } from 'https://deno.land/std@0.224.0/testing/time.ts'
5+
import { FakeTime } from '@std/testing/time'
66

77
Deno.test('Config.create should initialize with default values', async () => {
88
using time = new FakeTime()

0 commit comments

Comments
 (0)