mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
feat: typescript support (#185)
* feat: initial typescript support * feat: typescript support * feat(plugin-helper): move files to typescript * chore: update lock files * feat: preset types * fix: build * fix: benchmark * fix: remove pnpm cache * fix: bench action * fix: pnpm recursive install * fix: nx cache * fix: lock file * fix: workflows * fix: lerna support in pnpm * fix: pnpm workspace * fix: remove unused files * fix: pnpm lock file * fix: update lerna for support pnpm * fix: lerna bootstrap * fix: rollup build * fix: update nx * fix: build * fix: add nx dep target * fix: remove nx cache * fix: workflow run on push only for master * fix: test workflow run on push only for master * fix: remove parallel for gen types * fix: benchmark * fix: benchmark imports * fix: pnpm * fix: types errors and pnpm * fix: types * fix: types * refactor: parser * fix(parser): tests * fix: preset tests * fix: react types * fix: react type declarations * fix: pnpm lock file * fix: react preset types * fix: lock file * fix: vue2 types * feat: dev container support * fix: types * fix: types * refactor: rewrite pkg-task, add nx gen-types deps, fix react/render.ts * refactor: types * fix: types * fix: rename gen-types to types * fix: nx build order * fix: nx reset * fix: define nx deps explicit * fix: build * fix: nx * fix: nx order build * fix: nx deps * fix: bbob cli tests * fix: tests * fix: cli tests and import * fix: test cover * fix: cli cover
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
// Define the base directory where packages are located
|
||||
const packagesDir = 'packages';
|
||||
const dirs = ['dist', 'es', 'lib', 'coverage', 'types', 'node_modules']
|
||||
|
||||
// Function to recursively delete directories
|
||||
function deleteFolderRecursive(folderPath) {
|
||||
if (fs.existsSync(folderPath)) {
|
||||
fs.readdirSync(folderPath).forEach((file) => {
|
||||
const curPath = path.join(folderPath, file);
|
||||
if (fs.lstatSync(curPath).isDirectory()) { // Recursively delete subdirectories
|
||||
deleteFolderRecursive(curPath);
|
||||
} else { // Delete file
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
fs.rmdirSync(folderPath); // Delete empty directory
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through each subfolder inside the packages directory
|
||||
fs.readdirSync(packagesDir).forEach((packageFolder) => {
|
||||
const packageFolderPath = path.join(packagesDir, packageFolder);
|
||||
|
||||
if (fs.lstatSync(packageFolderPath).isDirectory()) {
|
||||
dirs.forEach(dirname => {
|
||||
// Delete the dist folder if it exists
|
||||
const distFolderPath = path.join(packageFolderPath, dirname);
|
||||
|
||||
if (fs.existsSync(distFolderPath)) {
|
||||
deleteFolderRecursive(distFolderPath);
|
||||
console.log(`${dirname} (${packageFolderPath}) deleted`);
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "scripts",
|
||||
"main": "index.js",
|
||||
"name": "@bbob/scripts",
|
||||
"private": true,
|
||||
"bin": {
|
||||
"pkg-task": "pkg-task"
|
||||
},
|
||||
"author": {
|
||||
"name": "Nikolay Kostyurin <jilizart@gmail.com>",
|
||||
"url": "https://artkost.ru/"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "8.2.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ function runCommand(command, args = '') {
|
||||
}
|
||||
|
||||
function runCommandByKey(key, command) {
|
||||
const event_name = process.env.npm_lifecycle_event
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
if (args.length >= 1) {
|
||||
@@ -37,6 +38,10 @@ function runCommandByKey(key, command) {
|
||||
return runCommand(command, argarr.join(' '))
|
||||
}
|
||||
}
|
||||
|
||||
if (args.length === 0 && event_name && event_name === key) {
|
||||
return runCommand(command)
|
||||
}
|
||||
}
|
||||
|
||||
for (const [key, command] of Object.entries(pkg.pkgTasks)) {
|
||||
|
||||
Reference in New Issue
Block a user