{"id":29022042,"url":"https://github.com/jsweb/packs","last_synced_at":"2025-06-26T02:37:38.698Z","repository":{"id":33095740,"uuid":"143955069","full_name":"jsweb/packs","owner":"jsweb","description":"A simple, fast and objective manager for packages, snippets, assets or anything with no dependencies.","archived":false,"fork":false,"pushed_at":"2022-08-16T19:19:25.000Z","size":118,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-15T10:15:38.929Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jsweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-08T03:15:33.000Z","updated_at":"2022-08-16T19:07:23.000Z","dependencies_parsed_at":"2022-07-29T03:47:56.972Z","dependency_job_id":null,"html_url":"https://github.com/jsweb/packs","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/jsweb/packs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsweb%2Fpacks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsweb%2Fpacks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsweb%2Fpacks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsweb%2Fpacks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jsweb","download_url":"https://codeload.github.com/jsweb/packs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jsweb%2Fpacks/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261988005,"owners_count":23240949,"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":"2025-06-26T02:37:35.871Z","updated_at":"2025-06-26T02:37:38.676Z","avatar_url":"https://github.com/jsweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @jsweb/packs\n\nA simple, fast and objective manager for modules, snippets, assets or anything with no dependencies.\n\n**Note:** Since version 3.0.0, @jsweb/packs requires Node.js v16.0.0 or higher and should break compatibility with older Node.js versions. Some new features in Node.js are still experimental and may log warnings on the console.\n\n- CLI\n- Modules/Snippets/Assets manager\n- Simple, fast, objective\n- Get only files you want from NPM packages\n- Fetch Gist and Gitlab snippets to save as code\n- Grab anything from the web\n- All automated with a simple JSON setup\n\n---\n\n- [@jsweb/packs](#jswebpacks)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [Result](#result)\n  - [@jsweb/packs directory](#jswebpacks-directory)\n  - [CLI commands](#cli-commands)\n    - [update (default)](#update-default)\n    - [add](#add)\n    - [del](#del)\n    - [list](#list)\n  - [How it works](#how-it-works)\n    - [NPM / Unpkg](#npm--unpkg)\n    - [Gist and Gitlab Snippets](#gist-and-gitlab-snippets)\n    - [Web / Anything](#web--anything)\n\n---\n\n## Install\n\nIn your project:\n\n```\nnpm i -D @jsweb/packs\n```\n\nOr...\n\n```\nyarn add @jsweb/packs\n```\n\nThen, include a new command in `package.json` into `scripts` section:\n\n```json\n{\n  \"scripts\": {\n    \"packs\": \"packs\"\n  }\n}\n```\n\nChoose a name of your preference, but point it to `packs`, or just use with NPX or Yarn into your project folder: `npx packs` or `yarn packs`.\n\nIf you prefer, install it globaly: `npm i -g @jsweb/packs` or `yarn global add @jsweb/packs`.\n\nThen you can run `packs` CLI anywhere.\n\nOr, use with NPX without install: `npx -p @jsweb/packs packs`.\n\n## Usage\n\n**@jsweb/packs** reads a section at your `package.json` file to register packages, snippets, gists or anything you want to fetch from web into your project.\n\nJust create a `@jsweb/packs` section like this:\n\n```json\n{\n  \"@jsweb/packs\": {\n    \"dir\": \"jsweb-packs\",\n    \"gist\": {\n      \"asq.js\": \"jyamashiro24/17ac171a73246744b09a47d6c9d77241\",\n      \"steven89/kav.js\": \"steven89/f7aedca683deee6ee8211399e94cd583\"\n    },\n    \"gitlab\": {\n      \"dom.js\": \"34295\",\n      \"dstrbg.styl\": \"1662645\",\n      \"tpl/render.js\": \"1663326\"\n    },\n    \"unpkg\": {\n      \"moment.js\": \"moment/min/moment-with-locales.min.js\",\n      \"jsweb/truetype.js\": \"@jsweb/truetype\",\n      \"normalize.css\": \"normalize.css\"\n    },\n    \"web\": {\n      \"animate.css\": \"https://raw.githubusercontent.com/daneden/animate.css/master/animate.min.css\",\n      \"img/js.svg\": \"https://upload.wikimedia.org/wikipedia/commons/9/99/Unofficial_JavaScript_logo_2.svg\"\n    }\n  }\n}\n```\n\nThen, just run `packs update` CLI command!\n\n**key : value** pairs within sections represent **destination : source**, so **key** is the filename where the asset will be saved and **value** is the source to fetch its content.\n\nYou can save your assets in sub directories by setting **key** as a path to save into respective section.\n\n## Result\n\n**@jsweb/packs** saves downloaded files into a diretory structure corresponding to `@jsweb/packs` section at `package.json`:\n\n```\n./\n| -${packs dir}\n  | - gist\n  | - gitlab\n  | - unpkg\n  | - web\n```\n\n## @jsweb/packs directory\n\n**@jsweb/packs** default dir is a `jsweb-packs` folder at `package.json` root directory, but it is possible to set a custom path to save your assets.\n\nJust define `dir` on setup at `package.json`:\n\n```json\n{\n  \"@jsweb/packs\": {\n    \"dir\": \"path/to/your/custom/packs\"\n  }\n}\n```\n\n## CLI commands\n\n**@jsweb/packs** CLI support some simple commands. If none is given, `help` is default.\n\n### update\n\nUpdate/fetch all of your assets with this simple command: `packs update`.\n\n**Important:** By default, this command rewrites `@jsweb/packs` section at `package.json` file to properly sort the content. If you need to prevent this behavior for CI/CD or any other production workflow, make sure to set `NODE_ENV` to any value which not contains `dev` (case not sensitive).\n\n### add\n\nYou can add new assets to your project by manually adding `@jsweb/packs` section at `package.json` and runing `update` command.\n\nBut `packs add [type] [dest] [source]` command is a convenient way:\n\n```bash\npacks add unpkg moment.js moment/min/moment-with-locales.min.js\n\npacks add gist steven89/kav.js steven89/f7aedca683deee6ee8211399e94cd583\n\npacks add gitlab dom.js 34295\n\npacks add web animate.css https://raw.githubusercontent.com/daneden/animate.css/master/animate.min.css\n```\n\nArguments must follow this pattern:\n\n- **type** the resource type where the asset is hosted, section within `@jsweb/packs` at `package.json` and folder into `@jsweb/packs-\u003edir`\n- **dest** defines the destination path/filename where to save content\n- **source** is an ID, PATH or URL to fetch content\n\n**Important:** This command ever writes data to `package.json` file to update `@jsweb/packs` section.\n\n### del\n\nTo remove assets you can just delete files from directory and remove entry from `@jsweb/packs` section at `package.json`.\n\nBut you can simply run `packs del [type] [file]`:\n\n```\npacks del web jquery.js\n```\n\n**Important:** This command ever writes data to `package.json` file to update `@jsweb/packs` section.\n\n### list\n\nPrints `@jsweb/packs` section from `package.json`. Just for convenience!\n\n```\npacks list\n```\n\n## How it works\n\n### NPM / Unpkg\n\n**@jsweb/packs** gets the code of NPM packages from Unpkg CDN.\n\nOptionally, you can use SEMVER tags if you need to specify packages versions, like:\n\n```json\n{\n  \"@jsweb/packs\": {\n    \"unpkg\": {\n      \"moment.js\": \"moment@2.22.2/min/moment-with-locales.min.js\"\n    }\n  }\n}\n```\n\nIf no version was defined, the latest version is the default at Unpkg CDN.\n\n### Gist and Gitlab Snippets\n\nFor code snippets repositories, **@jsweb/packs** simply fetch raw files as is.\n\nThe codes must to be public available.\n\nGists need `user/hash` to identify and get the code. Gitlab Snippets just need an `id`.\n\n### Web / Anything\n\n**@jsweb/packs** can fetch any online public file. Just map it into `web` section, like this:\n\n```json\n{\n  \"@jsweb/packs\": {\n    \"web\": {\n      \"img/js.svg\": \"https://upload.wikimedia.org/wikipedia/commons/9/99/Unofficial_JavaScript_logo_2.svg\",\n      \"img/npm-do-more.svg\": \"https://static.npmjs.com/images/saas-features/do-more-faster.svg\"\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsweb%2Fpacks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsweb%2Fpacks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsweb%2Fpacks/lists"}