Added tabs components and refactored stuff to work properly with composed / nested elements etc...
All checks were successful
Build, Test, and Publish (to Private NPM Registry) UI Components Library / publish (push) Successful in 58s

This commit is contained in:
Alan Bridgeman 2026-05-18 13:56:31 -05:00
parent 1c2d794a18
commit d2e99cc280
27 changed files with 1579 additions and 145 deletions

View file

@ -39,30 +39,41 @@ gulp.task("typescript", (done) => {
// Task which would bundle and minify the client-side JavaScript using Rollup
gulp.task("bundle-minify-js", (done) => {
const scriptFiles = [];
const components = [];
fs.readdirSync(path.join('src', 'components')).forEach(component => {
// Check the current item is a directory (i.e., a component folder)
if (fs.statSync(path.join('src', 'components', component)).isDirectory()) {
fs.readdirSync(path.join('src', 'components', component)).forEach(file => {
const componentScriptFiles = [];
// 1. Get all directories inside src/components
fs.readdirSync(path.join('src', 'components')).forEach(f => {
if(fs.statSync(path.join('src', 'components', f)).isFile() && (f.endsWith('.js') || f.endsWith('.mjs'))) {
console.log(`Adding root-level script: ${f}`);
scriptFiles.push(path.join('src', 'components', f));
}
else if(fs.statSync(path.join('src', 'components', f)).isDirectory()) {
components.push(f);
}
});
// Include any JS files found in a "scripts" subfolder of the component
if(file === 'scripts' && fs.statSync(path.join('src', 'components', component, file)).isDirectory()) {
fs.readdirSync(path.join('src', 'components', component, file)).forEach(scriptFile => {
if(scriptFile.endsWith('.js')) {
scriptFiles.push(path.join('src', 'components', component, 'scripts', scriptFile));
}
});
components.forEach(component => {
const componentPath = path.join('src', 'components', component);
const scriptsPath = path.join(componentPath, 'scripts');
if (fs.existsSync(scriptsPath) && fs.statSync(scriptsPath).isDirectory()) {
fs.readdirSync(scriptsPath).forEach(file => {
if (file.endsWith('.js') || file.endsWith('.mjs')) {
scriptFiles.push(path.join(scriptsPath, file));
}
// Look for *.js files inside the root of the component folders
if (file.endsWith('.js')) {
scriptFiles.push(path.join('src', 'components', component, file));
}
scriptFiles.push(...componentScriptFiles);
});
}
fs.readdirSync(componentPath).forEach(file => {
const componentScriptFiles = [];
// Look for *.js / *.mjs files inside the root of the component folders
if ((file.endsWith('.js') || file.endsWith('.mjs')) && fs.statSync(path.join(componentPath, file)).isFile()) {
componentScriptFiles.push(path.join('src', 'components', component, file));
}
scriptFiles.push(...componentScriptFiles);
});
});
let clientEntryJSContent = '';
@ -71,6 +82,9 @@ gulp.task("bundle-minify-js", (done) => {
clientEntryJSContent += `import './${relativePath}';\n`;
});
//console.log(`Client Entry JS Content: ${clientEntryJSContent}`);
fs.writeFileSync(path.join('src', 'components', 'client-entry.js'), clientEntryJSContent);
let proc;
@ -82,7 +96,7 @@ gulp.task("bundle-minify-js", (done) => {
}
proc.on('close', code => {
// Clean up the temporary entry file so tht the src/ directory stays pristine
// Clean up the temporary entry file so that the src/ directory stays pristine
const entryPath = path.join('src', 'components', 'client-entry.js');
if (fs.existsSync(entryPath)) {
fs.rmSync(entryPath);