react-client 1.0.28 → 1.0.31

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.
@@ -1,30 +1,24 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = build;
7
- const esbuild_1 = __importDefault(require("esbuild"));
8
- const path_1 = __importDefault(require("path"));
9
- const fs_extra_1 = __importDefault(require("fs-extra"));
10
- const chalk_1 = __importDefault(require("chalk"));
11
- const loadConfig_1 = require("../../utils/loadConfig");
12
- async function build() {
1
+ import esbuild from 'esbuild';
2
+ import path from 'path';
3
+ import fs from 'fs-extra';
4
+ import chalk from 'chalk';
5
+ import { loadReactClientConfig } from '../../utils/loadConfig';
6
+ export default async function build() {
13
7
  const root = process.cwd();
14
- const config = await (0, loadConfig_1.loadReactClientConfig)(root);
15
- const appRoot = path_1.default.resolve(root, config.root || '.');
16
- const outDir = path_1.default.join(appRoot, config.build?.outDir || '.react-client/build');
17
- console.log(chalk_1.default.cyan(`\nšŸ—ļø Building project...`));
18
- console.log(chalk_1.default.gray(`Root: ${appRoot}`));
19
- console.log(chalk_1.default.gray(`Output: ${outDir}\n`));
20
- const entry = path_1.default.join(appRoot, 'src', 'main.tsx');
21
- if (!fs_extra_1.default.existsSync(entry)) {
22
- console.error(chalk_1.default.red('āŒ Entry not found: src/main.tsx'));
8
+ const config = await loadReactClientConfig(root);
9
+ const appRoot = path.resolve(root, config.root || '.');
10
+ const outDir = path.join(appRoot, config.build?.outDir || '.react-client/build');
11
+ console.log(chalk.cyan(`\nšŸ—ļø Building project...`));
12
+ console.log(chalk.gray(`Root: ${appRoot}`));
13
+ console.log(chalk.gray(`Output: ${outDir}\n`));
14
+ const entry = path.join(appRoot, 'src', 'main.tsx');
15
+ if (!fs.existsSync(entry)) {
16
+ console.error(chalk.red('āŒ Entry not found: src/main.tsx'));
23
17
  process.exit(1);
24
18
  }
25
- await fs_extra_1.default.ensureDir(outDir);
19
+ await fs.ensureDir(outDir);
26
20
  try {
27
- await esbuild_1.default.build({
21
+ await esbuild.build({
28
22
  entryPoints: [entry],
29
23
  bundle: true,
30
24
  minify: true,
@@ -33,8 +27,8 @@ async function build() {
33
27
  define: { 'process.env.NODE_ENV': '"production"' },
34
28
  loader: { '.ts': 'ts', '.tsx': 'tsx', '.js': 'jsx', '.jsx': 'jsx' },
35
29
  });
36
- console.log(chalk_1.default.green(`āœ… Build completed successfully!`));
37
- console.log(chalk_1.default.gray(`Output directory: ${outDir}`));
30
+ console.log(chalk.green(`āœ… Build completed successfully!`));
31
+ console.log(chalk.gray(`Output directory: ${outDir}`));
38
32
  }
39
33
  catch (err) {
40
34
  const msg = err instanceof Error ? err.message : String(err);