Installation & Setup
Installation
Install Using @panda/scaffold
If you just want to use Scaffold, you can install it directly from @panda/scaffold:
- npm
- Yarn
- pnpm
npm install @panda/scaffold
yarn add @panda/scaffold
pnpm add @panda/scaffold
Install Using panda
The panda library contains Scaffold, along with a lot of other entities and functionality.
- npm
- Yarn
- pnpm
npm install panda
yarn add panda
pnpm add panda
Setup
Include
// ESM
import { Scaffold } from '@panda/scaffold'
// CommonJS
const { Scaffold } = require('@panda/scaffold')
Create
Scaffolds can be creating either by extending the Scaffold class or creating a new instance of it.
Instantiate Scaffold
import { Scaffold } from '@panda/scaffold'
const scaffold = new Scaffold({
name: 'foo:create',
action: async (data, details) => {}
})
Extend Scaffold
import { Scaffold } from '@panda/scaffold'
export const FooCreateScaffold extends Scaffold {
name = 'foo:create'
async action (data, details) {}
}
Run
./my-script.js
- Call the script directly (example:
./my-script.js) - Call the script via
node(example:node my-script.js) - Add the script to your
package.jsonintoscriptsand runnpm run <script> - Add the script to your
package.jsonintobinand runnpm link(or install globally) to run as an independent command
When running a script directly (without using NPM or Node), be sure to include the following in your script:
#!/usr/bin/env node