Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.polywrap",
"dependencies:install": "cd dependencies && yarn",
"preinstall": "yarn dependencies:install",
"build": "yarn build:core && yarn link:schema && yarn build:interfaces && yarn build:plugins && yarn build:resolver:plugins && yarn build:config && yarn build:client && yarn build:test-env && yarn build:cli",
"build": "yarn build:core && yarn build:interfaces && yarn build:plugins && yarn build:resolver:plugins && yarn build:config && yarn build:client && yarn build:test-env && yarn build:cli",
"build:core": "lerna run build --no-private --ignore @polywrap/*-plugin-js --ignore @polywrap/client-config-builder-js --ignore polywrap --ignore @polywrap/client-js --ignore @polywrap/react --ignore @polywrap/test-env-js --ignore @polywrap/*-interface",
"build:interfaces": "lerna run build --scope @polywrap/*-interface",
"build:plugins": "lerna run build --scope @polywrap/*-plugin-js --ignore @polywrap/*-resolver-plugin-js",
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/lang/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"commands_common_options_configPath": "config-path",
"commands_common_options_config": "Add custom configuration to the PolywrapClient",
"commands_common_options_verbose": "Verbose output (default: false)",
"commands_common_options_quiet": "Suppress output (default: false)",
"commands_build_description": "Build Polywrap Projects (type: interface, wasm)",
"commands_build_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_build_error_manifestNotFound": "Manifest not found. Search paths used: {paths}",
Expand All @@ -17,15 +19,13 @@
"commands_build_options_w": "Automatically rebuild when changes are made (default: false)",
"commands_build_options_s": "Strategy to use for building the wrapper",
"commands_build_options_s_strategy": "strategy",
"commands_build_options_v": "Verbose output (default: false)",
"commands_infra_description": "Modular Infrastructure-As-Code Orchestrator",
"commands_infra_actions_subtitle": "Infra allows you to execute the following commands:",
"commands_infra_options_options": "options",
"commands_infra_options_i_node": "node",
"commands_infra_options_h": "Show usage information",
"commands_infra_options_o": "Use only specified modules",
"commands_infra_options_o_module": "module",
"commands_infra_options_v": "Verbose output (default: false)",
"commands_infra_options_d": "Run in detached mode",
"commands_infra_options_m_path": "path",
"commands_infra_options_m": "Path to the Polywrap Infra manifest file (default: {default})",
Expand Down Expand Up @@ -65,7 +65,6 @@
"commands_deploy_options_o": "Output file path for the deploy result",
"commands_deploy_options_n": "Name of the deployment to execute",
"commands_deploy_options_c": "Argument for deployment's publish step, in case deploy step is absent",
"commands_deploy_options_v": "Verbose output (default: false)",
"commands_deploy_options_p": "Path to the build directory",
"commands_deploy_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_deploy_error_pathMissing": "{option} option missing {argument} argument",
Expand Down Expand Up @@ -130,7 +129,6 @@
"commands_run_options_outputFile": "Output file path for the workflow result",
"commands_run_options_m_path": "path",
"commands_run_options_m": "Path to the Polywrap Workflow manifest file (default: {default})",
"commands_run_options_quiet": "Suppress output",
"commands_run_options_jobIds": "jobs",
"commands_run_options_jobs": "Specify ids of jobs that you want to run",
"commands_run_error_validatorNotFound": "validate script not found at: {path}",
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/lang/es.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"commands_common_options_configPath": "config-path",
"commands_common_options_config": "Add custom configuration to the PolywrapClient",
"commands_common_options_verbose": "Verbose output (default: false)",
"commands_common_options_quiet": "Suppress output (default: false)",
"commands_build_description": "Build Polywrap Projects (type: interface, wasm)",
"commands_build_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_build_error_manifestNotFound": "Manifest not found. Search paths used: {paths}",
Expand All @@ -17,15 +19,13 @@
"commands_build_options_w": "Automatically rebuild when changes are made (default: false)",
"commands_build_options_s": "Strategy to use for building the wrapper",
"commands_build_options_s_strategy": "strategy",
"commands_build_options_v": "Verbose output (default: false)",
"commands_infra_description": "Modular Infrastructure-As-Code Orchestrator",
"commands_infra_actions_subtitle": "Infra allows you to execute the following commands:",
"commands_infra_options_options": "options",
"commands_infra_options_i_node": "node",
"commands_infra_options_h": "Show usage information",
"commands_infra_options_o": "Use only specified modules",
"commands_infra_options_o_module": "module",
"commands_infra_options_v": "Verbose output (default: false)",
"commands_infra_options_d": "Run in detached mode",
"commands_infra_options_m_path": "path",
"commands_infra_options_m": "Path to the Polywrap Infra manifest file (default: {default})",
Expand Down Expand Up @@ -65,7 +65,6 @@
"commands_deploy_options_o": "Output file path for the deploy result",
"commands_deploy_options_n": "Name of the deployment to execute",
"commands_deploy_options_c": "Argument for deployment's publish step, in case deploy step is absent",
"commands_deploy_options_v": "Verbose output (default: false)",
"commands_deploy_options_p": "Path to the build directory",
"commands_deploy_error_manifestPathMissing": "{option} option missing {argument} argument",
"commands_deploy_error_pathMissing": "{option} option missing {argument} argument",
Expand Down Expand Up @@ -130,7 +129,6 @@
"commands_run_options_outputFile": "Output file path for the workflow result",
"commands_run_options_m_path": "path",
"commands_run_options_m": "Path to the Polywrap Workflow manifest file (default: {default})",
"commands_run_options_quiet": "Suppress output",
"commands_run_options_jobIds": "jobs",
"commands_run_options_jobs": "Specify ids of jobs that you want to run",
"commands_run_error_validatorNotFound": "validate script not found at: {path}",
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,18 @@
"extract-zip": "2.0.1",
"form-data": "4.0.0",
"fs-extra": "9.0.1",
"gluegun": "4.6.1",
"ipfs-http-client": "48.1.3",
"jsonschema": "1.4.0",
"json-schema-ref-parser": "9.0.9",
"json-schema": "0.4.0",
"mustache": "4.0.1",
"ora": "4.0.0",
"os-locale": "5.0.0",
"regex-parser": "2.2.11",
"rimraf": "3.0.2",
"toml": "3.0.0",
"typescript": "4.0.7",
"yaml": "2.1.3"
"yaml": "2.1.3",
"yesno": "0.4.0"
},
"devDependencies": {
"@types/copyfiles": "2.4.0",
Expand Down
19 changes: 11 additions & 8 deletions packages/cli/src/__tests__/e2e/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Options:
-w, --watch Automatically rebuild when changes are
made (default: false)
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down Expand Up @@ -178,11 +179,13 @@ describe("e2e tests for build command", () => {
cli: polywrapCli,
});

const buildDir = `./${path.relative(testCaseDir, outputDir)}`;
const displayPath = "./" + path.relative(
getTestCaseDir(0), outputDir
);

expect(code).toEqual(0);
expect(output).toContain(`Artifacts written to ${buildDir}`);
expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`);
expect(output).toContain(`Artifacts written to ${displayPath}`);
expect(output).toContain(`WRAP manifest written in ${displayPath}/wrap.info`);

testBuildOutput(testCaseDir, outputDir);
});
Expand All @@ -194,9 +197,9 @@ describe("e2e tests for build command", () => {
cwd: getTestCaseDir(0),
cli: polywrapCli,
});
const buildDir = `./build`;

const buildDir = "./build";

expect(code).toEqual(0);
expect(output).toContain(`Artifacts written to ${buildDir}`);
expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`);
Expand All @@ -215,9 +218,9 @@ describe("e2e tests for build command", () => {
cwd: getTestCaseDir(0),
cli: polywrapCli,
});

const buildDir = `./build`;

expect(code).toEqual(0);
expect(output).toContain(`Artifacts written to ${buildDir}`);
expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`);
Expand Down
25 changes: 17 additions & 8 deletions packages/cli/src/__tests__/e2e/codegen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Options:
(JavaScript | TypeScript)
-c, --client-config <config-path> Add custom configuration to the
PolywrapClient
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down Expand Up @@ -84,7 +86,7 @@ describe("e2e tests for codegen command", () => {
});

it("Should throw error for invalid generation file - wrong file", async () => {
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
const { exitCode: code, stderr: error } = await runCLI({
args: ["codegen", "--script", `polywrap-invalid.gen.js`],
cwd: getTestCaseDir(0),
cli: polywrapCli,
Expand All @@ -95,23 +97,30 @@ describe("e2e tests for codegen command", () => {
);

expect(code).toEqual(1);
expect(error).toBe("");
expect(clearStyle(output)).toContain(
`Failed to generate types: Cannot find module '${genFile}'`

const errorText = clearStyle(error);
expect(errorText).toContain(
"Failed to generate types"
);
expect(errorText).toContain(
`Cannot find module '${genFile}'`
);
});

it("Should throw error for invalid generation file - no run() method", async () => {
const { exitCode: code, stdout: output, stderr: error } = await runCLI({
const { exitCode: code, stderr: error } = await runCLI({
args: ["codegen", "--script", `polywrap-norun.gen.js`],
cwd: getTestCaseDir(0),
cli: polywrapCli,
});

expect(code).toEqual(1);
expect(error).toBe("");
expect(clearStyle(output)).toContain(
`Failed to generate types: The generation file provided doesn't have the 'generateBinding' method.`
const errorText = clearStyle(error);
expect(errorText).toContain(
"Failed to generate types"
);
expect(errorText).toContain(
`The generation file provided doesn't have the 'generateBinding' method.`
);
});

Expand Down
8 changes: 4 additions & 4 deletions packages/cli/src/__tests__/e2e/create.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ describe("e2e tests for create command", () => {
cwd: __dirname,
cli: polywrapCli,
});

expect(code).toEqual(0);
expect(clearStyle(output)).toMatch(
/🔥 You are ready to ([A-Za-z ]+) Polywrap 🔥/
expect(clearStyle(output)).toContain(
"🔥 You are ready "
);

rimraf.sync(`${__dirname}/test`);
}, 60000);
})
Expand Down
6 changes: 2 additions & 4 deletions packages/cli/src/__tests__/e2e/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Options:
(default: polywrap.yaml | polywrap.yml)
-o, --output-file <path> Output file path for the deploy result
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down Expand Up @@ -216,7 +217,7 @@ describe("e2e tests for deploy command", () => {
])
});

it("Should show warning if no manifest ext is found in deploy package", async () => {
it.only("Should show warning if no manifest ext is found in deploy package", async () => {
const { exitCode: code, stdout: output } = await runCLI(
{
args: ["deploy"],
Expand All @@ -229,9 +230,6 @@ describe("e2e tests for deploy command", () => {
const sanitizedOutput = clearStyle(output);

expect(code).toEqual(0);
expect(sanitizedOutput).toContain(
"No manifest extension found in"
);
expect(sanitizedOutput).toContain(
"Successfully executed step 'ipfs_test'"
);
Expand Down
2 changes: 2 additions & 0 deletions packages/cli/src/__tests__/e2e/docgen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Options:
-c, --client-config <config-path> Add custom configuration to the
PolywrapClient
-i, --imports Also generate docs for dependencies
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/__tests__/e2e/infra.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Options:
polywrap.infra.yml)
-o, --modules <module,module> Use only specified modules
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/__tests__/e2e/manifest.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ Options:
-m, --manifest-file <path> Path to the manifest file (default: polywrap.yaml
| polywrap.yml)
-f, --format <format> Target format to migrate to (defaults to latest)
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand All @@ -51,6 +53,8 @@ Options:
-r, --raw Output raw JSON Schema (default: false)
-m, --manifest-file <path> Path to the manifest file (default: polywrap.yaml
| polywrap.yml)
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down
7 changes: 4 additions & 3 deletions packages/cli/src/__tests__/e2e/run.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ Options:
result
-j, --jobs <jobs...> Specify ids of jobs that you want to
run
-q, --quiet Suppress output
-v, --verbose Verbose output (default: false)
-q, --quiet Suppress output (default: false)
-h, --help display help for command
`;

Expand Down Expand Up @@ -207,7 +208,7 @@ describe("e2e tests for run command", () => {

const output = parseOutput(stdout);
expect(output.filter((o => o.status === "SUCCEED"))).toHaveLength(output.length);
expect(output.filter((o => o.validation === "SUCCEED"))).toHaveLength(output.length);
expect(output.filter((o => o.validation?.startsWith("SUCCEED")))).toHaveLength(output.length);
});

it("Should print error on stderr if validation fails", async () => {
Expand Down Expand Up @@ -281,7 +282,7 @@ describe("e2e tests for run command", () => {

const output = parseOutput(stdout);
expect(output.filter((o => o.status === "SUCCEED"))).toHaveLength(output.length);
expect(output.filter((o => o.validation === "SUCCEED"))).toHaveLength(output.length);
expect(output.filter((o => o.validation?.startsWith("SUCCEED")))).toHaveLength(output.length);
});

it("Should print error on stderr if job is named 'data' or 'error'", async () => {
Expand Down
5 changes: 2 additions & 3 deletions packages/cli/src/__tests__/unit/jobrunner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ describe("workflow JobRunner", () => {
await buildWrapper(
path.join(GetPathToTestWrappers(), "wasm-as", "simple-calculator")
);

client = new PolywrapClient({});
});

for (const testCase of testCases) {
test(testCase.name, async () => {
it(testCase.name, async () => {
expect(client).toBeTruthy();
const ids = Object.keys(testCase.workflow.jobs);
const jobRunner = new JobRunner(client, testCase.onExecution);
await jobRunner.run(testCase.workflow.jobs, ids);
});
}
});

Loading