react-client 1.0.28 → 1.0.30

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,44 +1,50 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
4
9
  };
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() {
13
- 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'));
23
- process.exit(1);
24
- }
25
- await fs_extra_1.default.ensureDir(outDir);
26
- try {
27
- await esbuild_1.default.build({
28
- entryPoints: [entry],
29
- bundle: true,
30
- minify: true,
31
- sourcemap: true,
32
- outdir: outDir,
33
- define: { 'process.env.NODE_ENV': '"production"' },
34
- loader: { '.ts': 'ts', '.tsx': 'tsx', '.js': 'jsx', '.jsx': 'jsx' },
35
- });
36
- console.log(chalk_1.default.green(`āœ… Build completed successfully!`));
37
- console.log(chalk_1.default.gray(`Output directory: ${outDir}`));
38
- }
39
- catch (err) {
40
- const msg = err instanceof Error ? err.message : String(err);
41
- console.error('āŒ Build failed:', msg);
42
- process.exit(1);
43
- }
10
+ import esbuild from 'esbuild';
11
+ import path from 'path';
12
+ import fs from 'fs-extra';
13
+ import chalk from 'chalk';
14
+ import { loadReactClientConfig } from '../../utils/loadConfig';
15
+ export default function build() {
16
+ return __awaiter(this, void 0, void 0, function* () {
17
+ var _a;
18
+ const root = process.cwd();
19
+ const config = yield loadReactClientConfig(root);
20
+ const appRoot = path.resolve(root, config.root || '.');
21
+ const outDir = path.join(appRoot, ((_a = config.build) === null || _a === void 0 ? void 0 : _a.outDir) || '.react-client/build');
22
+ console.log(chalk.cyan(`\nšŸ—ļø Building project...`));
23
+ console.log(chalk.gray(`Root: ${appRoot}`));
24
+ console.log(chalk.gray(`Output: ${outDir}\n`));
25
+ const entry = path.join(appRoot, 'src', 'main.tsx');
26
+ if (!fs.existsSync(entry)) {
27
+ console.error(chalk.red('āŒ Entry not found: src/main.tsx'));
28
+ process.exit(1);
29
+ }
30
+ yield fs.ensureDir(outDir);
31
+ try {
32
+ yield esbuild.build({
33
+ entryPoints: [entry],
34
+ bundle: true,
35
+ minify: true,
36
+ sourcemap: true,
37
+ outdir: outDir,
38
+ define: { 'process.env.NODE_ENV': '"production"' },
39
+ loader: { '.ts': 'ts', '.tsx': 'tsx', '.js': 'jsx', '.jsx': 'jsx' },
40
+ });
41
+ console.log(chalk.green(`āœ… Build completed successfully!`));
42
+ console.log(chalk.gray(`Output directory: ${outDir}`));
43
+ }
44
+ catch (err) {
45
+ const msg = err instanceof Error ? err.message : String(err);
46
+ console.error('āŒ Build failed:', msg);
47
+ process.exit(1);
48
+ }
49
+ });
44
50
  }