Convert to vite and clean up build

This commit is contained in:
Dolan Miu
2023-06-01 02:05:35 +01:00
parent 352cde743f
commit 0cbb5fb0a3
20 changed files with 2859 additions and 473 deletions

View File

@ -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!");
});