{"id":21417938,"url":"https://github.com/msg-systems/delivery-packer","last_synced_at":"2025-03-16T19:21:21.222Z","repository":{"id":57159482,"uuid":"52197844","full_name":"msg-systems/delivery-packer","owner":"msg-systems","description":"Delivery Packer","archived":false,"fork":false,"pushed_at":"2016-08-01T12:27:39.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T23:57:11.206Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/msg-systems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-21T08:37:40.000Z","updated_at":"2016-02-22T17:05:58.000Z","dependencies_parsed_at":"2022-09-08T11:03:45.224Z","dependency_job_id":null,"html_url":"https://github.com/msg-systems/delivery-packer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msg-systems%2Fdelivery-packer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msg-systems%2Fdelivery-packer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msg-systems%2Fdelivery-packer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/msg-systems%2Fdelivery-packer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/msg-systems","download_url":"https://codeload.github.com/msg-systems/delivery-packer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918629,"owners_count":20368745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T19:18:16.471Z","updated_at":"2025-03-16T19:21:21.201Z","avatar_url":"https://github.com/msg-systems.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# delivery-packer\n\nJavaScript lightweight delivery artifact creator. \nThis module is available as node module, \u003ca href='#command-line-interface'\u003ecommand line interface\u003c/a\u003e and \u003ca href='#grunt-plugin'\u003egrunt plugin\u003c/a\u003e.\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/delivery-packer.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/msg-systems/delivery-packer.png\" alt=\"\"/\u003e\n\n## Modules purpose\n\nThis module is used to create delivery artifacts (meaning combined JavaScript and CSS files).\nThe input for the delivery artifacts are `delivery.yaml` files that contain a description of the single `delivery parts` and the proper packaging instructions (`build order`).\n\nThe purpose is simply explained with an amazon metapher:\n\n- We want to get products (single JavaScript libraries) from amazon (`delivery-packer`)\n- So we build a shopping cart (`delivery.yaml`)\n- in the shopping cart we reference to single products (`delivery parts`)\n- at last we want to get our delivery\n\nnow it is amazons (`delivery-packer`) turn\n\n- check the shopping cart (`delivery.yaml`) for legal products (`delivery parts`)\n- bundle the delivery packages in the proper packaging order (`build order`)\n- bundle the order in one or more deliveries\n\t-  one deliverable for JavaScript\n\t-  one for CSS\n\t-  and any assets (images, fonts, etc.) used by the single products\n\n \n## Command Line Interface\n\nThe cli of `delivery-packer` encapsules the node module. The tool has the following interface:\n\n```shell\ndeliveryPacker: USAGE: deliveryPacker [options] arguments\noptions:\n    -V, --version               Print tool version and exit.\n    -h, --help                  Print this help and exit.\n    -v, --verbose               Print verbose processing information.\n    -d ARG, --outputFolder=ARG  Output folder for the created delivery.\n    -a ARG, --assetsFolder=ARG  Output assets folder for the created delivery.\n    -R, --listreg               List all registered delivery parts.\n    -B, --listbld               List delivery build order.\n    -U, --listunused            List unused registered delivery parts.\n    -p ARG, --outputPrefix=ARG  Output file prefix for the delivery.\n    -m, --minimize              Minimize the delivery.\n```\n\n## Grunt Plugin\n\nThe grunt plugin requires Grunt `\u003e=0.4.0` and  encapsules the node module. \n\nIf you haven't used [Grunt](http://gruntjs.com/)\nbefore, be sure to check out the [Getting\nStarted](http://gruntjs.com/getting-started) guide, as it explains how\nto create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as\ninstall and use Grunt plugins. Once you're familiar with that process,\nyou may install this plugin with this command:\n\n```shell\nnpm install delivery-packer --save-dev\n```\n\nOnce the plugin has been installed, it may be enabled inside your\nGruntfile with this line of JavaScript:\n\n```js\ngrunt.loadNpmTasks('delivery-packer');\n```\n\n### deliveryPacker Task\n\n_Run this task with the `grunt deliveryPacker` command._\n\nSince this task is creating possibly more then one output delivery artifact it is not using the grunt files and options as used by grunt. We specify the output using the task options below. The tasks input is a file or directory directing to the initial `delivery.yaml` file.\n\n### Task Options\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003eOption\u003c/th\u003e\n\t\t\u003cth\u003eDefault value\u003c/th\u003e\n\t\t\u003cth\u003eDescription\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003elistreg\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\t\u003ctd\u003eList all registered delivery parts.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003elistbld\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\t\u003ctd\u003eList delivery build order.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003elistunused\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\t\u003ctd\u003eList unused registered delivery parts.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eminimize\u003c/td\u003e\n\t\t\u003ctd\u003efalse\u003c/td\u003e\n\t\t\u003ctd\u003eMinimize the delivery using uglify and cssmin\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eprefix\u003c/td\u003e\n\t\t\u003ctd\u003e\"lib\"\u003c/td\u003e\n\t\t\u003ctd\u003eOutput file prefix for the delivery.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eoutputFolder\u003c/td\u003e\n\t\t\u003ctd\u003e\"bld\"\u003c/td\u003e\n\t\t\u003ctd\u003eOutput folder for the created delivery.\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003eassetsFolder\u003c/td\u003e\n\t\t\u003ctd\u003e\"assets\"\u003c/td\u003e\n\t\t\u003ctd\u003eOutput assets folder for the created delivery.\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n### Task Example\n\n```grunt\n    grunt.initConfig({\n        deliveryPacker: {\n            \"all\": {\n                src: [\".\"],\n                options: {\n                    listreg: true,\n                    listbld: true,\n                    listunused: true,\n                    minimize: true,\n                    outputFolder: \"www/foo\",\n                    outputPrefix: \"bar\",\n                    assetsFolder: \"quux\"\n                }\n            }\n        }\n    });\n\n```\n\n## delivery.yaml\n\nThe `delivery.yaml` file defines the content and the order of the delivery. Since a single `delivery part` might be assembled out of different files the `delivery.yaml` works with alias names for the `delivery parts`. In order to get the artifact delivery order (`build`) work correctly the `delivery parts` must be `registered` with its alias name. The `delivery.yaml` therefore is able to `import` the `delivery parts`.  \n\n### Importing Delivery Parts\n\nAn `import` for a `delivery Part` is done within the `delivery.yaml` using a collection within the `import` attribute. \n\nYou can `import` using \n- a glob pattern like `- deliveryParts/**/*.yaml`. In this case a list of files will be imported.\n- a node module name `- lodash`. In this case the import looks for a `delivery.yaml` inside the node modules root.\n   \n### Delivery Build Order\n\nThe building order of each `delivery part` is specified within the `delivery.yaml` using a collection within the `build` attribute.\n\nThe build order entries reference registered alias names. Due to the `import` functionality the `delivery.yaml` files can be hierarchically and a build order is built sequentially in the order of the 'build' attributes appearances.   \n\nA `delivery part` in the build order can be excluded by later `build` entries using an exclamation mark `!`. Unfortunatly that mark has a meaning in YAML files so we have to wrap the excluded `delivery part` in quotes inside the `delivery.yaml`. \n\n### Example delivery.yaml\n\nThe following example imports all `delivery part` files with the given glob pattern and builds a delivery artifact with the given build order. The alias names for `jquery`, `lodash`, `moment` and `font-awesome` must have been defined in the imported `delivery parts`.\n\n```yaml\nimport:\n# use the glob pattern to import other delivery parts\n- deliveryParts/**/*.yaml\n# use a node module name to import that modules delivery.yaml (it might contain its own build order)\n- lodash\n\nbuild:\n# exclude lodash, since the import already added it to the build order. Quotes around !lodash required.\n- \"!lodash\"\n# add jquery first\n- jquery\n# then readd the lodash part in a different build order - after jquery\n- lodash\n- moment\n- font-awesome\n```\n\n## deliveryPart.yaml\n\nRegistering a `delivery part` is necessary in order to use it in the delivery artifact creation. The `deliveryPart.yaml` register those alias names. \n\n### Delivery Part Registration\n\nInside a `deliveryPart.yaml` the `register` attribute allows the specification of any alias name. That name should be unique in the delivery creation process. Within the defined alias name we can specify the connected `JS`, `CSS`  and `MARKUP` files. Files are defined as a collection using the `-` in the yaml.\n\nThe `CSS` files can be simple strings or an object with `name` and `ASSETS` attribute. The `ASSETS` should be a list of assets used within the CSS file. Those assets will be copied to a folder equal to the registered alias name within the given asset output folder.  \n\n### Example deliveryPart.yaml\n\nThe `delivery part` example registers the `font-awesome` alias and defines the subparts of the single `delivery part`. Font-Awesome only works when its CSS and Fonts are included in the created delivery artifacts.  \n\n```yaml\nregister:\n  # register 'jquery' and direct to its JS file using simple string style\n  jquery:\n    JS:\n    - ../../node_modules/jquery/dist/jquery.js\n  # register 'bootstrap' and direct to all of its JS files using multipe strings\n  bootstrap:\n    JS:\n    - ../lib/bootstrap/js/affix.js\n    - ../lib/bootstrap/js/alert.js\n    - ../lib/bootstrap/js/button.js\n    - ../lib/bootstrap/js/carousel.js\n    - ../lib/bootstrap/js/collapse.js\n    - ../lib/bootstrap/js/dropdown.js\n    - ../lib/bootstrap/js/modal.js\n    - ../lib/bootstrap/js/tooltip.js\n    - ../lib/bootstrap/js/popover.js\n    - ../lib/bootstrap/js/scrollspy.js\n    - ../lib/bootstrap/js/tab.js\n    - ../lib/bootstrap/js/transition.js\n  # register 'normalize.css' and direct to its CSS file using simple string style \n  normalize.css:\n    CSS:\n    - ../../node_modules/normalize.css/normalize.css\n  # register 'font-awesome' and direct to its CSS file - including its ASSETS - using object style \n  font-awesome:\n    CSS:\n    - name: ../node_modules/font-awesome/css/font-awesome.css\n      ASSETS:\n      - ../node_modules/font-awesome/fonts/FontAwesome.otf\n      - ../node_modules/font-awesome/fonts/fontawesome-webfont.eot\n      - ../node_modules/font-awesome/fonts/fontawesome-webfont.svg\n      - ../node_modules/font-awesome/fonts/fontawesome-webfont.ttf\n      - ../node_modules/font-awesome/fonts/fontawesome-webfont.woff\n      - ../node_modules/font-awesome/fonts/fontawesome-webfont.woff2\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsg-systems%2Fdelivery-packer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmsg-systems%2Fdelivery-packer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmsg-systems%2Fdelivery-packer/lists"}