diff --git a/.github/tasuku.png b/.github/tasuku.png
deleted file mode 100644
index 5586108..0000000
Binary files a/.github/tasuku.png and /dev/null differ
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 849c7a2..49d7e0d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -26,6 +26,6 @@ jobs:
run: npm run test --if-present
- name: Release
env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
diff --git a/README.md b/README.md
index 864dc6f..d0961ac 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
- The minimal task runner
+ The minimal task runner for Node.js
### Features
@@ -11,6 +11,8 @@
- Unopinionated
- Type-safe
+→ [Try it out online](https://stackblitz.com/edit/tasuku-demo?file=index.js)
+
Support this project by starring and sharing it. [Follow me](https://github.com/privatenumber) to see what other cool projects I'm working on.
## Install
diff --git a/package.json b/package.json
index a4eb3da..6c8b9bc 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"scripts": {
"lint": "eslint .",
"test": "jest",
- "typecheck": "tsc --noEmit",
+ "typecheck": "tsc --noEmit && :",
"build": "rm -rf dist && tsup src/index.ts --dts --minify --no-splitting --external 'yoga-layout-prebuilt'"
},
"husky": {
@@ -44,7 +44,6 @@
"@types/jest": "^26.0.23",
"@types/node": "^15.6.1",
"@types/react": "^17.0.4",
- "dts": "^0.1.1",
"es-jest": "^1.2.0",
"eslint": "^7.24.0",
"esno": "^0.5.0",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3eeb529..a2bb05b 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -5,7 +5,6 @@ specifiers:
'@types/jest': ^26.0.23
'@types/node': ^15.6.1
'@types/react': ^17.0.4
- dts: ^0.1.1
es-jest: ^1.2.0
eslint: ^7.24.0
esno: ^0.5.0
@@ -29,7 +28,6 @@ devDependencies:
'@types/jest': 26.0.23
'@types/node': 15.6.1
'@types/react': 17.0.8
- dts: 0.1.1
es-jest: 1.2.0
eslint: 7.27.0
esno: 0.5.0
@@ -1599,10 +1597,6 @@ packages:
webidl-conversions: 5.0.0
dev: true
- /dts/0.1.1:
- resolution: {integrity: sha1-IFSAvC+IZhO91bZVQQefqoyD/5Q=}
- dev: true
-
/electron-to-chromium/1.3.743:
resolution: {integrity: sha512-K2wXfo9iZQzNJNx67+Pld0DRF+9bYinj62gXCdgPhcu1vidwVuLPHQPPFnCdO55njWigXXpfBiT90jGUPbw8Zg==}
dev: true
diff --git a/src/index.ts b/src/index.ts
index 648ed0f..b87b5d1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -36,18 +36,23 @@ const createTaskInnerApi = (taskState: TaskObject) => {
return api;
};
-type TaskFunction = (taskHelpers: ReturnType) => Promise;
+// Until full ESM
+// eslint-disable-next-line @typescript-eslint/no-namespace
+namespace task {
+ export type TaskInnerApi = ReturnType;
+ export type TaskFunction = (taskHelpers: TaskInnerApi) => Promise;
+}
-type TaskAPI = {
+type TaskApi = {
run: () => Promise>>;
clear: () => void;
};
type TaskResults<
- T extends TaskFunction,
- Tasks extends TaskAPI[]
+ T extends task.TaskFunction,
+ Tasks extends TaskApi[]
> = {
[key in keyof Tasks]: (
- Tasks[key] extends TaskAPI
+ Tasks[key] extends TaskApi
? Awaited>
: Tasks[key]
);
@@ -55,11 +60,11 @@ type TaskResults<
let app: ReturnType;
-function registerTask(
+function registerTask(
taskList: TaskList,
taskTitle: string,
taskFunction: T,
-): TaskAPI {
+): TaskApi {
if (!app) {
app = createApp(taskList);
taskList.isRoot = true;
@@ -105,7 +110,7 @@ function registerTask(
function createTaskFunction(
taskList: TaskList,
) {
- async function task(
+ async function task(
title: string,
taskFunction: T,
) {
@@ -118,7 +123,7 @@ function createTaskFunction(
);
}
- const createTask = (
+ const createTask = (
title: string,
taskFunction: T,
) => registerTask(
@@ -128,8 +133,8 @@ function createTaskFunction(
);
task.group = async <
- T extends TaskFunction,
- Tasks extends TaskAPI[]
+ T extends task.TaskFunction,
+ Tasks extends TaskApi[]
>(
createTasks: (taskCreator: typeof createTask) => readonly [...Tasks],
options?: Options,