Development Setup & Build Process
Relevant source files
The following files were used as context for generating this wiki page:
The spoof project is a TypeScript-based CLI utility designed to modify MAC addresses across macOS, Linux, and Windows. The development environment is built around Node.js (version 24 or higher) and utilizes Yarn 4 as the package manager. The project follows a modern ESM (ECMAScript Modules) architecture, where source code resides in src/ and compiled assets are directed to dist/.
The build pipeline leverages tsup for high-speed bundling and tsc for generating type declarations. The project maintains high code quality through a combination of fast linting with oxlint, unit testing via vitest, and advanced mutation testing using Stryker.
Sources: CLAUDE.md:8-14, package.json:96-104, tsconfig.json:1-24
Environment Requirements
To contribute to or build spoof, the following environment specifications must be met:
- Runtime: Node.js >= 24.
- Package Manager: Yarn 4.14.1 (managed via Corepack).
- Language: TypeScript 6.0.3.
- Module System: ESM (
"type": "module").
Sources: package.json:44, 96, 103-104, CLAUDE.md:11-13
Build Pipeline Architecture
The build process is designed to transform TypeScript source files into executable ESM JavaScript while ensuring that metadata and external data files (like the OUI database) are preserved and correctly positioned for the CLI.
The diagram above illustrates the parallel tasks triggered during the build phase, including bundling and asset relocation.
Compilation & Bundling
The project uses tsup to bundle src/index.ts (API) and src/cli.ts (CLI entry point). The configuration targets Node 24 and enables sourcemaps for debugging.
export default defineConfig({
entry: {
index: 'src/index.ts',
cli: 'src/cli.ts'
},
format: ['esm'],
dts: false,
sourcemap: true,
clean: true,
target: 'node24',
// ... asset copying logic
})
Sources: tsup.config.ts:5-15, package.json:57
Data Asset Management
Since the OUI (Organizationally Unique Identifier) vendor database is stored as a JSON file, the build process includes an onSuccess hook in the tsup configuration to manually copy src/data/oui.json to the dist/data/ directory.
Sources: tsup.config.ts:17-26, CLAUDE.md:68-70
Development Commands
The project defines several scripts in package.json to facilitate development, testing, and validation.
Core Development Scripts
| Command | Description |
|---|---|
yarn build | Bundles TypeScript and emits type declarations. |
yarn start | Executes the built CLI using the local dist/cli.js. |
yarn clean | Deletes node_modules, dist, and Yarn cache files. |
yarn update-oui | Runs the script to refresh the OUI database from IEEE. |
Sources: package.json:57-81, CLAUDE.md:17-32
Quality Assurance & Testing
The strict validation flow ensures code integrity before publishing or versioning.
The testing suite uses vitest for standard tests and Stryker for mutation testing. Mutation testing evaluates the quality of tests by injecting "mutants" (bugs) into the code to see if the tests catch them.
Sources: package.json:67-70, 79, stryker.config.json:1-15
TypeScript Configuration
The tsconfig.json is configured for strict type checking and modern Node.js module resolution.
| Option | Value | Purpose |
|---|---|---|
target | ES2023 | Sets the JS language version for emitted code. |
module | NodeNext | Enables modern Node.js module support. |
strict | true | Enables all strict type-checking options. |
resolveJsonModule | true | Allows importing .json files as modules. |
declaration | true | Generates corresponding .d.ts files. |
Sources: tsconfig.json:2-20
Conclusion
The development setup for spoof emphasizes high performance and strict type safety. By utilizing tsup for bundling and oxlint for linting, the project achieves rapid feedback loops for developers. The automated build pipeline ensures that both the TypeScript library and the CLI tool are correctly packaged with their required OUI data assets, maintaining platform compatibility across macOS, Linux, and Windows.
Sources: CLAUDE.md:68-76, README.md:154-170