Skip to content

Commit 131228d

Browse files
authored
Merge pull request #978 from polywrap/prealpha-dev
Prep 0.0.1-prealpha.90
2 parents 26f0e51 + 80db7b9 commit 131228d

284 files changed

Lines changed: 3369 additions & 2578 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ module.exports = {
4040
],
4141
format: ["camelCase"], leadingUnderscore: "allow"
4242
},
43-
//wrap host methods doesn"t satisfy neither camel or snake
43+
//wrap host methods doesn't satisfy neither camel or snake
4444
{selector: ["objectLiteralMethod", "typeMethod"], filter: {regex: "^_wrap_.*", match: true}, format: null},
4545
//variable must be in camel or upper case
4646
{selector: "variable", format: ["camelCase", "UPPER_CASE"], leadingUnderscore: "allow"},

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Polywrap 0.0.1-prealpha.90
2+
## Features
3+
* [PR-912](https://github.com/polywrap/monorepo/pull/912) [PR-930](https://github.com/polywrap/monorepo/pull/930) [PR-958](https://github.com/polywrap/monorepo/pull/958) All URI resolver extensions have been decoupled and moved into their own plugin packages:
4+
* `@polywrap/fs-resolver-plugin-js`
5+
* `@polywrap/ipfs-resolver-plugin-js`
6+
* `@polywrap/ens-resolver-plugin-js`
7+
* [PR-912](https://github.com/polywrap/monorepo/pull/912) `@polywrap/file-system-interface` has been created to help standardize FileSystem wrapper implementations.
8+
* [PR-930](https://github.com/polywrap/monorepo/pull/930) `@polywrap/ipfs-interface` has been created to help standardize IPFS wrapper implementations.
9+
10+
## Bugs
11+
* [PR-957](https://github.com/polywrap/monorepo/pull/957) `@polywrap/schema-bind`: `plugin/typescript` module config type interfaces no longer inherit from `Record<string, unknown>`, making them more type-safe and less generic.
12+
13+
## Breaking Changes
14+
* [PR-937](https://github.com/polywrap/monorepo/issues/937) [PR-960](https://github.com/polywrap/monorepo/pull/960) The term `Nullable` has been changed to `Optional` within the `wasm` wrapper codegen. Additionally in `wasm/assemblyscript` the `Nullable<T>` type has been changed to a rust-style `Optional<T>` type.
15+
* [PR-972](https://github.com/polywrap/monorepo/pull/972) The term `input` in the context of invocations has been renamed to `args`.
16+
* [PR-976](https://github.com/polywrap/monorepo/pull/976) The invocation `resultFilter` option has been deprecated, as it is a needless & unused feature.
17+
118
# Polywrap 0.0.1-prealpha.89
219
## Features
320
* [PR-903](https://github.com/polywrap/monorepo/pull/903) `polywrap` CLI: Recipes have been re-worked into composable workflows, and they can be run using CLI commands.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.1-prealpha.89
1+
0.0.1-prealpha.90

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@
2424
"reset": "yarn clean && yarn && yarn build",
2525
"clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.polywrap",
2626
"dependencies:install": "cd dependencies && yarn",
27+
"dependencies:link": "yarn link:schema:parse && yarn link:schema:bind",
28+
"link:schema:parse": "cd packages/schema/parse && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @polywrap/schema-parse && cd ../",
29+
"link:schema:bind": "cd packages/schema/bind && (yarn unlink || true) && yarn link && cd ../../../dependencies && yarn link @polywrap/schema-bind && cd ../",
2730
"preinstall": "yarn dependencies:install",
28-
"build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli",
31+
"build": "yarn build:core && yarn dependencies:link && yarn build:interfaces && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli",
2932
"build:core": "lerna run build --no-private --ignore @polywrap/*-plugin-js --ignore polywrap --ignore @polywrap/client-js --ignore @polywrap/react --ignore @polywrap/test-env-js",
33+
"build:interfaces": "lerna run build --scope @polywrap/*-interface --concurrency 1",
3034
"build:plugins": "lerna run build --scope @polywrap/*-plugin-js --concurrency 1",
3135
"build:client": "lerna run build --scope @polywrap/client-js --scope @polywrap/react",
3236
"build:test-env": "lerna run build --scope @polywrap/test-env-js",
@@ -61,6 +65,5 @@
6165
"resolutions": {
6266
"@types/react": "16.9.0",
6367
"@types/react-dom": "16.9.0"
64-
},
65-
"version": "0.0.1-prealpha.87"
68+
}
6669
}

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@polywrap/client-js": "0.0.1-prealpha.89",
3939
"@polywrap/core-js": "0.0.1-prealpha.89",
4040
"@polywrap/ens-plugin-js": "0.0.1-prealpha.89",
41+
"@polywrap/ens-resolver-plugin-js": "0.0.1-prealpha.89",
4142
"@polywrap/ethereum-plugin-js": "0.0.1-prealpha.89",
4243
"@polywrap/ipfs-plugin-js": "0.0.1-prealpha.89",
4344
"@polywrap/os-js": "0.0.1-prealpha.89",

packages/cli/src/__tests__/e2e/create.spec.ts

Lines changed: 81 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { clearStyle, polywrapCli } from "./utils";
22

33
import { runCLI } from "@polywrap/test-env-js";
44
import rimraf from "rimraf";
5+
import { ProjectType, supportedLangs } from "../../commands";
56

67
const HELP = `Usage: polywrap create|c [options] [command]
78
@@ -32,7 +33,7 @@ describe("e2e tests for create command", () => {
3233
expect(clearStyle(output)).toEqual(HELP);
3334
});
3435

35-
test("Should throw error for missing parameter - type", async () => {
36+
test("Should show help for no parameters", async () => {
3637
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
3738
args: ["create"],
3839
cli: polywrapCli,
@@ -43,29 +44,7 @@ describe("e2e tests for create command", () => {
4344
expect(output).toBe("");
4445
});
4546

46-
test("Should throw error for missing parameter - lang", async () => {
47-
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
48-
args: ["create", "type"],
49-
cli: polywrapCli,
50-
});
51-
52-
expect(code).toEqual(1);
53-
expect(error).toContain("error: unknown command 'type'");
54-
expect(output).toBe("");
55-
});
56-
57-
test("Should throw error for missing parameter - name", async () => {
58-
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
59-
args: ["create", "type", "lang"],
60-
cli: polywrapCli,
61-
});
62-
63-
expect(code).toEqual(1);
64-
expect(error).toContain("error: unknown command 'type'");
65-
expect(output).toBe("");
66-
});
67-
68-
test("Should throw error for invalid parameter - type", async () => {
47+
test("Should throw error for invalid project type", async () => {
6948
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
7049
args: ["create", "unknown", "app", "name"],
7150
cli: polywrapCli,
@@ -76,49 +55,83 @@ describe("e2e tests for create command", () => {
7655
expect(output).toBe("");
7756
});
7857

79-
test("Should throw error for invalid parameter - lang", async () => {
80-
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
81-
args: ["create", "wasm", "unknown", "name"],
82-
cli: polywrapCli,
58+
for (const project of Object.keys(supportedLangs)) {
59+
describe(project, () => {
60+
test("Should throw error for missing required argument - language", async () => {
61+
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
62+
args: ["create", project],
63+
cli: polywrapCli,
64+
});
65+
66+
expect(code).toEqual(1);
67+
expect(error).toContain("error: missing required argument 'language");
68+
expect(output).toBe("");
69+
});
70+
71+
test("Should throw error for missing required argument - name", async () => {
72+
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
73+
args: ["create", project, "lang"],
74+
cli: polywrapCli,
75+
});
76+
77+
expect(code).toEqual(1);
78+
expect(error).toContain("error: missing required argument 'name'");
79+
expect(output).toBe("");
80+
});
81+
82+
test("Should throw error for invalid lang parameter", async () => {
83+
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
84+
args: ["create", project, "lang", "demo"],
85+
cli: polywrapCli,
86+
});
87+
88+
expect(code).toEqual(1);
89+
expect(error).toContain(
90+
`error: command-argument value 'lang' is invalid for argument 'language'. Allowed choices are ${supportedLangs[project as ProjectType].join(", ")}.`
91+
);
92+
expect(output).toBe("");
93+
});
94+
95+
for (const lang of supportedLangs[project as ProjectType]) {
96+
describe(lang, () => {
97+
test("Should throw error for missing path argument for output-dir option", async () => {
98+
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
99+
args: ["create", project, lang, "name", "-o"],
100+
cli: polywrapCli,
101+
});
102+
103+
expect(code).toEqual(1);
104+
expect(error).toContain(
105+
"error: option '-o, --output-dir <path>' argument missing"
106+
);
107+
expect(output).toBe("");
108+
});
109+
110+
test("Should successfully generate project", async () => {
111+
rimraf.sync(`${__dirname}/test`);
112+
113+
const { exitCode: code, stdout: output } = await runCLI({
114+
args: [
115+
"create",
116+
project,
117+
lang,
118+
"test",
119+
"-o",
120+
`${__dirname}/test`,
121+
],
122+
cwd: __dirname,
123+
cli: polywrapCli,
124+
});
125+
126+
expect(code).toEqual(0);
127+
expect(clearStyle(output)).toMatch(
128+
/🔥 You are ready to ([A-Za-z ]+) Polywrap 🔥/
129+
);
130+
131+
rimraf.sync(`${__dirname}/test`);
132+
}, 60000);
133+
})
134+
}
83135
});
84-
85-
expect(code).toEqual(1);
86-
expect(error).toContain("error: command-argument value 'unknown' is invalid for argument 'language'. Allowed choices are assemblyscript, interface.");
87-
expect(output).toBe("");
88-
});
89-
90-
test("Should throw error for invalid parameter - output-dir", async () => {
91-
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
92-
args: ["create", "wasm", "assemblyscript", "name", "-o"],
93-
cli: polywrapCli,
94-
});
95-
96-
expect(code).toEqual(1);
97-
expect(error).toContain("error: option '-o, --output-dir <path>' argument missing");
98-
expect(output).toBe("");
99-
});
100-
101-
test("Should successfully generate project", async () => {
102-
rimraf.sync(`${__dirname}/test`);
103-
104-
const { exitCode: code, stdout: output } = await runCLI({
105-
args: [
106-
"create",
107-
"wasm",
108-
"assemblyscript",
109-
"test",
110-
"-o",
111-
`${__dirname}/test`,
112-
],
113-
cwd: __dirname,
114-
cli: polywrapCli,
115-
});
116-
117-
expect(code).toEqual(0);
118-
expect(clearStyle(output)).toContain(
119-
`🔥 You are ready to turn your protocol into a Polywrap 🔥`
120-
);
121-
122-
rimraf.sync(`${__dirname}/test`);
123-
}, 60000);
136+
}
124137
});

packages/cli/src/__tests__/e2e/deploy.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ const setup = async (domainNames: string[]) => {
7979
const result = await client.invoke({
8080
uri: ensWrapperUri,
8181
method: "registerDomainAndSubdomainsRecursively",
82-
input: {
82+
args: {
8383
domain: domainName,
8484
owner: signer.address,
8585
registrarAddress,

packages/cli/src/cli.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any */
22

33
import * as Commands from "./commands";
4-
import { Command } from "./commands/types";
54

65
import { executeMaybeAsyncFunction } from "@polywrap/core-js";
76
import { program } from "commander";
87

98
export const run = async (argv: string[]): Promise<void> => {
10-
for (const command of Object.values(Commands) as Command[]) {
11-
await executeMaybeAsyncFunction(command.setup, program);
9+
for (const command of Object.values(Commands)) {
10+
if ("setup" in command) {
11+
await executeMaybeAsyncFunction(command.setup, program);
12+
}
1213
}
1314

1415
program.parse(argv);

packages/cli/src/commands/create.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const createAppStr = intlMsg.commands_create_options_createApp();
1212
const createPluginStr = intlMsg.commands_create_options_createPlugin();
1313
const pathStr = intlMsg.commands_create_options_o_path();
1414

15-
const supportedLangs = {
15+
export const supportedLangs = {
1616
wasm: ["assemblyscript", "interface"] as const,
1717
app: ["typescript-node", "typescript-react"] as const,
1818
plugin: ["typescript"] as const,

packages/cli/src/lib/defaults/deploy-modules/ens/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class ENSPublisher implements Deployer {
6868
const { data: resolver } = await client.invoke<string>({
6969
method: "getResolver",
7070
uri: ensWrapperUri,
71-
input: {
71+
args: {
7272
registryAddress: config.ensRegistryAddress,
7373
domain: config.domainName,
7474
connection: {
@@ -90,7 +90,7 @@ class ENSPublisher implements Deployer {
9090
const { data: setContenthashData } = await client.invoke<{ hash: string }>({
9191
method: "setContentHash",
9292
uri: ensWrapperUri,
93-
input: {
93+
args: {
9494
domain: config.domainName,
9595
cid: hash,
9696
resolverAddress: resolver,
@@ -107,7 +107,7 @@ class ENSPublisher implements Deployer {
107107
await client.invoke({
108108
method: "awaitTransaction",
109109
uri: ethereumPluginUri,
110-
input: {
110+
args: {
111111
txHash: setContenthashData.hash,
112112
confirmations: 1,
113113
timeout: 15000,

0 commit comments

Comments
 (0)