Skip to content

Commit 260f61c

Browse files
committed
feat: ci
1 parent 116f903 commit 260f61c

File tree

3 files changed

+82
-2
lines changed

3 files changed

+82
-2
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
deno-version: [v1.x]
15+
steps:
16+
- name: Git Checkout Deno Module
17+
uses: actions/checkout@v2
18+
- name: Use Deno Version ${{ matrix.deno-version }}
19+
uses: denoland/setup-deno@v1
20+
with:
21+
deno-version: ${{ matrix.deno-version }}
22+
- name: Format
23+
run: deno fmt --check
24+
- name: Lint
25+
run: deno lint
26+
- name: Unit Test
27+
run: deno test --coverage=coverage
28+
- name: Create coverage report
29+
run: deno coverage ./coverage --lcov > coverage.lcov
30+
- name: Collect coverage
31+
uses: codecov/[email protected]
32+
with:
33+
file: ./coverage.lcov
34+
- name: Build Module
35+
run: deno task build:npm

interpreter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export class Interpreter implements Runtime {
2121
decorateValue?: (value: FormatParameterValue) => unknown,
2222
): string {
2323
const [strings, values] = ast;
24-
let result = strings.at(0) ?? "";
24+
let result = strings[0] ?? "";
2525
values.forEach(([valueName, methods], valueIndex) => {
2626
const self = parameters[valueName];
2727

@@ -50,7 +50,7 @@ export class Interpreter implements Runtime {
5050
}
5151

5252
result += value && value.toString ? value.toString() : (value ?? "");
53-
result += strings.at(valueIndex + 1) ?? "";
53+
result += strings[valueIndex + 1] ?? "";
5454
});
5555
return result;
5656
}

scripts/build_npm.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { build, emptyDir } from "@deno/dnt";
2+
import { bgGreen } from "@std/fmt/colors";
3+
4+
const denoInfo = JSON.parse(
5+
Deno.readTextFileSync(new URL("../deno.json", import.meta.url)),
6+
);
7+
const version = denoInfo.version;
8+
9+
console.log(bgGreen(`version: ${version}`));
10+
11+
await emptyDir("./.npm");
12+
13+
await build({
14+
entryPoints: ["./mod.ts"],
15+
outDir: "./.npm",
16+
shims: {
17+
deno: false,
18+
},
19+
test: false,
20+
compilerOptions: {
21+
lib: ["ES2021", "DOM"],
22+
},
23+
package: {
24+
name: "intlit",
25+
version,
26+
description: "A comprehensive Intl formatter.",
27+
keywords: [
28+
"intl",
29+
"formatter",
30+
"i18n",
31+
"gettext",
32+
],
33+
license: "MIT",
34+
repository: {
35+
type: "git",
36+
url: "git+https://github.com/denostack/intlit.git",
37+
},
38+
bugs: {
39+
url: "https://github.com/denostack/intlit/issues",
40+
},
41+
},
42+
});
43+
44+
// post build steps
45+
Deno.copyFileSync("README.md", ".npm/README.md");

0 commit comments

Comments
 (0)