0.3.2 • Published 4 months ago

@urban-ui/arc v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

arc

Builds urban-ui packages

Getting started

Arc is a bun script that uses watchman to react to file changes.

npm add -D @urban-ui/arc
  • Add a package script
"scripts": {
  "build": "arc build",
  "dev": "arc watch"
}
  • Run arc
npm run build

Arc configuration

By default arc will compile all files under an src directory and output them to dist.

Arc will also generate typescript definition files based on the tsconfig.json found in the package.

Arc can be configured by placing an arc.config.ts file (or json, or js) at the package root, for example:

import type {Config} from '@urban-ui/arc'
import { getTsConfig } from "@urban-ui/arc/ts";

const tsconfig = await getTsConfig();

const config: Config = {
  include: [tsconfig.compilerOptions.rootDir],
  outDir: 'dist',
  rootDir: tsconfig.compilerOptions.rootDir,
}

export default config

Note: tsconfig.json is not json, one does not simply import tsconfig from './tsconfig.json.

Arc exposes getTsConfig to handle typescript configuration loading.

Include glob

Under the hood Arc uses https://www.npmjs.com/package/globby to turn config.includes into a list of files. This will default to all files under an src directory.

If you colocate tests under this directory then you will probably want to negate those files from the output:

const config = {
  include: ['src', '!src/*.test.ts*']
}

Local development

To install dependencies:

bun install

To run:

bun run rk.ts

To run with verbose console output use the debug environment variable:

DEBUG=* bun run rk.ts

Running against the test example package is usually a safe bet:

cd __tests__/base
bun run ../../rk.ts build