Skip to content

Instantly share code, notes, and snippets.

@bengl
Created September 23, 2018 05:22
Show Gist options
  • Select an option

  • Save bengl/bbc53e6cc24e6778317d7c2ac78c142d to your computer and use it in GitHub Desktop.

Select an option

Save bengl/bbc53e6cc24e6778317d7c2ac78c142d to your computer and use it in GitHub Desktop.

Revisions

  1. bengl created this gist Sep 23, 2018.
    48 changes: 48 additions & 0 deletions qdd-cowsay-demo.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    // Try running this file with:
    //
    // npx -p bengl/qdd qdd-node qdd-cowsay-demo.js
    //
    // `qdd-node` will read the package-lock data below, use it to install the
    // dependencies to the qdd cache, then run this file with a shimmed module
    // loader that will load from the qdd cache!
    //
    // This would also work with an ordinary package-lock.json file in the $PWD.
    //
    // Note that the data here is stripped-down and not npm-compatible, but it's
    // enough for qdd.

    console.log(require('cowsay').say({ text: 'Hello, cows!' }));

    /**package-lock
    {
    "dependencies": {
    "ansi-regex": {
    "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
    "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
    },
    "cowsay": {
    "resolved": "https://registry.npmjs.org/cowsay/-/cowsay-1.3.1.tgz",
    "integrity": "sha512-3PVFe6FePVtPj1HTeLin9v8WyLl+VmM1l1H/5P+BTTDkMAjufp+0F9eLjzRnOHzVAYeIYFF5po5NjRrgefnRMQ==",
    "requires": { "string-width": "~2.1.1", "strip-eof": "^1.0.0" }
    },
    "is-fullwidth-code-point": {
    "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
    "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
    },
    "string-width": {
    "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz",
    "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==",
    "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" }
    },
    "strip-ansi": {
    "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
    "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
    "requires": { "ansi-regex": "^3.0.0" }
    },
    "strip-eof": {
    "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz",
    "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8="
    }
    }
    }
    **/