Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chase-moskal/importly
import map generator
https://github.com/chase-moskal/importly
es-modules import-maps package-manager
Last synced: 3 months ago
JSON representation
import map generator
- Host: GitHub
- URL: https://github.com/chase-moskal/importly
- Owner: chase-moskal
- License: mit
- Created: 2019-03-22T01:45:32.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-11-07T02:58:16.000Z (about 1 year ago)
- Last Synced: 2024-10-15T18:03:43.300Z (4 months ago)
- Topics: es-modules, import-maps, package-manager
- Language: TypeScript
- Homepage:
- Size: 226 KB
- Stars: 59
- Watchers: 3
- Forks: 5
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- License: license
Awesome Lists containing this project
README
# 📦📡 ***importly*** — import map generator
importly is a command-line utility that generates [import maps](https://github.com/WICG/import-maps).
so your apps can load es module packages without a bundler.
works nicely with [es-module-shims](https://github.com/guybedford/es-module-shims).
## 🛸 importly basic usage
```sh
npx importly < package-lock.json > importmap.json
```
**`--host=node_modules`**
specify where the import map points to.
where the dependencies will be loaded from.
- `--host=node_modules` *(default)* — point to your node_modules directory
- `--host=unpkg` — point to the [unpkg](https://unpkg.com/) cdn
- `--host=jsdelivr` — point to the [jsdelivr](https://www.jsdelivr.com/) cdn
**`--dev`**
include your package's devDependencies.
**`--lookup=node_modules`**
tell importly where to seek information about packages.
it needs to inspect each package json.
- `--lookup=node_modules` *(default)* — look in your local node_modules directory
- `--lookup=unpkg` — query the [unpkg](https://unpkg.com/) cdn
- `--lookup=jsdelivr` — query the [jsdelivr](https://www.jsdelivr.com/) cdn
**`--root=/`**
the url prefix that leads to your node_modules directory.
this affects where the importmap is pointing to.
only applies when `--host=node_modules`.
- `--root=/` *(default)* — find node_modules at your server root
- `--root=""` — find node_modules in the current directory
- `--root=/my/special/path/` — find node_modules at `/my/special/path/node_modules`
**`--semver=exact`**
the semver prefix to use on the import map versions.
only applies when pointing to a cloud cdn.
- `--semver=exact` or `--semver=""` *(default)* no prefix, use pinned versions
- `--semver=major` or `--semver=^` pin major version, with caret prefix
- `--semver=minor` or `--semver=~` pin minor version, with tilde prefix
**`--mini`**
minify importmap output.
eliminates whitespace.
## 🌠 the more you know, about importly
you don't have to use a `package-lock.json`
- a `package.json` will work.
- actually, any json that has `dependencies` will work.
- however, the `package-lock.json` is better because it includes subdependencies (and they're scoped, which means your dependencies can use different versions of a single subdependency)scoped subdependencies only work when
- you're using a `package-lock.json`
- and you're using `--host=node_modules`works offline when
- you're using `--host=node_modules`
- and you're using `--lookup=node_modules`
## 🍻 importly is open source
- ask any questions in the issues or discussions tab
- fix that bug, send me those pull requests
- show me some love with your sweet github stars