npx-import
Advanced tools
Comparing version 0.0.2 to 1.0.0
{ | ||
"name": "npx-import", | ||
"version": "0.0.2", | ||
"description": "NPX import: dynamically install & import packages at runtime, using NPX.", | ||
"version": "1.0.0", | ||
"description": "Runtime dependencies, installed as if by magic ✨", | ||
"main": "lib/index.js", | ||
@@ -17,3 +17,3 @@ "type": "module", | ||
"license": "ISC", | ||
"homepage": "https://github.com/geelen/import-on-demand", | ||
"homepage": "https://github.com/geelen/npx-import", | ||
"devDependencies": { | ||
@@ -20,0 +20,0 @@ "@types/node": "^18.6.3", |
@@ -5,3 +5,3 @@ # 🧙♂️ `npx-import` 🧙♀️ | ||
[![](https://img.shields.io/badge/author-@glenmaddern-blue.svg?style=flat)](https://twitter.com/glenmaddern) ![npm](https://img.shields.io/npm/v/npx-import) ![GitHub last commit](https://img.shields.io/github/last-commit/geelen/npx-import) | ||
[![twitter](https://img.shields.io/badge/author-@glenmaddern-blue.svg?style=flat)](https://twitter.com/glenmaddern) [![npm](https://img.shields.io/npm/v/npx-import)](https://www.npmjs.com/package/npx-import) [![GitHub last commit](https://img.shields.io/github/last-commit/geelen/npx-import)](https://github.com/geelen/npx-import) | ||
@@ -34,2 +34,3 @@ `npx-import` can be used as a drop-in replacement for [dynamic `import()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import): | ||
export async function writeToFile(report: Report, filename: string) { | ||
if (filename.endsWith('.png')) { | ||
@@ -39,2 +40,3 @@ console.log(`This is a PNG! We'll have to compile imagemagick!`) | ||
await magick.renderToPNG(report, filename) | ||
} else if (filename.endsWith('.pdf')) { | ||
@@ -44,2 +46,3 @@ console.log(`Argh, a PDF!? Go make a cuppa, this'll take a while...`) | ||
await pdfBoi.generate(report, filename) | ||
} else { | ||
@@ -77,3 +80,3 @@ console.log(`Writing to ${filename}...`) | ||
Most importantly, though **it's compatible with `npx`!** For example, `npx some-cli --help` can be super fast but `npx some-cli export --type=pdf` can transparently download the required dependencies during execution. It's super neat! | ||
Most importantly, though, **it's compatible with `npx`!** For example, `npx some-cli --help` can be super fast but `npx some-cli export --type=pdf` can transparently download the required dependencies during execution. It's super neat! | ||
@@ -100,3 +103,3 @@ ## Installation | ||
const { default: bigDep } = await npxImport<{ default: BigDep }>('big-dep') | ||
const bigDep = await npxImport<BigDep>('big-dep') | ||
``` | ||
@@ -106,3 +109,3 @@ | ||
Since package versions are no longer tracked in your `package.json`, we recommend being explicit: | ||
* Since package versions are no longer tracked in your `package.json`, we recommend being explicit: | ||
@@ -115,3 +118,3 @@ ```ts | ||
You can also install multiple packages at once: | ||
* You can also install multiple packages at once: | ||
@@ -129,3 +132,3 @@ ```ts | ||
If you ever need the equivalent for `require.resolve` for a package, use `npxResolve`: | ||
* Use `npxResolve` instead of `require.resolve` to get the path (local or temporary) | ||
@@ -280,3 +283,3 @@ ```ts | ||
- CLI packages that want to make `npx my-cli --help` or `npx my-cli init` really fast and dependency-free, but also allow `npx my-cli <cmd>` to pull in arbitrary deps on-demand, without forcing the user to stop, create a local directory, and install dev dependencies. | ||
- Anything already making heavy use of `npx`. You're in the jungle already, baby. | ||
- Anything already making heavy use of `npx`. You're in the jungle, baby. | ||
@@ -283,0 +286,0 @@ --- |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
55097
0
279