@fluffjs/cli 0.1.1 → 0.1.3

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.
package/Cli.js CHANGED
@@ -286,7 +286,7 @@ Examples:
286
286
  async buildTarget(target, projectRoot, workspaceRoot, projectRelativePath) {
287
287
  console.log(`🔨 Building target '${target.name}'...`);
288
288
  const srcDir = path.resolve(projectRoot, target.srcDir);
289
- const appDir = path.join(srcDir, 'app');
289
+ const appDir = path.join(srcDir, target.componentsDir ?? 'app');
290
290
  const outDir = (workspaceRoot && projectRelativePath)
291
291
  ? path.join(workspaceRoot, 'dist', projectRelativePath)
292
292
  : path.resolve(projectRoot, target.outDir);
@@ -328,6 +328,9 @@ Examples:
328
328
  }
329
329
  }
330
330
  console.log(' Building with esbuild...');
331
+ const tsconfigRaw = target.tsConfigPath
332
+ ? fs.readFileSync(path.resolve(projectRoot, target.tsConfigPath), 'utf-8')
333
+ : '{}';
331
334
  const result = await esbuild.build({
332
335
  entryPoints: [entryPoint],
333
336
  bundle: true,
@@ -350,7 +353,7 @@ Examples:
350
353
  ],
351
354
  external: bundleOptions.external ?? [],
352
355
  logLevel: 'warning',
353
- tsconfigRaw: '{}'
356
+ tsconfigRaw
354
357
  });
355
358
  const outputs = Object.keys(result.metafile?.outputs ?? {});
356
359
  const jsBundle = outputs.find(f => f.endsWith('.js'));
@@ -477,7 +480,7 @@ Examples:
477
480
  }
478
481
  async serveTarget(target, projectRoot, workspaceRoot, projectRelativePath) {
479
482
  const srcDir = path.resolve(projectRoot, target.srcDir);
480
- const appDir = path.join(srcDir, 'app');
483
+ const appDir = path.join(srcDir, target.componentsDir ?? 'app');
481
484
  const fluffDir = path.join(this.cwd, '.fluff');
482
485
  const serveId = randomUUID();
483
486
  const outDir = path.join(fluffDir, serveId);
@@ -560,6 +563,9 @@ Examples:
560
563
  }
561
564
  }
562
565
  console.log(`🚀 Starting dev server for '${target.name}'...`);
566
+ const tsconfigRaw = target.tsConfigPath
567
+ ? fs.readFileSync(path.resolve(projectRoot, target.tsConfigPath), 'utf-8')
568
+ : '{}';
563
569
  const ctx = await esbuild.context({
564
570
  entryPoints: [entryPoint],
565
571
  bundle: true,
@@ -580,7 +586,8 @@ Examples:
580
586
  production: false
581
587
  })
582
588
  ],
583
- logLevel: 'info'
589
+ logLevel: 'info',
590
+ tsconfigRaw
584
591
  });
585
592
  await ctx.watch();
586
593
  console.log(' Watching for changes...');
package/Generator.js CHANGED
@@ -127,6 +127,8 @@ export class Generator {
127
127
  name,
128
128
  srcDir: 'src',
129
129
  outDir: 'dist',
130
+ componentsDir: 'app',
131
+ tsConfigPath: 'tsconfig.json',
130
132
  entryPoint: 'main.ts',
131
133
  indexHtml: 'index.html',
132
134
  components: ['**/*.component.ts'],
@@ -4,6 +4,8 @@ export interface FluffTarget {
4
4
  name: string;
5
5
  srcDir: string;
6
6
  outDir: string;
7
+ componentsDir?: string;
8
+ tsConfigPath?: string;
7
9
  entryPoint?: string;
8
10
  indexHtml?: string;
9
11
  components: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluffjs/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",
@@ -5,6 +5,7 @@ export const DEFAULT_CONFIG = {
5
5
  name: 'app',
6
6
  srcDir: 'src',
7
7
  outDir: 'dist',
8
+ componentsDir: 'app',
8
9
  entryPoint: 'main.ts',
9
10
  indexHtml: 'index.html',
10
11
  components: ['**/*.component.ts'],