Skip to content

Commit 00bcccc

Browse files
Merge pull request #157 from hardy613/develop
fixes #156 DNT builds broken
2 parents efc347f + d2d95fa commit 00bcccc

32 files changed

Lines changed: 314 additions & 218 deletions

.github/DEVELOPMENT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ symbols.
4444
If you find a bug a test case is the right place to start. Test example:
4545

4646
```ts
47-
import { assertEquals, test } from "../test_deps.ts";
47+
import { assertEquals } from "@std/assert";
4848
import { Serializable, SerializeProperty } from "../mod.ts";
4949

50-
test({
50+
Deno.test({
5151
name: "Serialize nested",
5252
fn() {
5353
class Test1 extends Serializable {

.github/workflows/ts_serialize_release.yml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
deno: ["v1.x", "v2.x"]
15+
deno: ["v2.x"]
1616
os: [macOS-latest, windows-latest, ubuntu-latest]
1717

1818
steps:
@@ -25,17 +25,14 @@ jobs:
2525
deno-version: ${{ matrix.deno }}
2626

2727
- name: Deno lint
28-
run: deno lint -c tsconfig.json
28+
run: deno task lint
2929

3030
- name: Deno format check
31-
run: deno fmt --check -c tsconfig.json
31+
run: deno task fmt --check
3232
if: matrix.os != 'windows-latest'
3333

34-
- name: Cache dependencies
35-
run: deno cache test_deps.ts
36-
3734
- name: Run deno tests
38-
run: deno test --doc -c tsconfig.json
35+
run: deno task test --doc
3936

4037
build:
4138
name: Release
@@ -44,7 +41,7 @@ jobs:
4441

4542
strategy:
4643
matrix:
47-
deno: ["v1.x", "v2.x"]
44+
deno: ["v2.x"]
4845

4946
steps:
5047
- name: Get github tag
@@ -66,7 +63,7 @@ jobs:
6663
registry-url: https://registry.npmjs.org/
6764

6865
- name: Build and test NPM module
69-
run: ./_build_npm.ts -v ${{ steps.get_github_tag.outputs.VERSION }}
66+
run: deno task build -v ${{ steps.get_github_tag.outputs.VERSION }}
7067

7168
- name: Create release
7269
id: create_release

.github/workflows/ts_serialize_tests.yml

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,34 @@ on:
1212
branches: ["**"]
1313

1414
jobs:
15-
test:
15+
deno_v1:
1616
runs-on: ${{ matrix.os }}
1717

1818
strategy:
1919
matrix:
20-
deno: ["v1.x", "v2.x"]
20+
deno: [v1.x]
21+
os: [macOS-latest, windows-latest, ubuntu-latest]
22+
23+
steps:
24+
- name: Setup repo
25+
uses: actions/checkout@v2
26+
27+
- name: Setup deno
28+
uses: denolib/setup-deno@v2
29+
with:
30+
deno-version: ${{ matrix.deno }}
31+
32+
- name: Deno test
33+
run: deno test
34+
35+
deno_v2_and_up:
36+
runs-on: ${{ matrix.os }}
37+
38+
needs: deno_v1
39+
40+
strategy:
41+
matrix:
42+
deno: [v2.x]
2143
os: [macOS-latest, windows-latest, ubuntu-latest]
2244

2345
steps:
@@ -30,17 +52,23 @@ jobs:
3052
deno-version: ${{ matrix.deno }}
3153

3254
- name: Deno lint
33-
run: deno lint -c tsconfig.json
55+
run: deno task lint
3456

3557
- name: Deno format check
36-
run: deno fmt --check -c tsconfig.json
58+
run: deno task fmt --check
3759
if: matrix.os != 'windows-latest'
3860

39-
- name: Cache dependencies
40-
run: deno cache test_deps.ts
41-
4261
- name: Deno test
43-
run: deno test --doc -c tsconfig.json
62+
run: deno task test:coverage
63+
64+
- name: Generate coverage report
65+
run: deno task test:coverage:report
66+
67+
- name: Coverage report
68+
uses: VeryGoodOpenSource/very_good_coverage@v2
69+
with:
70+
path: ./coverage/lcov.info
71+
min_coverage: 100
4472

4573
- name: Setup node
4674
uses: actions/setup-node@v1
@@ -49,4 +77,5 @@ jobs:
4977
registry-url: https://registry.npmjs.org/
5078

5179
- name: Build and test NPM module
52-
run: ./_build_npm.ts
80+
run: deno task build
81+
if: matrix.os == 'ubuntu-latest'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
deno.d.ts
22
dist
3+
coverage
34
ts_serialize_coverage
45
ts_serialize_coverage.lcov
56
.DS_Store

.vscode/settings.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"deno.enable": true,
33
"deno.lint": true,
4-
"deno.unstable": [],
5-
"deno.config": "./tsconfig.json"
4+
"deno.unstable": []
65
}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ and this project adheres to
1010

1111
### Changed
1212

13+
- 100% test coverage
14+
- use deno `task` for tasks
15+
- remove `-c tsconfig` option from `deno` cli calls ... again
1316
- node/deno version in ci/cd
1417
- copyright year
1518
- support deno 2.x+
@@ -20,6 +23,13 @@ and this project adheres to
2023
- add member accessor for all classes
2124
- fix #151 Allow the fromSerializationStrategy to handle null in place of an
2225
serializable object.
26+
- test use the Deno.test function for shimmed tests with DNT
27+
- add deno.json
28+
- add deno.lock
29+
- remove test_deps.ts and test_deps_test.ts
30+
- add jsr:@std/assert
31+
- add jsr:@std/cli
32+
- add jsr:@deno/dnt
2333

2434
## [v2.0.1 - v2.0.3] - 2022-04-15
2535

SECURITY.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ Below is a table of supported versions.
44

55
## Supported Versions
66

7+
### ts_serialize
8+
79
| Version | Supported |
810
| ------- | ------------------ |
911
| 2.x | :white_check_mark: |
1012
| 1.x | :x: |
1113

14+
### Deno
15+
16+
| Version | Supported |
17+
| ------- | ------------------ |
18+
| 2.x | :white_check_mark: |
19+
| 1.x | :white_check_mark: |
20+
1221
## Reporting a Vulnerability
1322

1423
Please use our issue's page to create an issue or report a CVE. Thank you

_build_npm.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
#!/usr/bin/env -S deno run --allow-env --allow-read --allow-write --allow-run=npm,cmd --allow-net=deno.land
2-
1+
#!/usr/bin/env -S deno run --allow-env --allow-read --allow-write --allow-run=npm --allow-net=jsr.io
32
// Copyright 2018-2025 Gamebridge.ai authors. All rights reserved. MIT license.
43

5-
import { build, emptyDir } from "https://deno.land/x/dnt@0.22.0/mod.ts";
6-
import { parse } from "https://deno.land/std@0.133.0/flags/mod.ts";
4+
import { build, emptyDir } from "@deno/dnt";
5+
import { parseArgs } from "@std/cli";
76

87
const entryPointDefault = "./mod.ts";
98
const outDirDefault = "./dist";
@@ -36,7 +35,7 @@ function printHelpText(message = "") {
3635
Deno.exit(0);
3736
}
3837

39-
const flags = parse(Deno.args, {
38+
const flags = parseArgs(Deno.args, {
4039
string: ["v", "e", "o"],
4140
boolean: ["h"],
4241
alias: { h: "help", e: "entry-point", v: "version", o: "out" },
@@ -48,13 +47,16 @@ if (flags.h) {
4847
printHelpText();
4948
}
5049

50+
await Deno.remove(`${flags.o}`, { recursive: true }).catch((_) => {});
51+
5152
try {
5253
await emptyDir(flags.o);
5354

5455
await build({
56+
importMap: "./deno.json",
5557
entryPoints: [flags.e],
5658
outDir: flags.o,
57-
compilerOptions: { target: "ES2021" },
59+
compilerOptions: { lib: ["ESNext"], experimentalDecorators: true },
5860
shims: {
5961
deno: true,
6062
},
@@ -94,5 +96,6 @@ try {
9496
await Deno.copyFile("README.md", `${flags.o}/README.md`);
9597
await Deno.copyFile("CHANGELOG.md", `${flags.o}/CHANGELOG.md`);
9698
} catch (e) {
97-
printHelpText(e.message);
99+
const { message } = e instanceof Error ? e : { message: `${e}` };
100+
printHelpText(message);
98101
}

deno.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
{
2+
"imports": {
3+
"@deno/dnt": "jsr:@deno/dnt@^0.42.1",
4+
"@std/assert": "jsr:@std/assert@^1.0.13",
5+
"@std/cli": "jsr:@std/cli@^1.0.17"
6+
},
7+
"lock": false,
8+
"compilerOptions": {
9+
"experimentalDecorators": true
10+
},
11+
"fmt": {
12+
"include": ["./"],
13+
"exclude": ["./dist"]
14+
},
15+
"test": {
16+
"include": ["./"],
17+
"exclude": ["./dist"]
18+
},
19+
"lint": {
20+
"include": ["./"],
21+
"exclude": ["./dist"]
22+
},
23+
"typeCheck": {
24+
"include": ["./"],
25+
"exclude": ["./dist"]
26+
},
27+
"tasks": {
28+
"build": {
29+
"description": "Build the project for npm, pass in your flags to override the defaults",
30+
"command": "./_build_npm.ts -v v0.0.0-test -e ./mod.ts -o ./dist"
31+
},
32+
"lint": {
33+
"description": "Run linting",
34+
"command": "deno lint"
35+
},
36+
"fmt": {
37+
"description": "Run formatting",
38+
"command": "deno fmt"
39+
},
40+
"test": {
41+
"description": "Run tests",
42+
"command": "deno test --doc"
43+
},
44+
"test:coverage": {
45+
"description": "Run tests with coverage",
46+
"command": "deno test --coverage=coverage --doc"
47+
},
48+
"test:coverage:report": {
49+
"description": "Generate coverage report",
50+
"command": "deno coverage --lcov coverage > coverage/lcov.info"
51+
}
52+
}
53+
}

error_messages_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// Copyright 2018-2025 Gamebridge.ai authors. All rights reserved. MIT license.
22

3-
import { assert, assertEquals, test } from "./test_deps.ts";
3+
import { assert, assertEquals } from "@std/assert";
44
import * as mod from "./error_messages.ts";
55

6-
test({
6+
Deno.test({
77
name: "Error messages assertions",
88
fn() {
99
assert(mod != null);

0 commit comments

Comments
 (0)