Skip to content

Commit 0177193

Browse files
committed
remove unused partials
1 parent 4f7568b commit 0177193

File tree

1 file changed

+0
-154
lines changed

1 file changed

+0
-154
lines changed

crates/icp/src/canister/recipe/handlebars.rs

Lines changed: 0 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -269,160 +269,6 @@ impl HelperDef for ReplaceHelper {
269269
}
270270
}
271271

272-
/// Handlebars partial for shrinking WASM modules using ic-wasm
273-
/// Reduces module size by removing unnecessary sections while preserving name sections
274-
pub const WASM_SHRINK_PARTIAL: &str = r#"
275-
- type: script
276-
commands:
277-
- sh -c 'command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; }'
278-
- sh -c 'ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" shrink --keep-name-section'
279-
"#;
280-
281-
/// Handlebars partial for compressing WASM modules using gzip
282-
/// Reduces deployment size and costs by applying gzip compression
283-
pub const WASM_COMPRESS_PARTIAL: &str = r#"
284-
- type: script
285-
commands:
286-
- sh -c 'command -v gzip >/dev/null 2>&1 || { echo >&2 "gzip not found. Please install gzip to compress build output. \n"; exit 1; }'
287-
- sh -c 'gzip --no-name "$ICP_WASM_OUTPUT_PATH"'
288-
- sh -c 'mv "${ICP_WASM_OUTPUT_PATH}.gz" "$ICP_WASM_OUTPUT_PATH"'
289-
"#;
290-
291-
/// Handlebars partial that combines shrinking and compression optimizations
292-
/// Provides a convenient way to apply both wasm-shrink and wasm-compress operations
293-
pub const WASM_OPTIMIZE_PARTIAL: &str = r#"
294-
{{> wasm-shrink }}
295-
{{> wasm-compress }}
296-
"#;
297-
298-
/// Handlebars partial for injecting custom metadata into WASM modules
299-
/// Expects 'name' and 'value' variables to be set in the template context
300-
pub const WASM_INJECT_METADATA_PARTIAL: &str = r#"
301-
- type: script
302-
commands:
303-
- sh -c 'command -v ic-wasm >/dev/null 2>&1 || { echo >&2 "ic-wasm not found. To install ic-wasm, see https://github.com/dfinity/ic-wasm \n"; exit 1; }'
304-
- sh -c 'ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "{{ name }}" -d "{{ value }}" --keep-name-section'
305-
"#;
306-
307-
/// Template for pre-built canister recipes
308-
/// Supports optional shrink, compress, and metadata configuration
309-
pub const PREBUILT_CANISTER_TEMPLATE: &str = r#"
310-
build:
311-
steps:
312-
- type: pre-built
313-
path: {{ path }}
314-
sha256: {{ sha256 }}
315-
316-
{{> wasm-inject-metadata name="template:type" value="pre-built" }}
317-
318-
{{#if metadata }}
319-
{{#each metadata }}
320-
{{> wasm-inject-metadata name=name value=value }}
321-
{{/each}}
322-
{{/if}}
323-
324-
{{#if shrink }}
325-
{{> wasm-shrink }}
326-
{{/if}}
327-
328-
{{#if compress }}
329-
{{> wasm-compress }}
330-
{{/if}}
331-
"#;
332-
333-
/// Template for assets canister recipes
334-
/// Downloads the official assets canister WASM and configures asset synchronization
335-
pub const ASSETS_CANISTER_TEMPLATE: &str = r#"
336-
build:
337-
steps:
338-
- type: pre-built
339-
url: https://github.com/dfinity/sdk/raw/refs/tags/{{ version }}/src/distributed/assetstorage.wasm.gz
340-
341-
{{> wasm-inject-metadata name="template:type" value="assets" }}
342-
343-
{{#if metadata }}
344-
{{#each metadata }}
345-
{{> wasm-inject-metadata name=name value=value }}
346-
{{/each}}
347-
{{/if}}
348-
349-
{{#if shrink }}
350-
{{> wasm-shrink }}
351-
{{/if}}
352-
353-
{{#if compress }}
354-
{{> wasm-compress }}
355-
{{/if}}
356-
357-
sync:
358-
steps:
359-
- type: assets
360-
dir: {{ dir }}
361-
"#;
362-
363-
/// Template for Motoko canister recipes
364-
/// Compiles Motoko source code using the moc compiler
365-
pub const MOTOKO_CANISTER_TEMPLATE: &str = r#"
366-
build:
367-
steps:
368-
- type: script
369-
commands:
370-
- sh -c 'command -v moc >/dev/null 2>&1 || { echo >&2 "moc not found. To install moc, see https://internetcomputer.org/docs/building-apps/getting-started/install \n"; exit 1; }'
371-
- sh -c 'moc {{ entry }}'
372-
- sh -c 'mv main.wasm "$ICP_WASM_OUTPUT_PATH"'
373-
374-
- type: script
375-
commands:
376-
- sh -c 'ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "moc:version" -d "$(moc --version)" --keep-name-section'
377-
378-
{{> wasm-inject-metadata name="template:type" value="motoko" }}
379-
380-
{{#if metadata }}
381-
{{#each metadata }}
382-
{{> wasm-inject-metadata name=name value=value }}
383-
{{/each}}
384-
{{/if}}
385-
386-
{{#if shrink }}
387-
{{> wasm-shrink }}
388-
{{/if}}
389-
390-
{{#if compress }}
391-
{{> wasm-compress }}
392-
{{/if}}
393-
"#;
394-
395-
/// Template for Rust canister recipes
396-
/// Builds Rust canisters using Cargo with WASM target
397-
pub const RUST_CANISTER_TEMPLATE: &str = r#"
398-
build:
399-
steps:
400-
- type: script
401-
commands:
402-
- cargo build --package {{ package }} --target wasm32-unknown-unknown --release
403-
- sh -c 'mv target/wasm32-unknown-unknown/release/{{ replace "-" "_" package }}.wasm "$ICP_WASM_OUTPUT_PATH"'
404-
405-
- type: script
406-
commands:
407-
- sh -c 'ic-wasm "$ICP_WASM_OUTPUT_PATH" -o "${ICP_WASM_OUTPUT_PATH}" metadata "cargo:version" -d "$(cargo --version)" --keep-name-section'
408-
409-
{{> wasm-inject-metadata name="template:type" value="rust" }}
410-
411-
{{#if metadata }}
412-
{{#each metadata }}
413-
{{> wasm-inject-metadata name=name value=value }}
414-
{{/each}}
415-
{{/if}}
416-
417-
{{#if shrink }}
418-
{{> wasm-shrink }}
419-
{{/if}}
420-
421-
{{#if compress }}
422-
{{> wasm-compress }}
423-
{{/if}}
424-
"#;
425-
426272
/// Helper function to verify sha256 checksum of recipe template bytes
427273
fn verify_checksum(bytes: &[u8], expected: &str) -> Result<(), Box<HandlebarsError>> {
428274
let actual = hex::encode({

0 commit comments

Comments
 (0)