@fluffjs/cli 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Cli.js +31 -12
  2. package/package.json +1 -1
package/Cli.js CHANGED
@@ -309,13 +309,21 @@ Examples:
309
309
  let inlineStyles = '';
310
310
  if (target.styles && target.styles.length > 0) {
311
311
  const styleContents = [];
312
- for (const styleGlob of target.styles) {
313
- const styleFiles = this.findFiles(srcDir, [styleGlob]);
314
- if (styleFiles.length === 0) {
315
- console.warn(` Style not found: ${path.resolve(srcDir, styleGlob)}`);
312
+ for (const stylePath of target.styles) {
313
+ const fullPath = path.resolve(srcDir, stylePath);
314
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
315
+ console.log(` Style: ${stylePath}`);
316
+ styleContents.push(fs.readFileSync(fullPath, 'utf-8'));
316
317
  }
317
- for (const styleFile of styleFiles) {
318
- styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
318
+ else {
319
+ const styleFiles = this.findFiles(srcDir, [stylePath]);
320
+ if (styleFiles.length === 0) {
321
+ console.warn(` ⚠ Style not found: ${fullPath}`);
322
+ }
323
+ for (const styleFile of styleFiles) {
324
+ console.log(` ✓ Style: ${path.relative(srcDir, styleFile)}`);
325
+ styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
326
+ }
319
327
  }
320
328
  }
321
329
  if (styleContents.length > 0) {
@@ -490,13 +498,21 @@ Examples:
490
498
  let inlineStyles = '';
491
499
  if (target.styles && target.styles.length > 0) {
492
500
  const styleContents = [];
493
- for (const styleGlob of target.styles) {
494
- const styleFiles = this.findFiles(srcDir, [styleGlob]);
495
- if (styleFiles.length === 0) {
496
- console.warn(` Style not found: ${path.resolve(srcDir, styleGlob)}`);
501
+ for (const stylePath of target.styles) {
502
+ const fullPath = path.resolve(srcDir, stylePath);
503
+ if (fs.existsSync(fullPath) && fs.statSync(fullPath).isFile()) {
504
+ console.log(` Style: ${stylePath}`);
505
+ styleContents.push(fs.readFileSync(fullPath, 'utf-8'));
497
506
  }
498
- for (const styleFile of styleFiles) {
499
- styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
507
+ else {
508
+ const styleFiles = this.findFiles(srcDir, [stylePath]);
509
+ if (styleFiles.length === 0) {
510
+ console.warn(` ⚠ Style not found: ${fullPath}`);
511
+ }
512
+ for (const styleFile of styleFiles) {
513
+ console.log(` ✓ Style: ${path.relative(srcDir, styleFile)}`);
514
+ styleContents.push(fs.readFileSync(styleFile, 'utf-8'));
515
+ }
500
516
  }
501
517
  }
502
518
  if (styleContents.length > 0) {
@@ -561,6 +577,9 @@ Examples:
561
577
  }
562
578
  generateEntryPoint(srcDir, componentPatterns) {
563
579
  const componentFiles = this.findFiles(srcDir, componentPatterns);
580
+ for (const f of componentFiles) {
581
+ console.log(` ✓ Component: ${path.relative(srcDir, f)}`);
582
+ }
564
583
  const importDecls = componentFiles.map(f => {
565
584
  const relativePath = './' + path.relative(srcDir, f)
566
585
  .replace(/\\/g, '/');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluffjs/cli",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",