mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-04-22 02:08:01 +00:00
cb6801a3cc
- Updated all copyright headers from 2025 to 2026 (system date shows 2026)
- Added build output files to eslint ignore list in packages/dev/config/eslint.js
- Added build output patterns to .gitignore
- Ignored: packages/*/*.{d.ts,js,mjs,cjs}, packages/*/cjs/**, packages/*/env/**,
packages/*/rootJs/**, packages/*/rootStatic/**
- Successfully resolved 521 lint errors by properly ignoring generated files
- Build outputs should not be linted (source files are linted instead)
- Lint and build now pass successfully
62 lines
1.3 KiB
JavaScript
Executable File
62 lines
1.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
// Copyright 2017-2026 @pezkuwi/dev authors & contributors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
|
|
import { logBin, PATHS_BUILD, rimrafSync } from './util.mjs';
|
|
|
|
const PKGS = path.join(process.cwd(), 'packages');
|
|
const DIRS = PATHS_BUILD.map((d) => `build${d}`);
|
|
|
|
logBin('pezkuwi-dev-clean-build');
|
|
|
|
/**
|
|
* @internal
|
|
*
|
|
* Retrieves all the files containing tsconfig.*.tsbuildinfo contained withing the directory
|
|
*
|
|
* @param {string} dir
|
|
* @returns {string[]}
|
|
*/
|
|
function getPaths (dir) {
|
|
if (!fs.existsSync(dir)) {
|
|
return [];
|
|
}
|
|
|
|
return fs
|
|
.readdirSync(dir)
|
|
.reduce((all, p) => {
|
|
if (p.startsWith('tsconfig.') && p.endsWith('.tsbuildinfo')) {
|
|
all.push(path.join(dir, p));
|
|
}
|
|
|
|
return all;
|
|
}, DIRS.map((p) => path.join(dir, p)));
|
|
}
|
|
|
|
/**
|
|
* @internal
|
|
*
|
|
* Removes all the specified directories
|
|
*
|
|
* @param {string[]} dirs
|
|
*/
|
|
function cleanDirs (dirs) {
|
|
dirs.forEach((d) => rimrafSync(d));
|
|
}
|
|
|
|
cleanDirs(getPaths(process.cwd()));
|
|
|
|
if (fs.existsSync(PKGS)) {
|
|
cleanDirs(getPaths(PKGS));
|
|
cleanDirs(
|
|
fs
|
|
.readdirSync(PKGS)
|
|
.map((f) => path.join(PKGS, f))
|
|
.filter((f) => fs.statSync(f).isDirectory())
|
|
.reduce((/** @type {string[]} */ res, d) => res.concat(getPaths(d)), [])
|
|
);
|
|
}
|