mirror of
https://github.com/pezkuwichain/pezkuwi-dev.git
synced 2026-04-22 03:17:57 +00:00
Initial rebrand: @polkadot -> @pezkuwi (3 packages)
- Package namespace: @polkadot/dev -> @pezkuwi/dev - Repository: polkadot-js/dev -> pezkuwichain/pezkuwi-dev - Author: Pezkuwi Team <team@pezkuwichain.io> Packages: - @pezkuwi/dev (build tools, linting, CI scripts) - @pezkuwi/dev-test (test runner) - @pezkuwi/dev-ts (TypeScript build) Upstream: polkadot-js/dev v0.83.3
This commit is contained in:
+61
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env node
|
||||
// Copyright 2017-2025 @polkadot/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('polkadot-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)), [])
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user