Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

runme

Package Overview
Dependencies
Maintainers
3
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runme - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

bin/runme.js

70

package.json
{
"name": "runme",
"version": "1.0.1",
"main": "index.js",
"bin": {
"runme": "index.js"
"version": "2.0.0",
"author": "Christian Bromann <christian@stateful.com>",
"license": "Apache-2.0",
"description": "A JavaScript module to use Runme in Node.js",
"homepage": "https://github.com/stateful/runmejs#readme",
"bin": "./bin/runme.js",
"type": "module",
"main": "./dist/cjs/index.js",
"module": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": [
{
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/cjs/index.js"
},
"./cjs/index.js"
]
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"description": "Run a code section in a README.md",
"repository": {
"type": "git",
"url": "https://github.com/KoryNunn/runme.git"
"url": "git+https://github.com/stateful/runmejs.git"
},
"keywords": [
"runme"
],
"bugs": {
"url": "https://github.com/KoryNunn/runme/issues"
"url": "https://github.com/stateful/runmejs/issues"
},
"homepage": "https://github.com/KoryNunn/runme"
"scripts": {
"build": "run-s clean compile copy",
"clean": "rimraf dist",
"compile": "tsc -p ./tsconfig.json",
"copy": "cp src/cjs/package.json dist/cjs/package.json",
"postinstall": "node ./postInstall.js",
"release": "release-it --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir",
"test": "run-s test:*",
"test:nodejs": "vitest --config ./vitest.config.ts",
"test:cjs": "ts-node tests/cjs/cjs.test.ts",
"watch": "npm run compile -- --watch"
},
"devDependencies": {
"@octokit/rest": "^19.0.7",
"@types/node": "^18.15.11",
"@types/tar-fs": "^2.0.1",
"@types/wait-on": "^5.3.1",
"@vitest/coverage-c8": "^0.30.1",
"c8": "^7.13.0",
"npm-run-all": "^4.1.5",
"release-it": "^15.10.1",
"rimraf": "^5.0.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"vitest": "^0.30.1"
},
"dependencies": {
"@actions/exec": "^1.1.1",
"get-port": "^6.1.2",
"node-fetch": "^3.3.1",
"tar-fs": "^2.1.1",
"wait-on": "^7.0.1"
}
}

@@ -1,26 +0,76 @@

# RUNME
# Runme.js [![Test Changes](https://github.com/stateful/runmejs/actions/workflows/test.yaml/badge.svg)](https://github.com/stateful/runmejs/actions/workflows/test.yaml) [![npm version](https://badge.fury.io/js/runme.svg)](https://badge.fury.io/js/runme) [![Join us on Discord](https://img.shields.io/discord/878764303052865537?color=5b39df&label=Join%20us%20on%20Discord)](https://discord.com/invite/BQm8zRCBUY)
Run a code section in a README.md
> A JavaScript module to use [Runme](https://runme.dev) in Node.js.
## Usage
_Runme.js_ contains the the [Runme CLI](https://github.com/stateful/runme) and allows to access its functionality through a simple JavaScript interface. The CLI binary is downloaded and cached when the interface is first being used.
In a console, run:
## Install
### Node.js
Install the module through NPM:
```sh
$ npm install runme
# or Yarn
$ yarn add runme
```
runme README.md 1
You can also install the package globally and it as a CLI, e.g.:
```sh
npm i -g runme
runme list
```
where the second code section (section 1) has something like this:
By default this package downloads the [Runme CLI](https://github.com/stateful/runme) when the interface is used for the first time. You can download it after running `npm install` by setting the `RUNME_DOWNLOAD_ON_INSTALL` environment flag. You can also modify the Runme version that is being installed by setting `RUNME_VERSION`, e.g.:
```sh
RUNME_DOWNLOAD_ON_INSTALL=1 RUNME_VERSION=1.0.0 npm install runme
npx runme --version
```
console.log('hello world');
## Usage
The module exposes the following methods:
### `run`
Run code cells from markdown files:
```ts { name="runExample" }
import { run } from 'runme'
const result = await run(
'.examples/example.md',
{ id: 'helloWorld' }
)
console.log(result) // outputs: { exitCode: 0, stdout: 'Hello World\r\n', stderr: '' }
```
which will run the above code.
Similar you can run `runSeries` and `runParallel` if you like to run multiple cells.
Or you can 'name' your sections like so:
### `createServer`
named
Start a Runme execution session:
```ts
import { createServer, run } from 'runme'
const server = await createServer()
// execute `export FOO="bar"` from markdown code cell with id "export"
await run('.examples/example.md', { id: 'export', server })
// execute `echo "exported FOO=$FOO"` from markdown code cell with id "print"
const result = await run('.examples/example.md', { id: 'print', server })
console.log(result) // outputs: { exitCode: 0, stdout: 'exported FOO=bar\r\n', stderr: '' }
```
console.log('named section')
```
---
<p align="center">
<small>
Copyright 2023 © <a href="http://stateful.com/">Stateful</a> – Apache 2.0 License
</small>
</p>
.npmignore
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc