Skip to content

Optimize action size #589

@tripodsan

Description

@tripodsan

the deployment size of the action(s) is pretty large. for example, the actions in https://github.com/adobe/developer.adobe.com amount to:

$ du -ch .hlx/build/*.zip
9.0M	.hlx/build/default_html.zip
8.0M	.hlx/build/docs_html.zip
8.0M	.hlx/build/html.zip
6.0M	.hlx/build/sitemap_xml.zip
3.0M	.hlx/build/static.zip
8.0M	.hlx/build/summary_html.zip
 42M	total

where as the size of the actual javascript is rather small:

$ du -ch .hlx/build/*.js
4.0K	.hlx/build/DOM_munging.js
4.0K	.hlx/build/default_html.js
8.0K	.hlx/build/default_html.pre.js
 12K	.hlx/build/docs_html.js
 12K	.hlx/build/docs_html.pre.js
 12K	.hlx/build/html.js
4.0K	.hlx/build/html.pre.js
4.0K	.hlx/build/mountpoint_resolution.js
4.0K	.hlx/build/sitemap_xml.js
8.0K	.hlx/build/summary_html.js
8.0K	.hlx/build/summary_html.pre.js
 80K	total

there are several ways to improve this:

1. be better at bundling the dependencies

the dependent modules are included by adding their entire directory (in node_modules) to the action. so far, all experiments using webpack to create a single file failed due to dynamic includes in some of the dependencies.

but it should be possible to single the problematic ones out and try to bundle as much as possible in a single file.

2. collate the actions

all actions use more or less the same dependencies. if we would only have 1 action (like @tysonnorris suggests, anyways :-) we would reduce deployment size dramatically (and also improve the container/action reusability)

3. reduce dependencies

for the internal helix dependencies (like helix-pipeline), we should reduce the dependency tree. there is so much code that is unused and only comes as baggage (unfortunately, the big libraries are also the ones that cannot easy be webpacked)


Example Dependencies:

html.info.json

    "@adobe/helix-pipeline": "helix-cli/node_modules/@adobe/helix-pipeline",
    "@adobe/htlengine": "helix-cli/node_modules/@adobe/htlengine",
    "@adobe/openwhisk-loggly-wrapper": "helix-cli/node_modules/@adobe/openwhisk-loggly-wrapper",
    "abab": "helix-cli/node_modules/abab",
    "ajv": "helix-cli/node_modules/ajv",
    "antlr4": "helix-cli/node_modules/antlr4",
    "arr-diff": "helix-cli/node_modules/arr-diff",
    "arr-flatten": "helix-cli/node_modules/arr-flatten",
    "arr-union": "helix-cli/node_modules/arr-union",
    "array-equal": "helix-cli/node_modules/array-equal",
    "array-iterate": "helix-cli/node_modules/array-iterate",
    "array-unique": "helix-cli/node_modules/array-unique",
    "asn1": "helix-cli/node_modules/asn1",
    "assert-plus": "helix-cli/node_modules/assert-plus",
    "assign-symbols": "helix-cli/node_modules/assign-symbols",
    "async-limiter": "helix-cli/node_modules/async-limiter",
    "async": "helix-cli/node_modules/async",
    "asynckit": "helix-cli/node_modules/asynckit",
    "atob": "helix-cli/node_modules/atob",
    "aws-sign2": "helix-cli/node_modules/aws-sign2",
    "aws4": "helix-cli/node_modules/aws4",
    "bail": "helix-cli/node_modules/bail",
    "base": "helix-cli/node_modules/base",
    "bcrypt-pbkdf": "helix-cli/node_modules/bcrypt-pbkdf",
    "boolbase": "helix-cli/node_modules/boolbase",
    "braces": "helix-cli/node_modules/braces",
    "browser-process-hrtime": "helix-cli/node_modules/browser-process-hrtime",
    "cache-base": "helix-cli/node_modules/cache-base",
    "callsites": "helix-cli/node_modules/callsites",
    "caseless": "helix-cli/node_modules/caseless",
    "ccount": "helix-cli/node_modules/ccount",
    "character-entities-html4": "helix-cli/node_modules/character-entities-html4",
    "character-entities-legacy": "helix-cli/node_modules/character-entities-legacy",
    "character-entities": "helix-cli/node_modules/character-entities",
    "character-reference-invalid": "helix-cli/node_modules/character-reference-invalid",
    "class-utils": "helix-cli/node_modules/class-utils",
    "co": "helix-cli/node_modules/co",
    "collapse-white-space": "helix-cli/node_modules/collapse-white-space",
    "collection-visit": "helix-cli/node_modules/collection-visit",
    "color-convert": "helix-cli/node_modules/color-convert",
    "color-name": "helix-cli/node_modules/color-name",
    "color-string": "helix-cli/node_modules/color-string",
    "color": "helix-cli/node_modules/color",
    "colornames": "helix-cli/node_modules/colornames",
    "colors": "helix-cli/node_modules/colors",
    "colorspace": "helix-cli/node_modules/colorspace",
    "combined-stream": "helix-cli/node_modules/combined-stream",
    "comma-separated-tokens": "helix-cli/node_modules/comma-separated-tokens",
    "component-emitter": "helix-cli/node_modules/component-emitter",
    "copy-descriptor": "helix-cli/node_modules/copy-descriptor",
    "core-util-is": "helix-cli/node_modules/core-util-is",
    "css-selector-parser": "helix-cli/node_modules/css-selector-parser",
    "cssom": "helix-cli/node_modules/cssom",
    "cssstyle": "helix-cli/node_modules/cssstyle",
    "data-urls": "helix-cli/node_modules/data-urls",
    "debug": "helix-cli/node_modules/debug",
    "decode-uri-component": "helix-cli/node_modules/decode-uri-component",
    "define-property": "helix-cli/node_modules/define-property",
    "delayed-stream": "helix-cli/node_modules/delayed-stream",
    "detab": "helix-cli/node_modules/detab",
    "diagnostics": "helix-cli/node_modules/diagnostics",
    "domexception": "helix-cli/node_modules/domexception",
    "ecc-jsbn": "helix-cli/node_modules/ecc-jsbn",
    "enabled": "helix-cli/node_modules/enabled",
    "env-variable": "helix-cli/node_modules/env-variable",
    "esprima": "helix-cli/node_modules/esprima",
    "expand-brackets": "helix-cli/node_modules/expand-brackets",
    "extend-shallow": "helix-cli/node_modules/extend-shallow",
    "extend": "helix-cli/node_modules/extend",
    "extglob": "helix-cli/node_modules/extglob",
    "extsprintf": "helix-cli/node_modules/extsprintf",
    "fast-deep-equal": "helix-cli/node_modules/fast-deep-equal",
    "fast-json-stable-stringify": "helix-cli/node_modules/fast-json-stable-stringify",
    "fast-safe-stringify": "helix-cli/node_modules/fast-safe-stringify",
    "fault": "helix-cli/node_modules/fault",
    "fecha": "helix-cli/node_modules/fecha",
    "fill-range": "helix-cli/node_modules/fill-range",
    "for-in": "helix-cli/node_modules/for-in",
    "forever-agent": "helix-cli/node_modules/forever-agent",
    "form-data": "helix-cli/node_modules/form-data",
    "format": "helix-cli/node_modules/format",
    "fragment-cache": "helix-cli/node_modules/fragment-cache",
    "fs-extra": "helix-cli/node_modules/fs-extra",
    "get-value": "helix-cli/node_modules/get-value",
    "graceful-fs": "helix-cli/node_modules/graceful-fs",
    "har-schema": "helix-cli/node_modules/har-schema",
    "har-validator": "helix-cli/node_modules/har-validator",
    "has-value": "helix-cli/node_modules/has-value",
    "has-values": "helix-cli/node_modules/has-values",
    "hast-util-from-parse5": "helix-cli/node_modules/hast-util-from-parse5",
    "hast-util-is-element": "helix-cli/node_modules/hast-util-is-element",
    "hast-util-parse-selector": "helix-cli/node_modules/hast-util-parse-selector",
    "hast-util-to-html": "helix-cli/node_modules/hast-util-to-html",
    "hast-util-whitespace": "helix-cli/node_modules/hast-util-whitespace",
    "hastscript": "helix-cli/node_modules/hastscript",
    "html-encoding-sniffer": "helix-cli/node_modules/html-encoding-sniffer",
    "html-void-elements": "helix-cli/node_modules/html-void-elements",
    "http-signature": "helix-cli/node_modules/http-signature",
    "inherits": "helix-cli/node_modules/inherits",
    "is-accessor-descriptor": "helix-cli/node_modules/is-accessor-descriptor",
    "is-alphabetical": "helix-cli/node_modules/is-alphabetical",
    "is-alphanumerical": "helix-cli/node_modules/is-alphanumerical",
    "is-arrayish": "helix-cli/node_modules/is-arrayish",
    "is-buffer": "helix-cli/node_modules/is-buffer",
    "is-data-descriptor": "helix-cli/node_modules/is-data-descriptor",
    "is-decimal": "helix-cli/node_modules/is-decimal",
    "is-descriptor": "helix-cli/node_modules/is-descriptor",
    "is-extendable": "helix-cli/node_modules/is-extendable",
    "is-hexadecimal": "helix-cli/node_modules/is-hexadecimal",
    "is-number": "helix-cli/node_modules/is-number",
    "is-plain-obj": "helix-cli/node_modules/is-plain-obj",
    "is-plain-object": "helix-cli/node_modules/is-plain-object",
    "is-stream": "helix-cli/node_modules/is-stream",
    "is-typedarray": "helix-cli/node_modules/is-typedarray",
    "is-whitespace-character": "helix-cli/node_modules/is-whitespace-character",
    "is-windows": "helix-cli/node_modules/is-windows",
    "is-word-character": "helix-cli/node_modules/is-word-character",
    "isarray": "helix-cli/node_modules/isarray",
    "isobject": "helix-cli/node_modules/isobject",
    "isstream": "helix-cli/node_modules/isstream",
    "js-yaml": "helix-cli/node_modules/js-yaml",
    "jsbn": "helix-cli/node_modules/jsbn",
    "jsdom": "helix-cli/node_modules/jsdom",
    "json-schema-traverse": "helix-cli/node_modules/json-schema-traverse",
    "json-schema": "helix-cli/node_modules/json-schema",
    "json-stringify-safe": "helix-cli/node_modules/json-stringify-safe",
    "jsonfile": "helix-cli/node_modules/jsonfile",
    "jsprim": "helix-cli/node_modules/jsprim",
    "kind-of": "helix-cli/node_modules/kind-of",
    "kuler": "helix-cli/node_modules/kuler",
    "lodash.sortby": "helix-cli/node_modules/lodash.sortby",
    "logform": "helix-cli/node_modules/logform",
    "map-cache": "helix-cli/node_modules/map-cache",
    "map-visit": "helix-cli/node_modules/map-visit",
    "markdown-escapes": "helix-cli/node_modules/markdown-escapes",
    "mdast-util-definitions": "helix-cli/node_modules/mdast-util-definitions",
    "mdast-util-to-hast": "helix-cli/node_modules/mdast-util-to-hast",
    "mdast-util-to-string": "helix-cli/node_modules/mdast-util-to-string",
    "mdurl": "helix-cli/node_modules/mdurl",
    "micromatch": "helix-cli/node_modules/micromatch",
    "mime-db": "helix-cli/node_modules/mime-db",
    "mime-types": "helix-cli/node_modules/mime-types",
    "mixin-deep": "helix-cli/node_modules/mixin-deep",
    "ms": "helix-cli/node_modules/ms",
    "nanomatch": "helix-cli/node_modules/nanomatch",
    "nlcst-to-string": "helix-cli/node_modules/nlcst-to-string",
    "node-esapi": "helix-cli/node_modules/node-esapi",
    "node-loggly-bulk": "helix-cli/node_modules/node-loggly-bulk",
    "not": "helix-cli/node_modules/not",
    "nth-check": "helix-cli/node_modules/nth-check",
    "nwsapi": "helix-cli/node_modules/nwsapi",
    "oauth-sign": "helix-cli/node_modules/oauth-sign",
    "object-assign": "helix-cli/node_modules/object-assign",
    "object-copy": "helix-cli/node_modules/object-copy",
    "object-hash": "helix-cli/node_modules/object-hash",
    "object-visit": "helix-cli/node_modules/object-visit",
    "object.pick": "helix-cli/node_modules/object.pick",
    "one-time": "helix-cli/node_modules/one-time",
    "parse-entities": "helix-cli/node_modules/parse-entities",
    "parse-latin": "helix-cli/node_modules/parse-latin",
    "parse5": "helix-cli/node_modules/parse5",
    "pascalcase": "helix-cli/node_modules/pascalcase",
    "performance-now": "helix-cli/node_modules/performance-now",
    "pn": "helix-cli/node_modules/pn",
    "posix-character-classes": "helix-cli/node_modules/posix-character-classes",
    "process-nextick-args": "helix-cli/node_modules/process-nextick-args",
    "property-information": "helix-cli/node_modules/property-information",
    "psl": "helix-cli/node_modules/psl",
    "qs": "helix-cli/node_modules/qs",
    "readable-stream": "helix-cli/node_modules/winston-transport/node_modules/readable-stream",
    "regex-not": "helix-cli/node_modules/regex-not",
    "rehype-parse": "helix-cli/node_modules/rehype-parse",
    "remark-frontmatter": "helix-cli/node_modules/remark-frontmatter",
    "remark-parse": "helix-cli/node_modules/remark-parse",
    "repeat-element": "helix-cli/node_modules/repeat-element",
    "repeat-string": "helix-cli/node_modules/repeat-string",
    "replace-ext": "helix-cli/node_modules/replace-ext",
    "request-promise-core": "helix-cli/node_modules/request-promise-core",
    "request-promise-native": "helix-cli/node_modules/request-promise-native",
    "request": "helix-cli/node_modules/request",
    "ret": "helix-cli/node_modules/ret",
    "retext-latin": "helix-cli/node_modules/retext-latin",
    "retext-smartypants": "helix-cli/node_modules/retext-smartypants",
    "retext-stringify": "helix-cli/node_modules/retext-stringify",
    "retext": "helix-cli/node_modules/retext",
    "safe-buffer": "helix-cli/node_modules/safe-buffer",
    "safe-regex": "helix-cli/node_modules/safe-regex",
    "safer-buffer": "helix-cli/node_modules/safer-buffer",
    "sanitizer": "helix-cli/node_modules/sanitizer",
    "saxes": "helix-cli/node_modules/saxes",
    "set-value": "helix-cli/node_modules/set-value",
    "simple-swizzle": "helix-cli/node_modules/simple-swizzle",
    "snapdragon-node": "helix-cli/node_modules/snapdragon-node",
    "snapdragon-util": "helix-cli/node_modules/snapdragon-util",
    "snapdragon": "helix-cli/node_modules/snapdragon",
    "source-map-resolve": "helix-cli/node_modules/source-map-resolve",
    "source-map-url": "helix-cli/node_modules/source-map-url",
    "source-map": "helix-cli/node_modules/source-map",
    "space-separated-tokens": "helix-cli/node_modules/space-separated-tokens",
    "split-string": "helix-cli/node_modules/split-string",
    "sshpk": "helix-cli/node_modules/sshpk",
    "stack-trace": "helix-cli/node_modules/stack-trace",
    "state-toggle": "helix-cli/node_modules/state-toggle",
    "static-extend": "helix-cli/node_modules/static-extend",
    "stealthy-require": "helix-cli/node_modules/stealthy-require",
    "string_decoder": "helix-cli/node_modules/string_decoder",
    "stringify-entities": "helix-cli/node_modules/stringify-entities",
    "symbol-tree": "helix-cli/node_modules/symbol-tree",
    "text-hex": "helix-cli/node_modules/text-hex",
    "to-object-path": "helix-cli/node_modules/to-object-path",
    "to-regex-range": "helix-cli/node_modules/to-regex-range",
    "to-regex": "helix-cli/node_modules/to-regex",
    "tough-cookie": "helix-cli/node_modules/tough-cookie",
    "tr46": "helix-cli/node_modules/tr46",
    "trim-lines": "helix-cli/node_modules/trim-lines",
    "trim-trailing-lines": "helix-cli/node_modules/trim-trailing-lines",
    "trim": "helix-cli/node_modules/trim",
    "triple-beam": "helix-cli/node_modules/triple-beam",
    "trough": "helix-cli/node_modules/trough",
    "tunnel-agent": "helix-cli/node_modules/tunnel-agent",
    "tweetnacl": "helix-cli/node_modules/tweetnacl",
    "unherit": "helix-cli/node_modules/unherit",
    "unified": "helix-cli/node_modules/unified",
    "union-value": "helix-cli/node_modules/union-value",
    "unist-builder": "helix-cli/node_modules/unist-builder",
    "unist-util-find-all-between": "helix-cli/node_modules/unist-util-find-all-between",
    "unist-util-generated": "helix-cli/node_modules/unist-util-generated",
    "unist-util-is": "helix-cli/node_modules/unist-util-is",
    "unist-util-map": "helix-cli/node_modules/unist-util-map",
    "unist-util-modify-children": "helix-cli/node_modules/unist-util-modify-children",
    "unist-util-position": "helix-cli/node_modules/unist-util-position",
    "unist-util-remove-position": "helix-cli/node_modules/unist-util-remove-position",
    "unist-util-select": "helix-cli/node_modules/unist-util-select",
    "unist-util-stringify-position": "helix-cli/node_modules/unist-util-stringify-position",
    "unist-util-visit-children": "helix-cli/node_modules/unist-util-visit-children",
    "unist-util-visit-parents": "helix-cli/node_modules/unist-util-visit-parents",
    "unist-util-visit": "helix-cli/node_modules/unist-util-visit",
    "universalify": "helix-cli/node_modules/universalify",
    "unset-value": "helix-cli/node_modules/unset-value",
    "uri-js": "helix-cli/node_modules/uri-js",
    "urijs": "helix-cli/node_modules/urijs",
    "urix": "helix-cli/node_modules/urix",
    "use": "helix-cli/node_modules/use",
    "util-deprecate": "helix-cli/node_modules/util-deprecate",
    "uuid": "helix-cli/node_modules/uuid",
    "verror": "helix-cli/node_modules/verror",
    "vfile-location": "helix-cli/node_modules/vfile-location",
    "vfile-message": "helix-cli/node_modules/vfile-message",
    "vfile": "helix-cli/node_modules/vfile",
    "w3c-hr-time": "helix-cli/node_modules/w3c-hr-time",
    "w3c-xmlserializer": "helix-cli/node_modules/w3c-xmlserializer",
    "web-namespaces": "helix-cli/node_modules/web-namespaces",
    "webidl-conversions": "helix-cli/node_modules/webidl-conversions",
    "whatwg-encoding": "helix-cli/node_modules/whatwg-encoding",
    "whatwg-mimetype": "helix-cli/node_modules/whatwg-mimetype",
    "whatwg-url": "helix-cli/node_modules/whatwg-url",
    "winston-transport": "helix-cli/node_modules/winston-transport",
    "winston": "helix-cli/node_modules/winston",
    "x-is-string": "helix-cli/node_modules/x-is-string",
    "xml-name-validator": "helix-cli/node_modules/xml-name-validator",
    "xmlchars": "helix-cli/node_modules/xmlchars",
    "xtend": "helix-cli/node_modules/xtend",
    "zwitch": "helix-cli/node_modules/zwitch"
  }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions