This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| "id": "debug", | |
| "description": "Outputs debugging info\n", | |
| "pluginName": "heroku-debug", | |
| "pluginType": "user", | |
| "hidden": false, | |
| "aliases": [], | |
| "flags": {}, | |
| "args": [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| yarn run v1.5.1 | |
| $ make | |
| Producer | |
| ✓ required methods | |
| ✓ should create producer with default options |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| declare namespace NodeJS { | |
| interface Global { | |
| 'my-object': { | |
| errlog?: string | |
| debug?: boolean | |
| context?: any | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Command} from '@oclif/command' | |
| import axios from 'axios' | |
| export default class Stars extends Command { | |
| static description = 'show the github stars on a repository' | |
| static args = [{name: 'repository', required: true}] | |
| async run() { | |
| const {args} = this.parse(Stars) | |
| const {data: stargazers} = await axios.get(`https://api.github.com/repos/${args.repository}/stargazers`) | |
| for (let s of stargazers) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| protected parse<F, A extends {[name: string]: any}>(options: Parser.Input<F>, argv = this.argv): Parser.Output<F, A> { | |
| const {flags, args, strict} = options | |
| return require('@oclif/parser').parse(argv, {context: this, flags, args, strict}) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fs = require('fs-extra'); | |
| const path = require('path'); | |
| const debug = require('debug')('rwlockfile'); | |
| const mkdir = require('mkdirp'); | |
| let locks = {}; | |
| let readers = {}; | |
| async function pidActive(pid) { | |
| if (!pid || isNaN(pid)) return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const rwlockfile = require('./src/rwlockfile') | |
| rwlockfile.read('foo') | |
| console.log('unread foo in 10s') | |
| setTimeout(() => { | |
| console.log('unreading foo') | |
| rwlockfile.unread('foo') | |
| }, 10000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ./package.json | |
| { | |
| 'cli-engine': { | |
| events: { | |
| preRun: './lib/events/pre_run.js' | |
| } | |
| } | |
| } | |
| // ./lib/events/before_run.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // flag.js | |
| import { merge, type Flag } from 'cli-engine-command/lib/flags' | |
| type Options = $Shape<Flag<boolean>> | |
| export default function ResetFlag (options: Options = {}, env: typeof process.env = process.env): Flag<string> { | |
| const defaultOptions: Options = { | |
| char: 'r', | |
| parse: (input, cmd) => { | |
| if (options.required) throw new Error('you should have set --reset') | |
| } |