depxbox
Version:
Test npm packages super quick and easy.
28 lines (27 loc) • 867 B
JavaScript
import { BaseMode } from './Base.js';
import Logger from '../utils/logger.js';
export class Playground extends BaseMode {
constructor(config) {
super(config);
}
createPlayground(packageNames) {
Logger.green('\nCreating Playground with installed dependencies:');
packageNames.forEach((pkg) => {
Logger.blue(` - ${pkg}`);
});
Logger.magenta(`Sandbox ready at ${this.workingDir}`);
}
async run(packageNames) {
try {
await this.createWorkspace();
await this.installDependencies(packageNames);
this.createPlayground(packageNames);
}
catch (error) {
Logger.error('Error occurred while creating Playground Enviorment');
Logger.logError(error);
process.exit(1);
}
}
}
export default Playground;