Skip to content

Commit edc6363

Browse files
committed
feat: Adds support to load from a local directory
1 parent 84cc03a commit edc6363

File tree

13 files changed

+430
-115
lines changed

13 files changed

+430
-115
lines changed

.changeset/strong-trains-look.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
"@taskless/loader": patch
3+
---
4+
5+
- **Load a directory** - If you specify `TASKLESS_DIRECTORY` (autoloader), or use `directory` in the programatic API, the loader will attempt to load any installed packs from disk in addition to any network packs. This can be used to load packs without interacting with Taskless Cloud.
6+
7+
- **Deprecation** of `TASKLESS_OPTIONS` - The taskless options environment variable has been deprecated in favor of using individual `TASKLESS_*` flags.
8+
- `network` and `logging` are now expressed as `TASKLESS_OUTPUT` and can be expressed as a comma separated list. For example `TASKLESS_OUTPUT=network,console`. The default with an API key is `network`, and the default without an API key is `console`. If this value is set, it will override the default behavior. `network` and `logging` will be removed in the next release.

examples/programatic.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { readFileSync } from "fs";
22
import { resolve } from "path";
3-
import { packageDirectorySync } from "pkg-dir";
3+
import { packageDirectorySync } from "package-directory";
44

55
// import { taskless } from "@taskless/core";
6-
import { taskless, type Manifest } from "../src/core.js";
6+
import { Pack, taskless, type Manifest } from "../src/core.js";
77

88
/**
99
* pnpm tsx --import="./examples/programatic.ts" examples/basic.ts
@@ -26,20 +26,16 @@ const file = readFileSync(
2626
)
2727
);
2828

29-
const manifest: Manifest = {
29+
const manifest: Pack = {
3030
schema: "pre2",
3131
name: "@taskless/example",
3232
version: "1.0.0",
3333
description: "Basic telemetry example, showing a programatic manifest",
3434
permissions: {},
35-
fields: [
36-
{
37-
name: "enableStatus",
38-
type: "boolean",
39-
description: "Enable status logging",
40-
default: true,
41-
},
42-
],
35+
url: {
36+
source: "file://.empty",
37+
signature: "",
38+
},
4339
};
4440

4541
const t = taskless(process.env.TASKLESS_API_KEY);

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@
4343
],
4444
"dependencies": {
4545
"@extism/extism": "2.0.0-rc13",
46+
"dotenv": "^16.6.0",
4647
"fets": "^0.8.5",
48+
"glob": "^11.0.3",
4749
"msw": "^2.8.2",
48-
"pkg-dir": "^8.0.0",
4950
"uint8array-extras": "^1.4.0",
5051
"uuid": "^11.1.0"
5152
},
@@ -63,6 +64,7 @@
6364
"json-schema-to-typescript": "^15.0.3",
6465
"lint-staged": "^15.2.4",
6566
"mkdirp": "^3.0.1",
67+
"package-directory": "^8.1.0",
6668
"prettier": "^3.2.5",
6769
"rimraf": "^6.0.1",
6870
"syncpack": "^12.3.2",

pnpm-lock.yaml

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

scripts/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import process from "node:process";
66
import { TASKLESS_HOST } from "@~/constants.js";
77
import { compile, type JSONSchema } from "json-schema-to-typescript";
88
import { mkdirp } from "mkdirp";
9-
import { packageDirectory } from "pkg-dir";
9+
import { packageDirectory } from "package-directory";
1010
import prettier from "prettier";
1111
import { rimraf } from "rimraf";
1212

0 commit comments

Comments
 (0)