Convert to vite and clean up build
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
// tslint:disable:no-console
|
||||
/* eslint-disable no-console */
|
||||
import fs from "fs";
|
||||
import prompt from "prompt";
|
||||
// import shelljs from "shelljs";
|
||||
import prompt, { Schema } from "prompt";
|
||||
import { $ } from "execa";
|
||||
|
||||
console.log("What demo do you wish to run? (Enter a number)");
|
||||
|
||||
const schema = {
|
||||
const schema: Schema = {
|
||||
properties: {
|
||||
number: {
|
||||
demoNumber: {
|
||||
pattern: /^[0-9]+$/,
|
||||
message: "Please enter a number.",
|
||||
required: true,
|
||||
@ -18,8 +17,8 @@ const schema = {
|
||||
|
||||
prompt.start();
|
||||
|
||||
prompt.get(schema as any, async (_, result) => {
|
||||
const demoNumber = result.number as string;
|
||||
prompt.get(schema, async (_, result) => {
|
||||
const demoNumber = result.demoNumber as string;
|
||||
const files = fs.readdirSync("./demo").filter((fn) => fn.startsWith(demoNumber));
|
||||
|
||||
if (files.length === 0) {
|
||||
@ -30,12 +29,6 @@ prompt.get(schema as any, async (_, result) => {
|
||||
const filePath = `./demo/${files[0]}`;
|
||||
|
||||
console.log(`Running demo ${demoNumber}: ${files[0]}`);
|
||||
const { stdout } = await $`npm run ts-node -- ${filePath}`;
|
||||
console.log(stdout);
|
||||
|
||||
// if (shelljs.exec(`npm run ts-node -- ${filePath}`).code === 0) {
|
||||
// console.log("Document created successfully");
|
||||
// } else {
|
||||
// console.error("Something went wrong with the demo");
|
||||
// }
|
||||
await $`ts-node --project demo/tsconfig.json ${filePath}`;
|
||||
console.log("Successfully created document!");
|
||||
});
|
||||
|
Reference in New Issue
Block a user