runCreation
Applies a Creation to disk by writing files, sending network requests, and executing shell scripts.
runCreation takes in up to two arguments:
creation(required): a Creation objectsettings(optional): any of:
For example, given this created README.md file, runTemplate would write that file to disk:
import { createTemplate, runTemplate } from 'bingo';
await runCreation({ files: { 'README.md': `# Hello, World!`, },});Settings
Section titled “Settings”offline
Section titled “offline”Whether to skip network requests.
This is equivalent to the --offline CLI flag.
For example, this would only write files to disk, and not send any requests:
import { createTemplate, runTemplate } from 'bingo';import { z } from 'zod';
await runCration( { files: { 'README.md': `# Hello, World!`, }, requests: [ { id: 'default-branch', async send({ octokit }) { await octokit.rest.repos.update({ default_branch: 'main', owner: options.owner, repo: options.repository, }); }, }, ], }, { offline: true, },);system
Section titled “system”File, network, and shell wrapper APIs.
system may contain the following properties, which have the following defaults:
fetchers:createSystemFetchersfs:createWritingFileSystemrunner:createSystemRunnertake: a function that passes those properties to the Input
They can be swapped out if you want to change or otherwise intercept system calls.
For example, this adds a log to every shell command:
import { runCreation } from 'bingo';import { createSystemRunner } from 'bingo-systems';
const defaultRunner = createSystemRunner();
await runCreation( { scripts: ['npm format --write'], }, { system: { runner: async (...args) => { console.log('Running:', args); return await defaultRunner(args); }, }, },);Made with 💝 in Boston byJosh Goldberg.