@fluffjs/cli 0.2.3 → 0.2.4

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 (3) hide show
  1. package/Cli.d.ts +1 -0
  2. package/Cli.js +24 -0
  3. package/package.json +1 -1
package/Cli.d.ts CHANGED
@@ -27,6 +27,7 @@ export declare class Cli {
27
27
  private getJsBundleName;
28
28
  private collectStyles;
29
29
  private loadTsConfig;
30
+ private runTypeCheck;
30
31
  private generateEntryContent;
31
32
  private findAllTsFiles;
32
33
  private findFiles;
package/Cli.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import * as t from '@babel/types';
2
+ import { execSync } from 'child_process';
2
3
  import { randomUUID } from 'crypto';
3
4
  import * as esbuild from 'esbuild';
4
5
  import * as fs from 'fs';
@@ -304,6 +305,7 @@ Examples:
304
305
  }
305
306
  const entry = this.resolveEntryPoint(target, srcDir);
306
307
  const inlineStyles = await this.collectStyles(target, srcDir, bundleOptions.minify ?? true);
308
+ this.runTypeCheck(target, projectRoot);
307
309
  console.log(' Building with esbuild...');
308
310
  const tsconfigRaw = this.loadTsConfig(target, projectRoot);
309
311
  const result = await esbuild.build({
@@ -611,6 +613,28 @@ Examples:
611
613
  ? fs.readFileSync(path.resolve(projectRoot, target.tsConfigPath), 'utf-8')
612
614
  : '{}';
613
615
  }
616
+ runTypeCheck(target, projectRoot) {
617
+ if (!target.tsConfigPath) {
618
+ return;
619
+ }
620
+ const tsconfigPath = path.resolve(projectRoot, target.tsConfigPath);
621
+ if (!fs.existsSync(tsconfigPath)) {
622
+ console.warn(` ⚠ tsconfig not found: ${tsconfigPath}, skipping type check`);
623
+ return;
624
+ }
625
+ console.log(' Checking types...');
626
+ try {
627
+ execSync(`npx tsc --noEmit -p ${target.tsConfigPath}`, {
628
+ cwd: projectRoot,
629
+ stdio: 'inherit'
630
+ });
631
+ console.log(' ✓ Type check passed');
632
+ }
633
+ catch {
634
+ console.error(' ✗ Type check failed');
635
+ process.exit(1);
636
+ }
637
+ }
614
638
  generateEntryContent(srcDir, exclude = []) {
615
639
  const tsFiles = this.findAllTsFiles(srcDir, exclude);
616
640
  for (const f of tsFiles) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluffjs/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "module": "./index.js",