Switch from npm scripts to cargo-make tasks.
This commit is contained in:
parent
373d85a17b
commit
50d5b71d03
|
@ -0,0 +1,45 @@
|
||||||
|
# Build the package.
|
||||||
|
[tasks.build]
|
||||||
|
clear = true
|
||||||
|
dependencies = ["clean", "lint", "test", "build-types", "build-js"]
|
||||||
|
|
||||||
|
# Build the JavaScript.
|
||||||
|
[tasks.build-js]
|
||||||
|
clear = true
|
||||||
|
command = "pnpm"
|
||||||
|
args = ["tsx", "esbuild.ts"]
|
||||||
|
|
||||||
|
# Build the TypeScript type declarations.
|
||||||
|
[tasks.build-types]
|
||||||
|
clear = true
|
||||||
|
command = "pnpm"
|
||||||
|
args = ["tsc"]
|
||||||
|
|
||||||
|
# Clean the build directory.
|
||||||
|
[tasks.clean]
|
||||||
|
clear = true
|
||||||
|
command = "pnpm"
|
||||||
|
args = ["trash", "build/"]
|
||||||
|
|
||||||
|
# Run the full set of linting and testing.
|
||||||
|
[tasks.lint]
|
||||||
|
clear = true
|
||||||
|
dependencies = ["lint-js", "test"]
|
||||||
|
|
||||||
|
# Lint the TypeScript using XO.
|
||||||
|
[tasks.lint-js]
|
||||||
|
clear = true
|
||||||
|
command = "pnpm"
|
||||||
|
args = ["xo"]
|
||||||
|
|
||||||
|
# Run the tests.
|
||||||
|
[tasks.test]
|
||||||
|
clear = true
|
||||||
|
command = "pnpm"
|
||||||
|
args = ["tsx", "tests/index.ts"]
|
||||||
|
|
||||||
|
# Start a live-reloading server that watches for changes.
|
||||||
|
[tasks.watch]
|
||||||
|
clear = true
|
||||||
|
command = "pnpm"
|
||||||
|
args = ["vite"]
|
11
package.json
11
package.json
|
@ -4,10 +4,6 @@
|
||||||
"license": "AGPL-3.0-or-later",
|
"license": "AGPL-3.0-or-later",
|
||||||
"version": "0.2.1",
|
"version": "0.2.1",
|
||||||
"homepage": "https://git.bauke.xyz/Holllo/test",
|
"homepage": "https://git.bauke.xyz/Holllo/test",
|
||||||
"bugs": {
|
|
||||||
"email": "helllo@holllo.org",
|
|
||||||
"url": "https://github.com/Holllo/test/issues"
|
|
||||||
},
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
|
@ -17,16 +13,11 @@
|
||||||
"files": [
|
"files": [
|
||||||
"build/"
|
"build/"
|
||||||
],
|
],
|
||||||
"scripts": {
|
|
||||||
"build": "tsx esbuild.ts && tsc",
|
|
||||||
"dev": "vite",
|
|
||||||
"lint": "xo",
|
|
||||||
"test": "pnpm run build && tsx tests/index.ts && tsx tests/example.ts"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@bauke/eslint-config": "^0.1.2",
|
"@bauke/eslint-config": "^0.1.2",
|
||||||
"@bauke/prettier-config": "^0.1.2",
|
"@bauke/prettier-config": "^0.1.2",
|
||||||
"esbuild": "^0.16.10",
|
"esbuild": "^0.16.10",
|
||||||
|
"trash-cli": "^5.0.0",
|
||||||
"tsx": "^3.12.1",
|
"tsx": "^3.12.1",
|
||||||
"typescript": "^4.9.4",
|
"typescript": "^4.9.4",
|
||||||
"vite": "^4.0.2",
|
"vite": "^4.0.2",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import {setup} from "../build/index.js";
|
import {setup} from "../source/index.js";
|
||||||
|
|
||||||
const add = (a: number, b: number): number => a + b;
|
const add = (a: number, b: number): number => a + b;
|
||||||
|
|
||||||
void setup("add", async (group) => {
|
void setup("Example add", async (group) => {
|
||||||
group.test("1 + 1", async (test) => {
|
group.test("1 + 1", async (test) => {
|
||||||
test.equals(add(1, 1), 2);
|
test.equals(add(1, 1), 2);
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<script src="index.ts" type="module"></script>
|
<script src="index.ts" type="module"></script>
|
||||||
<script src="example.ts" type="module"></script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {setup} from "../source/index.js";
|
import {setup} from "../source/index.js";
|
||||||
|
|
||||||
await import("./assertions.js");
|
await import("./assertions.js");
|
||||||
|
await import("./example.js");
|
||||||
|
|
||||||
async function add(a: number, b: number): Promise<number> {
|
async function add(a: number, b: number): Promise<number> {
|
||||||
await new Promise<void>((resolve) => {
|
await new Promise<void>((resolve) => {
|
||||||
|
|
Loading…
Reference in New Issue