|
@ -1,10 +1,9 @@ |
|
|
/* eslint-disable no-await-in-loop, no-console */ |
|
|
/* eslint-disable no-await-in-loop, no-console */ |
|
|
|
|
|
import chalk from 'chalk'; |
|
|
const path = require('path'); |
|
|
import { spawn } from 'child_process'; |
|
|
const { globSync } = require('glob'); |
|
|
import fs from 'fs-extra'; |
|
|
const fs = require('fs-extra'); |
|
|
import { globSync } from 'glob'; |
|
|
const chalk = require('chalk'); |
|
|
import path from 'path'; |
|
|
const { spawn } = require('child_process'); |
|
|
|
|
|
|
|
|
|
|
|
(async () => { |
|
|
(async () => { |
|
|
console.time('Execution...'); |
|
|
console.time('Execution...'); |
|
@ -15,11 +14,11 @@ const { spawn } = require('child_process'); |
|
|
await fs.remove(tmpFolder); |
|
|
await fs.remove(tmpFolder); |
|
|
await fs.ensureDir(tmpFolder); |
|
|
await fs.ensureDir(tmpFolder); |
|
|
|
|
|
|
|
|
function getTypescriptDemo(content, demoPath) { |
|
|
function getTypescriptDemo(content: string, demoPath: string) { |
|
|
const lines = content.split(/[\n\r]/); |
|
|
const lines = content.split(/[\n\r]/); |
|
|
|
|
|
|
|
|
const tsxStartLine = lines.findIndex((line) => |
|
|
const tsxStartLine = lines.findIndex((line) => |
|
|
line.replace(/\s/g).toLowerCase().includes('```tsx'), |
|
|
line.replace(/\s/g, '').toLowerCase().includes('```tsx'), |
|
|
); |
|
|
); |
|
|
|
|
|
|
|
|
if (tsxStartLine < 0) { |
|
|
if (tsxStartLine < 0) { |
|
@ -72,7 +71,7 @@ const { spawn } = require('child_process'); |
|
|
child.stdout.pipe(process.stdout); |
|
|
child.stdout.pipe(process.stdout); |
|
|
child.stderr.pipe(process.stderr); |
|
|
child.stderr.pipe(process.stderr); |
|
|
|
|
|
|
|
|
child.on('exit', async (code) => { |
|
|
child.on('exit', async (code: number) => { |
|
|
console.timeEnd('Execution...'); |
|
|
console.timeEnd('Execution...'); |
|
|
|
|
|
|
|
|
if (code) { |
|
|
if (code) { |