Skip to content

Commit

Permalink
Merge pull request #986 from polywrap/feat/build-structure-improvements
Browse files Browse the repository at this point in the history
Feat: Build manifest refactor
  • Loading branch information
dOrgJelli authored Jul 6, 2022
2 parents 65e85be + 7fd5b2f commit 9ed762f
Show file tree
Hide file tree
Showing 351 changed files with 3,254 additions and 4,260 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ packages/manifest-schemas/ @dOrgJelli
packages/js/cli @dOrgJelli @krisbitney @namesty @nerfZael @Niraj-Kamdar

# Client Interfaces
packages/core-interfaces @dOrgJelli
packages/interfaces @dOrgJelli

# JS Client
packages/js/client @dOrgJelli @krisbitney @namesty @nerfZael
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"workspaces": {
"packages": [
"./packages/cli",
"./packages/core-interfaces/**",
"./packages/interfaces/**",
"./packages/js/**",
"./packages/manifest-schemas/**",
"./packages/manifests/**",
"./packages/schema/**",
"./packages/templates/**",
"./packages/test-cases",
Expand Down
6 changes: 5 additions & 1 deletion packages/cli/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,9 @@
"lib_wasm_rust_invalidModule": "Module paths must point to Cargo.toml files. Found: {path}",
"lib_docker_invalidImageId": "Invalid docker image ID returned: {imageId}",
"lib_docker_noInstall": "Docker executable not found in PATH",
"lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}"
"lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}",
"lib_wrap_abi_not_found": "No WRAP ABI found",
"lib_helpers_wrap_manifest_outputText": "WRAP manifest written in {path}",
"lib_helpers_wrap_manifest_outputError": "Error writing WRAP manifest in {path}",
"lib_helpers_wrap_manifest_outputWarning": "Warning writing WRAP manifest in {path}"
}
6 changes: 5 additions & 1 deletion packages/cli/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,5 +270,9 @@
"lib_wasm_rust_invalidModule": "Module paths must point to Cargo.toml files. Found: {path}",
"lib_docker_invalidImageId": "Invalid docker image ID returned: {imageId}",
"lib_docker_noInstall": "Docker executable not found in PATH",
"lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}"
"lib_infra_unrecognizedModule": "Unrecognized modules: {modules}. Default modules: {defaultModules}",
"lib_wrap_abi_not_found": "No WRAP ABI found",
"lib_helpers_wrap_manifest_outputText": "WRAP manifest written in {path}",
"lib_helpers_wrap_manifest_outputError": "Error writing WRAP manifest in {path}",
"lib_helpers_wrap_manifest_outputWarning": "Warning writing WRAP manifest in {path}"
}
6 changes: 5 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules",
"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 ./copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules",
"build:infra-modules": "ts-node ./scripts/copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules",
"prebuild": "ts-node ./scripts/generateIntlTypes.ts",
"build:fast": "rimraf ./build && tsc --project tsconfig.build.json",
"lint": "eslint --color -c ../../.eslintrc.js .",
Expand All @@ -40,11 +40,14 @@
"@polywrap/ens-resolver-plugin-js": "0.0.1-prealpha.92",
"@polywrap/ethereum-plugin-js": "0.0.1-prealpha.92",
"@polywrap/ipfs-plugin-js": "0.0.1-prealpha.92",
"@polywrap/msgpack-js": "0.0.1-prealpha.92",
"@polywrap/os-js": "0.0.1-prealpha.92",
"@polywrap/polywrap-manifest-types-js": "0.0.1-prealpha.92",
"@polywrap/schema-bind": "0.0.1-prealpha.92",
"@polywrap/schema-compose": "0.0.1-prealpha.92",
"@polywrap/schema-parse": "0.0.1-prealpha.92",
"@polywrap/test-env-js": "0.0.1-prealpha.92",
"@polywrap/wrap-manifest-types-js": "0.0.1-prealpha.92",
"assemblyscript": "0.19.1",
"axios": "0.21.2",
"chalk": "4.1.0",
Expand Down Expand Up @@ -78,6 +81,7 @@
"dir-compare": "3.3.0",
"eslint-plugin-formatjs": "2.12.7",
"jest": "26.6.3",
"json-schema-to-typescript": "10.1.3",
"ts-jest": "26.5.4",
"ts-morph": "10.0.1",
"ts-node": "8.10.2"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import fse from "fs-extra";
import path from "path";

const source = process.argv[2];
const dest = process.argv[3];
const source = path.join(process.cwd(), process.argv[2]);
const dest = path.join(process.cwd(), process.argv[3]);

const ignore = [
".env",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/e2e/build.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ describe("e2e tests for build command", () => {
expect(error).toBe("");
expect(code).toEqual(0);
expect(output).toContain(`Artifacts written to ${buildDir}`);
expect(output).toContain(`Manifest written to ${buildDir}/polywrap.json`);
expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`);

testBuildOutput(testCaseDir, outputDir);
});
Expand Down
17 changes: 8 additions & 9 deletions packages/cli/src/commands/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
/* eslint-disable prefer-const */
import { Command, Program } from "./types";
import {
intlMsg,
PolywrapProject,
defaultPolywrapManifest,
DeployerHandler,
DeployPackage,
intlMsg,
parseWasmManifestFileOption,
PolywrapProject,
} from "../lib";
import { DeployerHandler } from "../lib/deploy/deployer";
import { Command, Program } from "./types";

import { DeployManifest } from "@polywrap/polywrap-manifest-types-js";
import fs from "fs";
import nodePath from "path";
import { print } from "gluegun";
import { Uri, DeployManifest } from "@polywrap/core-js";
import { Uri } from "@polywrap/core-js";
import { validate } from "jsonschema";

const defaultManifestStr = defaultPolywrapManifest.join(" | ");
Expand Down Expand Up @@ -54,7 +55,7 @@ async function run(options: DeployCommandOptions): Promise<void> {
const project = new PolywrapProject({
rootDir: nodePath.dirname(manifestFile),
polywrapManifestPath: manifestFile,
quiet: verbose ? false : true,
quiet: !verbose,
});
await project.validate();

Expand Down Expand Up @@ -91,14 +92,12 @@ async function run(options: DeployCommandOptions): Promise<void> {
// Create all handlers
Object.entries(deployManifest.stages).forEach(([stageName, stageValue]) => {
const publisher = stageToPackageMap[stageName].deployer;
const handler = new DeployerHandler(
handlers[stageName] = new DeployerHandler(
stageName,
publisher,
stageValue.config,
print
);

handlers[stageName] = handler;
});

// Establish dependency chains
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/infra.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { intlMsg, Infra, loadInfraManifest } from "../lib";
import { Command, Program } from "./types";

import { InfraManifest } from "@polywrap/polywrap-manifest-types-js";
import { print } from "gluegun";
import path from "path";
import { Argument } from "commander";
import chalk from "chalk";
import yaml from "js-yaml";
import { readdirSync } from "fs";
import { InfraManifest } from "@polywrap/core-js";

type InfraCommandOptions = {
modules?: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => {
console.log(`ID: ${id}`);
}

if (!quiet && data && data !== {}) {
if (!quiet && data) {
console.log(`Data: ${JSON.stringify(data, null, 2)}`);
console.log("-----------------------------------");
}
Expand All @@ -115,7 +115,7 @@ const _run = async (workflowPath: string, options: WorkflowCommandOptions) => {

if (outputFile) {
const outputFileExt = path.extname(outputFile).substring(1);
if (!outputFileExt) throw new Error("Require output file extention");
if (!outputFileExt) throw new Error("Require output file extension");
switch (outputFileExt) {
case "yaml":
case "yml":
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/lib/CodeGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
isAppManifestLanguage,
appManifestLanguageToBindLanguage,
Project,
AnyManifest,
AnyProjectManifest,
SchemaComposer,
intlMsg,
resetDir,
Expand All @@ -29,7 +29,7 @@ import Mustache from "mustache";

export interface CodeGeneratorConfig {
codegenDirAbs: string;
project: Project<AnyManifest>;
project: Project<AnyProjectManifest>;
schemaComposer: SchemaComposer;
customScript?: string;
mustacheView?: Record<string, unknown>;
Expand Down
Loading

0 comments on commit 9ed762f

Please sign in to comment.