Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Post origin build artifact #1046

Merged
merged 70 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
76a005d
optional options if they don't have anything in the structure
dOrgJelli Jul 5, 2022
ec36c2b
todo
dOrgJelli Jul 5, 2022
dbe2a3e
Merge branch 'origin-dev' into feat/remove-schema-file
cbrzn Jul 6, 2022
88226fa
Merge branch 'origin-dev' into feat/remove-schema-file
cbrzn Jul 9, 2022
b0a7cd6
Merge branch 'origin-dev' into feat/remove-schema-file
cbrzn Jul 12, 2022
746d398
refactor(compose): first steps to remove schema and work only with abi
cbrzn Jul 13, 2022
1cf8980
Merge branch 'feat/remove-schema-file' of github.com:polywrap/monorep…
cbrzn Jul 13, 2022
ea49859
feat: schema.graphql removed from pipeline
cbrzn Jul 13, 2022
d8f1427
Merge branch 'origin-dev' into feat/remove-schema-file
cbrzn Jul 18, 2022
8e7e925
chore: started plugins refactor with abi
cbrzn Jul 18, 2022
bcdaa96
chore(plugins): builds with abi & wrap-man
cbrzn Jul 19, 2022
d1deacf
test(schema/compose): started tests structure updates
cbrzn Jul 19, 2022
13a40bb
feat: wrap manifest supports plugins & wrap.info is generated on plug…
cbrzn Jul 19, 2022
f2598a6
feat(bind/codegen): creates wrap.info for plugins
cbrzn Jul 19, 2022
7c62a18
chore: started bind tests refactor
cbrzn Jul 19, 2022
9f22b86
chore: started bind tests refactor
cbrzn Jul 19, 2022
4123559
test(schema/bind): green tests
cbrzn Jul 20, 2022
9905b70
tests(schema/compose): green tests except for one
cbrzn Jul 20, 2022
7bd56a0
chore(codegen-patch): plugins manifest builds && get manifest impleme…
cbrzn Jul 20, 2022
d5b5462
feat(polywrap-manifests): support wrap manifiest instead of schema.gr…
cbrzn Jul 21, 2022
267a3b6
tests(plugins): green tests!
cbrzn Jul 21, 2022
1c4ff5d
chore: fix conflicts with latest of origin
cbrzn Jul 23, 2022
0c5cbe1
Merge branch 'origin-dev' into feat/remove-schema-file
cbrzn Jul 25, 2022
6aa491d
Merge branch 'origin-dev' into feat/remove-schema-file
cbrzn Jul 28, 2022
30cc911
chore: create wrap.info.ts instead of binary file & remove schema fro…
cbrzn Jul 28, 2022
062d9df
feat(wrap-info): plugins final structure implemented, tests are not g…
cbrzn Jul 29, 2022
7ab51d6
chore(plugins): generates wrap.info & wrap.info.ts, support both getM…
cbrzn Jul 30, 2022
ede32c8
feat(plugins): update plugin package manifest to wrap info manifest &…
cbrzn Jul 30, 2022
23f4c92
tests: plugins & bind went green with update of PluginPackageManifest…
cbrzn Aug 1, 2022
bbe07ae
tests(client): green tests
cbrzn Aug 1, 2022
a3ee588
chore: update with latest codebase + merge conflicts
cbrzn Aug 1, 2022
e62778f
test: client & core should be green
cbrzn Aug 1, 2022
57a206c
test: ignore plugin template test + fix cli + fix lints of manual fol…
cbrzn Aug 1, 2022
f31de8d
tests: cli ci almost green
cbrzn Aug 1, 2022
9861b05
tests(cli): plugins, docgen & app tests fixed
cbrzn Aug 2, 2022
f448654
chore: update with latest code + update new test cases manifest to 2.0
cbrzn Aug 2, 2022
ee731b0
chore(schema/compose): remove console.log
cbrzn Aug 2, 2022
618a6e8
chore: fix conflicts
cbrzn Aug 8, 2022
8823430
chore(cli): schema docgen added again
cbrzn Aug 8, 2022
3fb3126
merge origin-dev
dOrgJelli Aug 13, 2022
8f9ca71
merge origin-dev
dOrgJelli Aug 13, 2022
6c2dd30
fix interface manifests
dOrgJelli Aug 13, 2022
f76f487
fix uri-resolver tests
dOrgJelli Aug 13, 2022
43b0b31
fix bind test
dOrgJelli Aug 13, 2022
4d96d81
type + optimize WrapAbi definitions
dOrgJelli Aug 15, 2022
be47afa
fix docgen tests + WrapManifest typing
dOrgJelli Aug 15, 2022
b0bb995
minor formatting changes
dOrgJelli Aug 15, 2022
1cd0b93
move wrap serialization logic
dOrgJelli Aug 15, 2022
302cd34
fixup import_redirects typing
dOrgJelli Aug 15, 2022
19cbac1
fix client context ID tracking
dOrgJelli Aug 15, 2022
465de13
remove needless abi copy
dOrgJelli Aug 15, 2022
6b7608e
fix ABI definition factory methods
dOrgJelli Aug 16, 2022
8c2f151
lint fix
dOrgJelli Aug 16, 2022
275fd54
fix nested namespace issue + remove needless output/module.graphql te…
dOrgJelli Aug 16, 2022
e2d6de1
fix mock plugins
dOrgJelli Aug 16, 2022
9cf84fd
fix imports
dOrgJelli Aug 16, 2022
c275a70
lint fix
dOrgJelli Aug 17, 2022
3e49294
fix tests
dOrgJelli Aug 18, 2022
4f7f74b
lint fix
dOrgJelli Aug 18, 2022
3c9aeea
import_redirects refactor
dOrgJelli Aug 18, 2022
816479b
fix test
dOrgJelli Aug 18, 2022
d5217fc
cleanup import_abis loading
dOrgJelli Aug 18, 2022
db2672d
merge origin-dev
dOrgJelli Aug 18, 2022
53c31e5
fix import
dOrgJelli Aug 18, 2022
a0beef0
fix build
dOrgJelli Aug 18, 2022
6e2d8bd
lint fix
dOrgJelli Aug 18, 2022
08373c1
improve wrap.info back-compat
dOrgJelli Aug 18, 2022
21aedc8
fix codegen
dOrgJelli Aug 18, 2022
cd9c71f
fix deploy test
dOrgJelli Aug 18, 2022
aaefd3b
lint fix
dOrgJelli Aug 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ module.exports = {
root: true,
ignorePatterns: [
"**/wrap/**/*.*",
"**/wrap-man/**/*.*",
"**/infra-modules/**/*.*",
"**/build/**/*.*",
"**/build-man/**/*.*",
"**/__tests__/**/*.*",
"**/node_modules/**/*.*",
"**/coverage/**/*.*"
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@
"clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.polywrap",
"dependencies:install": "cd dependencies && yarn",
"preinstall": "yarn dependencies:install",
"build": "yarn build:core && yarn build:interfaces && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli",
"build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli && yarn build:plugins:patch",
"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 --ignore @polywrap/*-interface",
"build:interfaces": "lerna run build --scope @polywrap/*-interface --concurrency 1",
"build:plugins": "lerna run build --scope @polywrap/*-plugin-js --concurrency 1",
"build:client": "lerna run build --scope @polywrap/client-js --scope @polywrap/react",
"build:test-env": "lerna run build --scope @polywrap/test-env-js",
"build:cli": "lerna run build --scope polywrap",
"build:plugins:patch": "cd packages/js/plugins/ethereum && yarn codegen:patch && cd ../http && yarn codegen:patch && lerna run codegen:patch --scope @polywrap/*-plugin-js --concurrency 1",
"link:interface:deps": "yarn link:manifests && yarn link:schema",
"link:manifests": "yarn link:manifests:polywrap && yarn link:manifests:wrap",
"link:manifests:polywrap": "cd packages/js/manifests/polywrap && (yarn unlink || true) && yarn link && cd ../../../../dependencies && yarn link @polywrap/polywrap-manifest-types-js && cd ../",
Expand Down
7 changes: 5 additions & 2 deletions packages/cli/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@
"lib_compiler_compileWasmModulesError": "Failed to compile Wasm modules",
"lib_compiler_compileWasmModulesText": "Compile Wasm modules",
"lib_compiler_compileWasmModulesWarning": "Warnings while compiling Wasm modules",
"lib_compiler_failedSchemaReturn": "Schema composer failed to return a combined schema.",
"lib_compiler_failedAbiReturn": "Abi composer failed to return a combined abi.",
"lib_compiler_noModulesToBuild": "No modules to build declared.",
"lib_compiler_missingSchema": "Missing schema definition",
"lib_compiler_missingAbi": "Missing ABI definition",
"lib_compiler_missingModule": "Missing module definition",
"lib_compiler_noInterfaceModule": "Interfaces cannot have implementation file",
"lib_compiler_step": "Compiling WASM module",
Expand All @@ -239,6 +239,9 @@
"lib_compiler_outputMetadataError": "Failed to output metadata",
"lib_compiler_outputMetadataWarning": "Warnings writing metadata",
"lib_compiler_outputMetadataFileText": "Metadata written to {path}",
"lib_schemaComposer_abi_not_found": "ABI not found at {path}",
"lib_schemaComposer_unknown_abi": "Unknown ABI type at {path}. Supported types: {types}",
"lib_schemaComposer_invalid_yaml": "Invalid YAML at {path}",
"lib_generators_projectGenerator_fallback": "Falling back to the local Yarn cache.",
"lib_generators_projectGenerator_offline": "You appear to be offline.",
"lib_helpers_manifest_loadError": "Failed to load manifest from {path}",
Expand Down
7 changes: 5 additions & 2 deletions packages/cli/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,9 @@
"lib_compiler_compileWasmModulesError": "Failed to compile Wasm modules",
"lib_compiler_compileWasmModulesText": "Compile Wasm modules",
"lib_compiler_compileWasmModulesWarning": "Warnings while compiling Wasm modules",
"lib_compiler_failedSchemaReturn": "Schema composer failed to return a combined schema.",
"lib_compiler_failedAbiReturn": "Abi composer failed to return a combined abi.",
"lib_compiler_noModulesToBuild": "No modules to build declared.",
"lib_compiler_missingSchema": "Missing schema definition",
"lib_compiler_missingAbi": "Missing ABI definition",
"lib_compiler_missingModule": "Missing module definition",
"lib_compiler_noInterfaceModule": "Interfaces cannot have implementation file",
"lib_compiler_step": "Compiling WASM module",
Expand All @@ -239,6 +239,9 @@
"lib_compiler_outputMetadataError": "Failed to output metadata",
"lib_compiler_outputMetadataWarning": "Warnings writing metadata",
"lib_compiler_outputMetadataFileText": "Metadata written to {path}",
"lib_schemaComposer_abi_not_found": "ABI not found at {path}",
"lib_schemaComposer_unknown_abi": "Unknown ABI type at {path}. Supported types: {types}",
"lib_schemaComposer_invalid_yaml": "Invalid YAML at {path}",
"lib_generators_projectGenerator_fallback": "Falling back to the local Yarn cache.",
"lib_generators_projectGenerator_offline": "You appear to be offline.",
"lib_helpers_manifest_loadError": "Failed to load manifest from {path}",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@
"polywrap": "bin/polywrap"
},
"scripts": {
"build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules && yarn build:docgen-templates",
"build": "yarn build:intl && yarn build:fast",
"build:fast": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules && yarn build:docgen-templates",
"build:build-images": "copyfiles ./src/lib/defaults/build-images/**/**/* ./build/lib/defaults/build-images/ -u 4",
"build:deploy-modules": "copyfiles ./src/lib/defaults/deploy-modules/**/polywrap.deploy.ext.json ./build/lib/defaults/deploy-modules -u 4",
"build:infra-modules": "ts-node ./scripts/copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules",
"build:docgen-templates": "yarn build:docgen-templates:docusaurus && yarn build:docgen-templates:jsdoc && yarn build:docgen-templates:schema",
"build:docgen-templates:docusaurus": "ts-node ./scripts/copyfiles ./src/lib/docgen/docusaurus/templates ./build/lib/docgen/docusaurus/templates",
"build:docgen-templates:jsdoc": "ts-node ./scripts/copyfiles ./src/lib/docgen/jsdoc/templates ./build/lib/docgen/jsdoc/templates",
"build:docgen-templates:schema": "ts-node ./scripts/copyfiles ./src/lib/docgen/schema/templates ./build/lib/docgen/schema/templates",
"prebuild": "ts-node ./scripts/generateIntlTypes.ts",
"build:fast": "rimraf ./build && tsc --project tsconfig.build.json",
"build:intl": "ts-node ./scripts/generateIntlTypes.ts",
"lint": "eslint --color -c ../../.eslintrc.js .",
"test": "cross-env TEST=true jest --passWithNoTests --runInBand --verbose",
"test:ci": "cross-env TEST=true jest --passWithNoTests --runInBand --verbose",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/__tests__/e2e/deploy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,13 +207,13 @@ describe("e2e tests for deploy command", () => {
input: {
uri: "wrap://fs/./build"
},
result: "wrap://ipfs/QmPDJ9GMgqx1iScNpZh2MerK27YFNKayY5fBoGXfPWWEqm"
result: "wrap://ipfs/QmT5nBb8xwrfZnmFNRZexmrebzaaxW7CPfh1ZznQ6zsVaG"
},
{
id: "ipfs_deploy.from_deploy",
name: "from_deploy",
input: {
uri: "wrap://ipfs/QmPDJ9GMgqx1iScNpZh2MerK27YFNKayY5fBoGXfPWWEqm",
uri: "wrap://ipfs/QmT5nBb8xwrfZnmFNRZexmrebzaaxW7CPfh1ZznQ6zsVaG",
config: {
domainName: "test1.eth",
provider: "http://localhost:8545",
Expand All @@ -226,7 +226,7 @@ describe("e2e tests for deploy command", () => {
id: "ipfs_deploy.from_deploy2",
name: "from_deploy2",
input: {
uri: "wrap://ipfs/QmPDJ9GMgqx1iScNpZh2MerK27YFNKayY5fBoGXfPWWEqm",
uri: "wrap://ipfs/QmT5nBb8xwrfZnmFNRZexmrebzaaxW7CPfh1ZznQ6zsVaG",
config: {
domainName: "test2.eth",
provider: "http://localhost:8545",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/e2e/docgen.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Generate wrapper documentation

Arguments:
action
schema Generate GraphQL schema
schema Generate GraphQL schema
docusaurus Generate Docusaurus markdown
jsdoc Generate JSDoc markdown
(choices: "schema", "docusaurus", "jsdoc")
Expand Down
10 changes: 3 additions & 7 deletions packages/cli/src/commands/docgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ import {
PluginProject,
parseClientConfigOption,
defaultPluginManifest,
} from "../lib";
import { Command, Program } from "./types";
import {
parseDirOption,
parseDocgenManifestFileOption,
} from "../lib/option-parsers";
} from "../lib";
import { Command, Program } from "./types";
import { scriptPath as docusaurusScriptPath } from "../lib/docgen/docusaurus";
import { scriptPath as jsdocScriptPath } from "../lib/docgen/jsdoc";
import { scriptPath as schemaScriptPath } from "../lib/docgen/schema";
Expand Down Expand Up @@ -55,9 +53,7 @@ enum Actions {
}

const argumentsDescription = `
${chalk.bold(
Actions.SCHEMA
)} ${intlMsg.commands_docgen_options_schema()}
${chalk.bold(Actions.SCHEMA)} ${intlMsg.commands_docgen_options_schema()}
${chalk.bold(
Actions.DOCUSAURUS
)} ${intlMsg.commands_docgen_options_markdown({
Expand Down
34 changes: 12 additions & 22 deletions packages/cli/src/commands/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ import {
PluginProject,
SchemaComposer,
defaultPluginManifest,
outputManifest,
intlMsg,
parseDirOption,
parsePluginManifestFileOption,
parseClientConfigOption,
generateWrapFile,
} from "../lib";

import { ComposerFilter } from "@polywrap/schema-compose";
import { writeFileSync } from "@polywrap/os-js";
import path from "path";
import fs from "fs";
import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js";
import fs from "fs";

const defaultPublishDir = "./build";
const defaultCodegenDir = "./wrap";
Expand Down Expand Up @@ -87,39 +85,31 @@ async function run(options: PluginCommandOptions) {
});
await project.validate();
const manifest = await project.getManifest();

const schemaComposer = new SchemaComposer({
project,
client,
});

let result = false;

const codeGenerator = new CodeGenerator({
project,
schemaComposer,
codegenDirAbs: codegenDir,
});

result = await codeGenerator.generate();
const result = await codeGenerator.generate();
process.exitCode = result ? 0 : 1;

if (result) {
process.exitCode = 0;
} else {
process.exitCode = 1;
}

// Output the built schema & manifest
const schemas = await schemaComposer.getComposedSchemas(
ComposerFilter.Schema
);
const publishSchemaPath = path.join(publishDir, "schema.graphql");
const publishManifestPath = path.join(publishDir, "polywrap.plugin.json");
// Output the built manifest
const manifestPath = path.join(publishDir, "wrap.info");

if (!fs.existsSync(publishDir)) {
fs.mkdirSync(publishDir);
}

writeFileSync(publishSchemaPath, schemas.schema);
await outputManifest(manifest, publishManifestPath);
await generateWrapFile(
await schemaComposer.getComposedAbis(),
manifest.name,
"plugin",
manifestPath
);
}
14 changes: 3 additions & 11 deletions packages/cli/src/lib/CodeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,8 @@ export class CodeGenerator {
);
}

// Get the fully composed schema
const composed = await schemaComposer.getComposedSchemas();

if (!composed) {
throw Error(intlMsg.lib_codeGenerator_noComposedSchema());
}

const abi = composed.abi;
this._schema = composed.schema;
// Get the fully composed abi
const abi = await schemaComposer.getComposedAbis();

if (!abi) {
throw Error(intlMsg.lib_codeGenerator_abiMissing());
Expand Down Expand Up @@ -119,7 +112,6 @@ export class CodeGenerator {
const binding = await generateBinding({
projectName: await project.getName(),
abi,
schema: this._schema || "",
outputDirAbs: codegenDirAbs,
bindLanguage,
config: this._config.mustacheView,
Expand All @@ -134,7 +126,7 @@ export class CodeGenerator {
);
} else {
const binding = await project.generateSchemaBindings(
composed,
abi,
path.relative(project.getManifestDir(), codegenDirAbs)
);

Expand Down
Loading