Skip to content

Commit fef53c9

Browse files
authored
Merge pull request #1928 from polywrap/feat-build-only-schema
feat: add --no-wasm option to build command
2 parents 7b52e35 + 782f91a commit fef53c9

14 files changed

Lines changed: 76 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Polywrap Origin (0.12.2)
2+
## Features
3+
**`polywrap` CLI:**
4+
* [PR-1928](https://github.com/polywrap/cli/pull/1928) **Add `--no-wasm` Option To `polywrap build`**
5+
* `build` command now supports the `--no-wasm` option, which disables the wasm compilation step when compiling projects.
6+
17
# Polywrap Origin (0.12.1)
28
## Features
39
**`polywrap` CLI:**

packages/cli/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ Currently, `build` can be run for Wasm, Plugin and Interface projects.
104104
Skip codegen before building.
105105
By default, `build` performs a `codegen` step before building your Project. This option skips this step.
106106

107+
- `--no-wasm`
108+
Skip wasm compilation.
109+
By default, `build` performs wasm compilation. This option skips this step.
110+
107111
- `-s, --strategy <strategy>`
108112
Specify which build strategy to use. By default, the `vm` build strategy is used.
109113
Available strategies:

packages/cli/lang/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"commands_build_options_options": "options",
2222
"commands_build_options_t": "Use the development server's ENS instance",
2323
"commands_build_options_codegen": "Skip code generation before build",
24+
"commands_build_options_no_wasm": "Skip wasm compilation",
2425
"commands_build_options_codegen_dir": "Codegen output directory (default: {default})",
2526
"commands_build_options_s": "Strategy to use for building the wrapper (default: {default})",
2627
"commands_build_options_s_strategy": "strategy",

packages/cli/lang/es.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"commands_build_options_options": "options",
2222
"commands_build_options_t": "Use the development server's ENS instance",
2323
"commands_build_options_codegen": "Skip code generation before build",
24+
"commands_build_options_no_wasm": "Skip wasm compilation",
2425
"commands_build_options_codegen_dir": "Codegen output directory (default: {default})",
2526
"commands_build_options_s": "Strategy to use for building the wrapper (default: {default})",
2627
"commands_build_options_s_strategy": "strategy",

packages/cli/src/__tests__/e2e/p2/build.wasm.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Options:
2424
-c, --client-config <config-path> Add custom configuration to the
2525
PolywrapClient
2626
-n, --no-codegen Skip code generation before build
27+
--no-wasm Skip wasm compilation
2728
--codegen-dir Codegen output directory (default:
2829
./src/wrap)
2930
--wrapper-envs <envs-path> Path to a JSON file containing wrapper
@@ -265,7 +266,7 @@ describe("e2e tests for build command", () => {
265266
expect(output).toContain(`WRAP manifest written in ${buildDir}/wrap.info`);
266267
});
267268
})
268-
269+
269270
describe("test-cases", () => {
270271
for (let i = 0; i < testCases.length; i++) {
271272
const testCaseName = testCases[i];

packages/cli/src/commands/build.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export interface BuildCommandOptions extends BaseCommandOptions {
5151
clientConfig: string | false;
5252
wrapperEnvs: string | false;
5353
noCodegen: boolean;
54+
noWasm: boolean;
5455
codegenDir: string | false;
5556
watch: boolean;
5657
strategy: `${SupportedStrategies}`;
@@ -80,6 +81,7 @@ export const build: Command = {
8081
`${intlMsg.commands_common_options_config()}`
8182
)
8283
.option(`-n, --no-codegen`, `${intlMsg.commands_build_options_codegen()}`)
84+
.option(`--no-wasm`, `${intlMsg.commands_build_options_no_wasm()}`)
8385
.option(
8486
`--codegen-dir`,
8587
`${intlMsg.commands_build_options_codegen_dir({
@@ -117,6 +119,7 @@ export const build: Command = {
117119
outputDir: parseDirOption(options.outputDir, defaultOutputDir),
118120
bindgen: options.bindgen || false,
119121
noCodegen: !options.codegen || false,
122+
noWasm: !options.wasm || false,
120123
codegenDir: parseDirOptionNoDefault(options.codegenDir),
121124
strategy: options.strategy || defaultStrategy,
122125
watch: options.watch || false,
@@ -174,6 +177,7 @@ async function run(options: Required<BuildCommandOptions>) {
174177
bindgen,
175178
strategy,
176179
noCodegen,
180+
noWasm,
177181
codegenDir,
178182
verbose,
179183
quiet,
@@ -220,7 +224,7 @@ async function run(options: Required<BuildCommandOptions>) {
220224

221225
const isInterface = language === "interface";
222226

223-
if (isInterface) {
227+
if (isInterface || noWasm) {
224228
buildStrategy = new NoopBuildStrategy({
225229
project: project as PolywrapProject,
226230
outputDir,
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"noWasm": true
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[
2+
"wrap.info"
3+
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"stdout": [
3+
"WRAP manifest written in ./build"
4+
],
5+
"exitCode": 0
6+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@polywrap/test-project",
3+
"version": "0.1.0",
4+
"license": "MIT",
5+
"private": true,
6+
"scripts": {
7+
"build": "polywrap build"
8+
},
9+
"dependencies": {
10+
"@polywrap/wasm-as": "../../../../../../../wasm/as"
11+
},
12+
"devDependencies": {
13+
"assemblyscript": "0.19.23"
14+
}
15+
}

0 commit comments

Comments
 (0)