Giter Club home page Giter Club logo

fictitious-data's Introduction

fictitious-data

Generate fictitious, testable data.

License: MIT

Getting started

pnpm npm yarn
Install dependencies pnpm install npm install yarn
Generate documentation pnpm run docs npm run docs yarn run docs
Run unit tests pnpm run test npm run test yarn run test
Build pnpm run build npm run build yarn run build
Lint pnpm run lint[:fix] npm run lint[:fix] yarn run lint[:fix]
Format pnpm run format[:fix] npm run format[:fix] yarn run format[:fix]

FYI

Language: TypeScript Bundler: tsup Code Formatter: Prettier Linter: ESLint Documentation: TypeDoc Unit Testing Framework: Jest Unit Testing Framework: ts-jest Workflow: Husky Workflow: lint-staged Workflow: Commitizen Workflow: semantic-release

Code Language & Bundling

  • TypeScript: TypeScript is JavaScript with syntax for types.
  • tsup: Bundle your TypeScript library with no config, powered by esbuild.

Install

pnpm add -D typescript tsup

Configure

tsconfig.json:

{
  "compilerOptions": {
    "target": "es2020",
    "module": "commonjs",
    "esModuleInterop": true,
    "forceConsistentCasingInFileNames": true,
    "strict": true,
    "skipLibCheck": true
  }
}

tsup.config.ts:

import { defineConfig } from "tsup";

export default defineConfig({
  entry: ["src/index.ts"],
  target: "es2020",
  format: ["cjs", "esm"],
  splitting: false,
  sourcemap: true,
  clean: true,
  dts: true,
});

Code Formatting & Linting

  • Prettier: Prettier is an opinionated code formatter.
  • ESLint: ESLint statically analyzes your code to quickly find problems.

Install

pnpm add -D @typescript-eslint/parser @typescript-eslint/eslint-plugin eslint eslint-config-prettier prettier

Configure

.eslintrc.cjs:

/* eslint-env node */
module.exports = {
  extends: [
    "eslint:recommended",
    "plugin:@typescript-eslint/recommended",
    "prettier",
  ],
  parser: "@typescript-eslint/parser",
  plugins: ["@typescript-eslint"],
  root: true,
};

.prettierrc (see .editorconfig):

{}

Documentation

  • TypeDoc: TypeDoc converts comments in TypeScript source code into rendered HTML documentation or a JSON model.

Install

pnpm add -D typedoc @mxssfd/typedoc-theme

Configure

typedoc.config.cjs:

/* eslint-env node */
/** @type {import('typedoc').TypeDocOptions} */
module.exports = {
  entryPoints: ["./src/index.ts"],
  out: "docs",
  plugin: ["@mxssfd/typedoc-theme"],
  theme: "my-theme",
  cleanOutputDir: true,
};

Unit Testing

  • Jest: Jest is a delightful JavaScript Testing Framework with a focus on simplicity.
  • ts-jest: A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.

Install

pnpm add -D jest ts-jest @types/jest && \
npx ts-jest config:init

Configure

jest.config.cjs:

/* eslint-env node */
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
  preset: "ts-jest",
  testEnvironment: "node",
  collectCoverage: true,
  coverageDirectory: "coverage",
  coveragePathIgnorePatterns: ["/node_modules/"],
  coverageProvider: "v8",
  coverageReporters: ["json", "text", "lcov", "clover"],
};

Workflow

Husky & lint-staged

Install

see: https://prettier.io/docs/en/precommit.html#option-1-lint-stagedhttpsgithubcomokonetlint-staged

npx mrm@2 lint-staged

Configure

.lintstagedrc:

{
  "*.js": "eslint --cache --fix",
  "*.--check": "prettier --write"
}

.husky/pre-commit:

#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged

Commitizen & semantic-release

Install

npm install commitizen -g && \
commitizen init cz-conventional-changelog --pnpm --save-dev --save-exact && \
pnpm add -D semantic-release conventional-changelog-conventionalcommits

Incorporate Commitizen into the existing git commit workflow.

.husky/prepare-commit-msg:

#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

exec </dev/tty && npx cz --hook || true

Configure

.czrc:

{
  "path": "cz-conventional-changelog"
}

.releaserc:

{
  "branches": ["main"],
  "plugins": [
    [
      "@semantic-release/commit-analyzer",
      {
        "preset": "conventionalcommits",
        "releaseRules": [
          {
            "type": "build",
            "scope": "deps",
            "release": "patch"
          }
        ]
      }
    ],
    [
      "@semantic-release/release-notes-generator",
      {
        "preset": "conventionalcommits",
        "presetConfig": {
          "types": [
            {
              "type": "feat",
              "section": "Features"
            },
            {
              "type": "fix",
              "section": "Bug Fixes"
            },
            {
              "type": "build",
              "section": "Dependencies and Other Build Updates",
              "hidden": false
            }
          ]
        }
      }
    ],
    "@semantic-release/npm",
    "@semantic-release/github"
  ]
}

fictitious-data's People

Contributors

sidisinsane avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.