@snailicide/build-config
v1.4.0
Published
Snailicide Shared Build Configuration
Downloads
46
Maintainers
Readme
@snailicide/build-config 🐌
Provides repository with base configurations that can be extended in new packages.
Repository
- Github:
@snailicide/build-config
•snailicide-monorepo
- CDN: jsdeliver
Author
👤 Gillian Tunney
Recommended package manager is pnpm
@snailicide/build-config 🐌
This package provides reusable configuration files for commonly used tooling. It aims to define,extend, and manage build settings , ensuring consistency across different environments, projects and packages.
@snailicide/build-config
contains configurations for:
Build Tooling
- commitlint • Lint commit messages
- @commitlint/config-conventional • Shareable commitlint configuration
- commitizen • Command-line utility to create commits with your rules.
- eslint • Find and fix problems in your JavaScript code.
- typescript-eslint • Tooling that enables ESLint and Prettier to support TypeScript.
- npm • Node package manager
- prettier • Opinionated code formatter
- rollup • The JavaScript module bundler
- typedoc • Documentation generator for TypeScript projects
- typedoc-plugin-markdown • Generate TypeScript documentation as markdown
- vite • Next generation frontend tooling
- vitest • A Vite-native testing framework
- vitepress • Vite & Vue powered static site generator
Eslint Plugins
- typescript-eslint • Provides linting rules for TypeScript code.
- eslint-comments • Enforces best practices for ESLint directive comments.
- filenames-simple • Ensures consistent and simple file naming conventions.
- import • Supports linting of ES2015+ import/export syntax, and prevent issues with misspelling of file paths and import names.
- jsdoc • Enforces JSDoc comments and validates their syntax.
- sort • Provides rules for sorting various code elements, including: exports, object properties, TypeScript type properties, and string unions.
- unused-imports • Identifies and removes unused imports in your code.
- vitest • Contains linting rules for Vitest, a Vite-native testing framework.
Rollup Plugins
- rollup-plugin-ts • Allows Rollup to bundle declarations, and respects Browserslists, and enables integration with transpilers
- @rollup/plugin-json • Allows Rollup to import JSON files, converting them to ES6 modules.
- @rollup/plugin-commonjs • Converts CommonJS modules to ES6, so they can be included in a Rollup bundle.
- @rollup/plugin-node-resolve
• Locates and bundles third-party dependencies in
node_modules
. - rollup-plugin-node-externals • Excludes Node.js built-in modules, dependencies & devDependencies from the bundle.
- rollup-plugin-polyfill-node • Provides polyfills for Node.js core modules when bundling for the browser.
- @rollup/plugin-terser • Minifies the generated Rollup bundle using Terser.
Installation
#pnpm
$ pnpm add @snailicide/build-config -D
#yarn
$ yarn add @snailicide/build-config -D
#npm
$ npm install @snailicide/build-config --development
Examples
Typescript
/* @file tsconfig.json */
{
extends: '@snailicide/build-config/tsconfig-base',
compilerOptions: {
outDir: './../types',
rootDir: '.',
declarationDir: './../types',
},
exclude: ['**/*.test.ts'],
include: ['**/*.ts', '**/*.cts', '**/*.mts'],
}
Eslint
/* @file eslint.config.js */
import { EsLint } from '@snailicide/build-config'
const FLAT_CONFIG = await EsLint.flatConfig()
export default [
...FLAT_CONFIG,
{
ignores: ['packages/**/docs/**/*'],
},
]
Prettier
/* @file package.json (include prettier property) */
{
prettier: '@snailicide/build-config/prettier',
}
OR
/** @file Prettier.config.cjs Extend the base configuration */
const { Prettier, merge } = require('@snailicide/build-config')
const options = {
plugins: ['@shopify/prettier-plugin-liquid'],
overrides: [
{
files: '*.liquid',
options: {
tabWidth: 2,
},
},
],
}
module.exports = merge(Prettier.config, options)
Typedoc
/** @file Typedoc.config.ts Basic Typedoc Config using Material Theme */
import { typedoc } from '@snailicide/build-config'
import url from 'node:url'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
const typeDocConfig = typedoc.configMaterialTheme(__dirname, {})
export default typeDocConfig
OR
/** @file Typedoc.config.ts Basic Typedoc Markdown Config */
import path from 'node:path'
import url from 'node:url'
import { typedoc } from './types/index.js'
const __dirname = url.fileURLToPath(new URL('.', import.meta.url))
/** Custom properties to override */
const newTypeDocConfig = {
githubPages: false,
useCodeBlocks: true,
}
const typeDocConfig = {
/** Markdown Configuration */
...typedoc.configMarkdown(__dirname, newTypeDocConfig),
/** Entrypoint and excludes array is overwritten */
entryPoints: [
path.resolve(`${__dirname}/src/**/index.ts`),
path.resolve(`${__dirname}/src/utilities.ts`),
],
exclude: [path.resolve(`${__dirname}/src/index.ts`)],
}
export default typeDocConfig