-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
61 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 4 additions & 6 deletions
10
packages/ts-scripts-yarn3/src/actions/package/clean-outputs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import { rmSync } from 'node:fs' | ||
import { rm } from 'node:fs/promises' | ||
import path from 'node:path' | ||
|
||
import chalk from 'chalk' | ||
|
||
export const packageCleanOutputs = () => { | ||
export const packageCleanOutputs = async () => { | ||
const pkg = process.env.INIT_CWD ?? '.' | ||
const pkgName = process.env.npm_package_name | ||
const folders: string[] = [path.join(pkg, 'dist'), path.join(pkg, 'build'), path.join(pkg, 'docs')] | ||
console.log(chalk.green(`Cleaning Outputs [${pkgName}]`)) | ||
|
||
const dist = path.join(pkg, 'dist') | ||
rmSync(dist, { force: true, recursive: true }) | ||
await Promise.all(folders.map((folder) => rm(folder, { force: true, recursive: true }))) | ||
|
||
const build = path.join(pkg, 'build') | ||
rmSync(build, { force: true, recursive: true }) | ||
return 0 | ||
} |
11 changes: 4 additions & 7 deletions
11
packages/ts-scripts-yarn3/src/actions/package/clean-typescript.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
import { rm } from 'node:fs/promises' | ||
import path from 'node:path' | ||
|
||
import chalk from 'chalk' | ||
import { rimrafSync } from 'rimraf' | ||
|
||
export const packageCleanTypescript = () => { | ||
export const packageCleanTypescript = async () => { | ||
const pkg = process.env.INIT_CWD ?? '.' | ||
const pkgName = process.env.npm_package_name | ||
console.log(chalk.green(`Cleaning Typescript [${pkgName}]`)) | ||
const files: string[] = [path.join(pkg, '*.tsbuildinfo'), path.join(pkg, '.tsconfig.*'), path.join(pkg, '.eslintcache')] | ||
|
||
const buildInfo = path.join(pkg, '*.tsbuildinfo') | ||
rimrafSync(buildInfo, { glob: true }) | ||
|
||
const tsConfig = path.join(pkg, '.tsconfig.*') | ||
rimrafSync(tsConfig, { glob: true }) | ||
await Promise.all(files.map((file) => rm(file, { force: true, recursive: true }))) | ||
|
||
return 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { packageCleanOutputs } from './clean-outputs' | ||
import { packageCleanTypescript } from './clean-typescript' | ||
|
||
export const packageClean = () => { | ||
return packageCleanOutputs() + packageCleanTypescript() | ||
export const packageClean = async () => { | ||
return (await Promise.all([packageCleanOutputs(), packageCleanTypescript()])).reduce((prev, value) => prev + value, 0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters