Skip to content

Commit a889953

Browse files
committed
chore: remove sys-node package & add readmes
1 parent d769bf3 commit a889953

20 files changed

Lines changed: 299 additions & 155 deletions

File tree

packages/client/src/__tests__/core/error-structure.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { msgpackDecode, msgpackEncode } from "@polywrap/msgpack-js";
1010
import {
1111
ClientConfigBuilder,
1212
} from "@polywrap/client-config-builder-js";
13-
import * as SysNodeBundle from "@polywrap/sys-node-config-bundle-js";
13+
import * as SysBundle from "@polywrap/sys-config-bundle-js";
1414

1515
jest.setTimeout(660000);
1616

@@ -415,7 +415,7 @@ describe("Error structure", () => {
415415
test("Invoke a plugin wrapper with malformed args", async () => {
416416
const client = await createClient();
417417
const result = await client.invoke<Uint8Array>({
418-
uri: SysNodeBundle.bundle.fileSystem.uri,
418+
uri: SysBundle.bundle.fileSystem.uri,
419419
method: "readFile",
420420
args: {
421421
pathh: "packages/client/src/__tests__/core/index.ts",
@@ -432,7 +432,7 @@ describe("Error structure", () => {
432432
expect(result.error?.reason).toEqual(
433433
'The "path" argument must be of type string or an instance of Buffer or URL. Received undefined'
434434
);
435-
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.bundle.fileSystem.uri).uri);
435+
expect(result.error?.uri).toEqual(Uri.from(SysBundle.bundle.fileSystem.uri).uri);
436436
expect(result.error?.method).toEqual("readFile");
437437
expect(result.error?.args).toContain(
438438
'{\n "pathh": "packages/client/src/__tests__/core/index.ts"\n}'
@@ -445,7 +445,7 @@ describe("Error structure", () => {
445445
test("Invoke a plugin wrapper with a method that doesn't exist", async () => {
446446
const client = await createClient();
447447
const result = await client.invoke<Uint8Array>({
448-
uri: SysNodeBundle.bundle.fileSystem.uri,
448+
uri: SysBundle.bundle.fileSystem.uri,
449449
method: "readFileNotFound",
450450
args: {
451451
path: __dirname + "/index.ts",
@@ -462,7 +462,7 @@ describe("Error structure", () => {
462462
expect(
463463
result.error?.reason.startsWith("Plugin missing method ")
464464
).toBeTruthy();
465-
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.bundle.fileSystem.uri).uri);
465+
expect(result.error?.uri).toEqual(Uri.from(SysBundle.bundle.fileSystem.uri).uri);
466466
expect(result.error?.method).toEqual("readFileNotFound");
467467
});
468468

@@ -494,7 +494,7 @@ describe("Error structure", () => {
494494
test("Invoke a plugin wrapper that throws unexpectedly", async () => {
495495
const client = await createClient();
496496
const result = await client.invoke<Uint8Array>({
497-
uri: SysNodeBundle.bundle.fileSystem.uri,
497+
uri: SysBundle.bundle.fileSystem.uri,
498498
method: "readFile",
499499
args: {
500500
path: "./this/path/does/not/exist.ts",
@@ -511,7 +511,7 @@ describe("Error structure", () => {
511511
expect(
512512
result.error?.reason.startsWith("ENOENT: no such file or directory")
513513
).toBeTruthy();
514-
expect(result.error?.uri).toEqual(Uri.from(SysNodeBundle.bundle.fileSystem.uri).uri);
514+
expect(result.error?.uri).toEqual(Uri.from(SysBundle.bundle.fileSystem.uri).uri);
515515
expect(result.error?.method).toEqual("readFile");
516516
expect(result.error?.args).toEqual(
517517
'{\n "path": "./this/path/does/not/exist.ts"\n}'

packages/config-builder/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Finally, build a ClientConfig or CoreClientConfig to pass to the PolywrapClient
6969

7070
A complete example using all or most of the available methods.
7171

72-
```typescript=
72+
```typescript
7373
// init
7474
const builder = new ClientConfigBuilder();
7575

packages/config-builder/readme/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $snippet: quickstart-build
4040

4141
A complete example using all or most of the available methods.
4242

43-
```typescript=
43+
```typescript
4444
$snippet: quickstart-example
4545
```
4646

packages/config-bundles/sys-node/package.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

packages/config-bundles/sys-node/scripts/embed-wraps.ts

Lines changed: 0 additions & 69 deletions
This file was deleted.

packages/config-bundles/sys-node/src/declarations.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/config-bundles/sys-node/src/index.ts

Lines changed: 0 additions & 23 deletions
This file was deleted.

packages/config-bundles/sys-node/tsconfig.json

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Sys Config Bundle
2+
3+
A collection of system-level configurations.
4+
5+
## Bundle
6+
7+
```typescript
8+
import { loggerPlugin } from "@polywrap/logger-plugin-js";
9+
import { dateTimePlugin } from "@polywrap/datetime-plugin-js";
10+
import { concurrentPromisePlugin } from "@polywrap/concurrent-plugin-js";
11+
import { httpPlugin } from "@polywrap/http-plugin-js";
12+
import * as httpResolver from "./embeds/http-resolver/wrap";
13+
14+
export const bundle: Bundle = {
15+
logger: {
16+
uri: "plugin/logger@1.0.0",
17+
package: loggerPlugin({}),
18+
implements: ["ens/wraps.eth:logger@1.0.0"],
19+
redirectFrom: ["ens/wraps.eth:logger@1.0.0"],
20+
},
21+
datetime: {
22+
uri: "plugin/datetime@1.0.0",
23+
package: dateTimePlugin({}),
24+
implements: ["ens/wraps.eth:datetime@1.0.0"],
25+
redirectFrom: ["ens/wraps.eth:datetime@1.0.0"],
26+
},
27+
concurrent: {
28+
uri: "plugin/concurrent@1.0.0",
29+
package: concurrentPromisePlugin({}),
30+
implements: ["ens/wraps.eth:concurrent@1.0.0"],
31+
redirectFrom: ["ens/wraps.eth:concurrent@1.0.0"],
32+
},
33+
http: {
34+
uri: "plugin/http@1.1.0",
35+
package: httpPlugin({}),
36+
implements: ["ens/wraps.eth:http@1.1.0", "ens/wraps.eth:http@1.0.0"],
37+
redirectFrom: ["ens/wraps.eth:http@1.1.0", "ens/wraps.eth:http@1.0.0"],
38+
},
39+
httpResolver: {
40+
uri: "embed/http-uri-resolver-ext@1.0.1",
41+
package: httpResolver.wasmPackage,
42+
implements: [
43+
"ens/wraps.eth:http-uri-resolver-ext@1.0.1",
44+
ExtendableUriResolver.defaultExtInterfaceUris[0].uri,
45+
],
46+
redirectFrom: ["ens/wraps.eth:http-uri-resolver-ext@1.0.1"],
47+
},
48+
};
49+
```
50+
51+
### Node.JS
52+
53+
If you're using this package within Node.JS, you'll also have the following configurations:
54+
```typescript
55+
import { fileSystemPlugin } from "@polywrap/file-system-plugin-js";
56+
import * as fileSystemResolver from "./embeds/file-system-resolver/wrap";
57+
58+
export const bundle: Bundle = {
59+
...Common.bundle,
60+
fileSystem: {
61+
uri: "plugin/file-system@1.0.0",
62+
package: fileSystemPlugin({}),
63+
implements: ["ens/wraps.eth:file-system@1.0.0"],
64+
redirectFrom: ["ens/wraps.eth:file-system@1.0.0"],
65+
},
66+
fileSystemResolver: {
67+
uri: "embed/file-system-uri-resolver-ext@1.0.1",
68+
package: fileSystemResolver.wasmPackage,
69+
implements: [
70+
"ens/wraps.eth:file-system-uri-resolver-ext@1.0.1",
71+
ExtendableUriResolver.defaultExtInterfaceUris[0].uri,
72+
],
73+
redirectFrom: ["ens/wraps.eth:file-system-uri-resolver-ext@1.0.1"],
74+
},
75+
};
76+
```

packages/config-bundles/sys/package.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,49 @@
1313
],
1414
"scripts": {
1515
"build": "rimraf ./build && tsc",
16+
"build:docs": "yarn doc-snippets combine",
1617
"lint": "eslint --color -c ../../../.eslintrc.js src/"
1718
},
1819
"dependencies": {
1920
"@polywrap/config-bundle-types-js": "~0.10.1",
2021
"@polywrap/concurrent-plugin-js": "~0.10.0",
2122
"@polywrap/datetime-plugin-js": "~0.10.0",
23+
"@polywrap/file-system-plugin-js": "~0.10.0",
2224
"@polywrap/http-plugin-js": "~0.10.0",
2325
"@polywrap/logger-plugin-js": "~0.10.0",
24-
"@polywrap/sys-node-config-bundle-js": "~0.10.1",
2526
"@polywrap/uri-resolver-extensions-js": "~0.10.1",
2627
"base64-to-uint8array": "1.0.0"
2728
},
2829
"devDependencies": {
30+
"doc-snippets": "~1.0.0",
2931
"rimraf": "3.0.2",
3032
"typescript": "4.9.5"
3133
},
3234
"publishConfig": {
3335
"access": "public"
36+
},
37+
"doc-snippets": {
38+
"extract": {
39+
"include": ["./src/**/*.{ts,tsx,json,yaml,txt,md,graphql,cue}"],
40+
"ignore": [
41+
"./**/node_modules/**",
42+
"./**/.polywrap/**",
43+
"./**/__tests__/**"
44+
],
45+
"dir": "./"
46+
},
47+
"inject": {
48+
"dir": "./readme",
49+
"include": "./README.md"
50+
},
51+
"startTokens": [
52+
{ "pattern": "$start: ", "inline": false },
53+
{ "pattern": "/* $: {SNIPPET_NAME} */", "inline": true }
54+
],
55+
"endTokens": [
56+
{ "pattern": "$end", "inline": false },
57+
{ "pattern": "/* $ */", "inline": true }
58+
],
59+
"outputDir": "./"
3460
}
3561
}

0 commit comments

Comments
 (0)