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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Polywrap Origin (0.9.4)
## Bugs
* [PR-1372](https://github.com/polywrap/toolchain/pull/1372) `@polywrap/schema-parse`, `@polywrap/schema-compose`: Fixed a bug when importing type with map properties that use imported types.
* [PR-1380](https://github.com/polywrap/toolchain/pull/1380) `polywrap` CLI: Add informative logging when manifests are automatically migrated.
* [PR-1356](https://github.com/polywrap/toolchain/pull/1356) `polywrap` CLI: Building interface projects should not require docker.
* [PR-1374](https://github.com/polywrap/toolchain/pull/1374) `@polywrap/ethereum-plugin-js`: Update README.
* [PR-1381](https://github.com/polywrap/toolchain/pull/1381) `@polywrap/templates`: Add https://ipfs.wrappers.io gateway to IPFS deployment step for interface project.

# Polywrap Origin (0.9.3)
## Bugs
* [PR-1344](https://github.com/polywrap/toolchain/pull/1344) `@polywrap/cli`: Improve workflow validation.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.3
0.9.4
1 change: 1 addition & 0 deletions packages/cli/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"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_info_interface_no_strategy": "Interface projects do not use build strategies. Building without a strategy...",
"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",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"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_info_interface_no_strategy": "Interface projects do not use build strategies. Building without a strategy...",
"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",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@polywrap/test-env-js": "0.9.3",
"@polywrap/wasm-js": "0.9.3",
"@polywrap/wrap-manifest-types-js": "0.9.3",
"@polywrap/logging-js": "0.9.3",
"axios": "0.21.2",
"chalk": "4.1.0",
"chokidar": "3.5.1",
Expand Down
24 changes: 20 additions & 4 deletions packages/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
parseDirOption,
parseClientConfigOption,
parseManifestFileOption,
Logger,
} from "../lib";
import { CodeGenerator } from "../lib/codegen";
import {
Expand All @@ -20,6 +21,7 @@ import {
SupportedStrategies,
DockerImageBuildStrategy,
LocalBuildStrategy,
EmptyBuildStrategy,
} from "../lib/build-strategies";

import path from "path";
Expand Down Expand Up @@ -108,11 +110,20 @@ async function validateManifestModules(polywrapManifest: PolywrapManifest) {
}
}

function createBuildStrategy(
async function createBuildStrategy(
strategy: BuildCommandOptions["strategy"],
outputDir: string,
project: PolywrapProject
): BuildStrategy {
project: PolywrapProject,
logger: Logger
): Promise<BuildStrategy> {
const isInterfaceProject =
(await project.getManifest()).project.type === "interface";

if (isInterfaceProject) {
logger.info(intlMsg.commands_build_info_interface_no_strategy());
return new EmptyBuildStrategy({ outputDir, project });
}

switch (strategy) {
case SupportedStrategies.LOCAL:
return new LocalBuildStrategy({ outputDir, project });
Expand Down Expand Up @@ -151,7 +162,12 @@ async function run(options: BuildCommandOptions) {
const polywrapManifest = await project.getManifest();
await validateManifestModules(polywrapManifest);

const buildStrategy = createBuildStrategy(strategy, outputDir, project);
const buildStrategy = await createBuildStrategy(
strategy,
outputDir,
project,
logger
);

const schemaComposer = new SchemaComposer({
project,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/commands/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ const runMigrateCommand = async (

function migrateManifestFile(
manifestFile: string,
migrationFn: (input: string, to: string) => string,
migrationFn: (input: string, to: string, logger?: Logger) => string,
to: string,
logger: Logger
): void {
Expand All @@ -528,7 +528,7 @@ function migrateManifestFile(
encoding: "utf-8",
});

const outputManifestString = migrationFn(manifestString, to);
const outputManifestString = migrationFn(manifestString, to, logger);

// Cache the old manifest file
const cache = new CacheDirectory({
Expand Down
4 changes: 3 additions & 1 deletion packages/cli/src/commands/utils/createLogger.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Logger, LogLevel, ConsoleLog } from "../../lib";
import { Logger, ConsoleLog } from "../../lib";

import { LogLevel } from "@polywrap/logging-js";

export function createLogger(flags: {
verbose?: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { BuildStrategy } from "../BuildStrategy";

export class EmptyBuildStrategy extends BuildStrategy<void> {
getStrategyName(): string {
return "empty";
}

public async buildSources(): Promise<void> {
return;
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./DockerVMStrategy";
export * from "./LocalStrategy";
export * from "./DockerImageStrategy";
export * from "./EmptyStrategy";
7 changes: 1 addition & 6 deletions packages/cli/src/lib/logging/Log.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
export enum LogLevel {
DEBUG,
INFO,
WARN,
ERROR,
}
import { LogLevel } from "@polywrap/logging-js";

export abstract class Log {
public readonly level: LogLevel;
Expand Down
6 changes: 4 additions & 2 deletions packages/cli/src/lib/logging/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Log, LogLevel } from "./Log";
import { Log } from "./Log";

import { ILogger, LogLevel } from "@polywrap/logging-js";

interface Logs {
[name: string]: Log;
}

export class Logger {
export class Logger implements ILogger {
private _logs: Logs;

constructor(logs: Logs) {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/lib/logging/logs/ConsoleLog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Log, LogLevel } from "../Log";
import { Log } from "../Log";

import chalk from "chalk";
import { LogLevel } from "@polywrap/logging-js";

export class ConsoleLog extends Log {
constructor(level: LogLevel) {
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/lib/logging/logs/FileLog.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Log, LogLevel } from "../Log";
import { Log } from "../Log";

import fs, { WriteStream } from "fs";
import { LogLevel } from "@polywrap/logging-js";

export class FileLog extends Log {
private _logFileStream: WriteStream;
Expand Down
8 changes: 5 additions & 3 deletions packages/cli/src/lib/manifest/migrate/migrateAnyManifest.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
/* eslint-disable no-empty */

import { ILogger } from "@polywrap/logging-js";
import YAML from "yaml";

export function migrateAnyManifest(
manifestString: string,
manifestTypeName: string,
migrateFn: (manifest: unknown, to: string) => unknown,
to: string
migrateFn: (manifest: unknown, to: string, logger?: ILogger) => unknown,
to: string,
logger?: ILogger
): string {
let manifest: unknown | undefined;
try {
Expand All @@ -21,7 +23,7 @@ export function migrateAnyManifest(
throw Error(`Unable to parse ${manifestTypeName}: ${manifestString}`);
}

const newManifest = migrateFn(manifest, to);
const newManifest = migrateFn(manifest, to, logger);

const cleanedManifest = JSON.parse(JSON.stringify(newManifest));
delete cleanedManifest.__type;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migrateAppManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migrateAppProjectManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"AppManifest",
migrateAppManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migrateBuildManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migrateBuildExtensionManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"BuildManifest",
migrateBuildManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migrateDeployManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migrateDeployExtensionManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"DeployManifest",
migrateDeployManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migrateInfraManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migrateInfraExtensionManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"InfraManifest",
migrateInfraManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migrateMetaManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migrateMetaExtensionManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"MetaManifest",
migrateMetaManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migratePluginManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migratePluginProjectManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"PluginManifest",
migratePluginManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migratePolywrapManifest } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migratePolywrapProjectManifest(
manifestString: string,
to: string
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"PolywrapManifest",
migratePolywrapManifest,
to
to,
logger
);
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { migrateAnyManifest } from "./migrateAnyManifest";

import { migratePolywrapWorkflow } from "@polywrap/polywrap-manifest-types-js";
import { ILogger } from "@polywrap/logging-js";

export function migrateWorkflow(manifestString: string, to: string): string {
export function migrateWorkflow(
manifestString: string,
to: string,
logger?: ILogger
): string {
return migrateAnyManifest(
manifestString,
"PolywrapWorkflow",
migratePolywrapWorkflow,
to
to,
logger
);
}
2 changes: 1 addition & 1 deletion packages/cli/src/lib/project/manifests/app/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function loadAppManifest(
}

try {
const result = deserializeAppManifest(manifest);
const result = deserializeAppManifest(manifest, { logger: logger });
return Promise.resolve(result);
} catch (e) {
return Promise.reject(e);
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/lib/project/manifests/plugin/load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function loadPluginManifest(
}

try {
const result = deserializePluginManifest(manifest);
const result = deserializePluginManifest(manifest, { logger: logger });
return Promise.resolve(result);
} catch (e) {
return Promise.reject(e);
Expand Down
Loading