mirror of
https://github.com/strapi/strapi.git
synced 2025-08-07 00:09:23 +00:00

* feat(pack-up): add build command (#18058) * chore: lint order of imports * feat(pack-up): add watch command (#18121) * feat: add watch command feat: add ts watch task * chore: pr amends * fix: promptUser linter * chore: remove \n with os.EOL * feat(pack-up): add init command (#18133) * feat(pack-up): add build command (#18058) * feat(pack-up): add watch command (#18121) * feat: add watch command feat: add ts watch task * chore: pr amends * fix: promptUser linter * chore: remove \n with os.EOL * feat: add init command fix: build feat: add default template and tests * chore: pr amends * Update packages/utils/pack-up/tests/console.ts Co-authored-by: Ben Irvin <ben@innerdvations.com> * chore: re-add mock * chore: fix tsconfig * chore: fix inquirer types due to rxjs inclusion * Update packages/utils/pack-up/src/node/templates/internal/files/typescript.ts * chore: fix inquirer types --------- Co-authored-by: Ben Irvin <ben@innerdvations.com> * feat(pack-up): add check command (#18183) * feat: add check command * chore: reintroduce CLI tests * fix: add build command to `prepublishOnly` * docs(pack-up): add readme and contributor docs (#18237) * chore: update README * docs(pack-up): add contributor documentation * chore: update overview doc to be clearer * fix(pack-up): init command (#18245) * fix: init command bugs * fix: node tests * fix: template exports ordering & file extensions * test(upload): double timeout on UploadAssetDialog test --------- Co-authored-by: Ben Irvin <ben@innerdvations.com>
29 lines
715 B
TypeScript
29 lines
715 B
TypeScript
import { randomUUID } from 'crypto';
|
|
import { mkdir, rm } from 'fs/promises';
|
|
import path from 'path';
|
|
|
|
/**
|
|
* Remove all the tmp folder and everything in it.
|
|
* Great for when it all goes wrong.
|
|
*/
|
|
const cleanupWorkspaces = async () => {
|
|
const workspacePath = path.resolve(__dirname, `__tmp__`);
|
|
|
|
return rm(workspacePath, { recursive: true, force: true });
|
|
};
|
|
|
|
const createWorkspace = async () => {
|
|
const key = randomUUID();
|
|
|
|
const workspacePath = path.resolve(__dirname, '__tmp__', key);
|
|
|
|
await mkdir(workspacePath, { recursive: true });
|
|
|
|
return {
|
|
path: workspacePath,
|
|
remove: () => rm(workspacePath, { recursive: true, force: true }),
|
|
};
|
|
};
|
|
|
|
export { cleanupWorkspaces, createWorkspace };
|