# @pezkuwi/dev A collection of shared CI scripts and development environment (configuration, dependencies) used by [@pezkuwi](https://pezkuwi.js.org) projects. # Scripts ## polkadot-ci-ghact-build **Summary**: This script automates the continuous integration (CI) process for building, testing, versioning, and publishing packages in the repository. It handles tasks like cleaning the workspace, running tests, updating versions, publishing to npm, GitHub repositories, and Deno, and generating changelogs. ### CLI Arguments - **`--skip-beta`**: Prevents incrementing the version to a beta release. ### Usage ```bash yarn polkadot-ci-ghact-build [options] ``` ## polkadot-ci-ghact-docs **Summary**: This script generates documentation for the repository and deploys it to GitHub Pages. It ensures the documentation is built and published with the correct configuration. ### CLI Arguments This script does not accept any CLI arguments. ### Usage ```bash yarn polkadot-ci-ghact-docs ``` ## polkadot-ci-ghpages-force **Summary**: This script force-refreshes the `gh-pages` branch of the repository by creating a new orphan branch, resetting its contents, and pushing it to GitHub. It ensures a clean state for GitHub Pages deployment. ### CLI Arguments This script does not accept any CLI arguments. ### Usage ```bash yarn polkadot-ci-ghpages-force ``` ## polkadot-dev-build-docs **Summary**: This script prepares the documentation for building by copying the `docs` directory to a `build-docs` directory. If the `build-docs` directory already exists, it is cleared before copying. ### CLI Arguments This script does not accept any CLI arguments. ### Usage ```bash yarn polkadot-dev-build-docs ``` ## polkadot-dev-build-ts **Summary**: This script compiles TypeScript source files into JavaScript outputs using the specified compiler (`tsc`), prepares the build artifacts, rewrites imports for compatibility (e.g., for Deno), lints dependencies, and updates package metadata for distribution. It supports CommonJS, ESM, and Deno outputs, along with configuration validation and export mapping. ### CLI Arguments - **`--compiler `**: Specifies the compiler to use for TypeScript compilation. - Acceptable values: `tsc` - Default: `tsc` ### Usage ```bash yarn polkadot-dev-build-ts [options] ``` ## polkadot-dev-circular **Summary**: This script checks the project for circular dependencies in TypeScript (`.ts`, `.tsx`) files using the `madge` library. It reports any detected circular dependencies and exits with an error if any are found. ### CLI Arguments This script does not accept any CLI arguments. ```bash yarn polkadot-dev-circular ``` ## polkadot-dev-clean-build **Summary**: This script removes build artifacts and temporary files from the repository. It targets directories like `build` and files such as `tsconfig.*.tsbuildinfo`, ensuring a clean workspace for fresh builds. ### CLI Arguments This script does not accept any CLI arguments. ```bash yarn polkadot-dev-clean-build ``` ## polkadot-dev-contrib **Summary**: This script generates a `CONTRIBUTORS` file by aggregating and listing all contributors to the repository based on the Git commit history. It excludes bot accounts and service-related commits (e.g., GitHub Actions, Travis CI). The output includes the number of contributions, contributor names, and their most recent commit hash. ### CLI Arguments This script does not accept any CLI arguments. ```bash yarn polkadot-dev-contrib ``` ## polkadot-dev-copy-dir **Summary**: This script copies directories from specified source paths to a destination path. It supports options to change the working directory and to flatten the directory structure during copying. ### CLI Arguments - **`--cd `**: Specifies a working directory to prepend to the source and destination paths. - **`--flatten`**: Copies all files directly to the destination without preserving the source directory structure. ### Usage ```bash yarn polkadot-dev-copy-dir [options] ... ``` - ``: One or more source directories to copy. - ``: Destination directory for the copied files. ## polkadot-dev-copy-to **Summary**: This script copies the `build` output and `node_modules` of all packages in the repository to a specified destination directory. It ensures the destination `node_modules` folder exists and is up-to-date. ### CLI Arguments - **``**: Specifies the target directory where the `node_modules` folder resides. ### Usage ```bash yarn polkadot-dev-copy-to ``` ## polkadot-dev-deno-map **Summary**: This script generates a `mod.ts` file and an `import_map.json` file for Deno compatibility. It exports all packages with a `mod.ts` file in their `src` directory and maps their paths for use in Deno. ### Outputs - **`mod.ts`**: An auto-generated TypeScript module exporting all packages for Deno. If the file does not exist, it is created. - **`import_map.json`**: A JSON file mapping package paths to their corresponding Deno-compatible build paths. If an `import_map.in.json` file exists, its mappings are merged into the output. ### CLI Arguments This script does not accept any CLI arguments. ## polkadot-dev-run-lint **Summary**: This script runs linting and TypeScript checks on the repository. It uses `eslint` for code linting and `tsc` for TypeScript type checking. Specific checks can be skipped using CLI arguments. ### CLI Arguments - **`--skip-eslint`**: Skips running `eslint` during the linting process. - **`--skip-tsc`**: Skips running the TypeScript (`tsc`) type checker. ### Usage ```bash yarn polkadot-dev-run-lint [options] ``` ## polkadot-dev-run-node-ts **Summary**: This script executes a Node.js script with TypeScript support, using the `@pezkuwi/dev-ts/cached` loader by default. It dynamically handles global and local loaders and allows for additional Node.js flags to be passed. ### CLI Arguments - `