feat: Skeleton Plugin refactor (#1660)

This commit is contained in:
CokaKoala
2023-07-05 17:05:25 -04:00
committed by GitHub
parent 1034074563
commit dbd2ec03c2
108 changed files with 3989 additions and 695 deletions

View File

@@ -0,0 +1,24 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const chokidar = require('chokidar');
const { join, resolve, basename } = require('path');
const { exec } = require('child_process');
const pathToStyles = resolve('.', join('src'));
// We want to ignore the `generated` dir so we don't have an endless loop
const generatedPath = resolve('.', join('src', 'tailwind', 'generated'));
// Simple watcher to detect changes in /packages/plugin/src
// This will rebuild the package on any `src` file changes.
let locked = false;
chokidar.watch(pathToStyles, { ignored: [generatedPath] }).on('change', (path) => {
const now = Date.now();
console.log(`[Build Start]: File Updated: ${basename(path)}`);
if (!locked) {
locked = true;
exec('pnpm -F @skeletonlabs/tw-plugin build', () => {
console.log(`[Build End]: Completed in ${Date.now() - now}ms`);
locked = false;
});
}
});