create-bluecopa-react-app 1.0.43 → 1.0.45

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/README.md CHANGED
@@ -2,26 +2,31 @@
2
2
 
3
3
  ## A CLI Tool for Bluecopa React Applications
4
4
 
5
- A command-line interface for bootstrapping modern React applications with Bluecopa integration, featuring opinionated best practices and pre-configured tooling.
5
+ A command-line interface for scaffolding a Bluecopa microfrontend (MFE) React
6
+ application, pre-wired for the Bluecopa platform: `@bluecopa/react` data hooks,
7
+ single-spa + Module Federation mounting, the Dream Light design system on
8
+ Tailwind CSS v4, AG Grid tables and ECharts charts.
9
+
10
+ > The generated app is a **single-spa / Module Federation microfrontend** that
11
+ > mounts inside the Bluecopa shell (it also runs standalone for local dev). It is
12
+ > not a plain React Router SPA.
6
13
 
7
14
  ## Table of Contents
8
15
 
9
- - [Version](#version)
10
16
  - [Installation](#installation)
11
17
  - [Requirements](#requirements)
12
- - [Configuration](#configuration)
13
- - [Features](#features)
14
18
  - [Usage](#usage)
15
- - [API Documentation](#api-documentation)
16
- - [Examples](#examples)
19
+ - [CLI Options](#cli-options)
20
+ - [Interactive Prompts](#interactive-prompts)
21
+ - [Features](#features)
22
+ - [Generated App](#generated-app)
23
+ - [Tech Stack](#tech-stack)
24
+ - [Project Structure](#project-structure)
25
+ - [Scripts](#scripts)
17
26
  - [Development](#development)
18
- - [Contributing](#contributing)
27
+ - [Monorepo Integration](#monorepo-integration)
19
28
  - [License](#license)
20
29
 
21
- ## Version
22
-
23
- Current version: 1.0.5
24
-
25
30
  ## Installation
26
31
 
27
32
  ```bash
@@ -30,142 +35,159 @@ npm install -g create-bluecopa-react-app
30
35
  pnpm add -g create-bluecopa-react-app
31
36
  ```
32
37
 
33
- ## Requirements
34
-
35
- - Node.js >= 18.0.0
36
- - npm >= 9.0.0 or pnpm >= 8.0.0
37
-
38
- ## Configuration
39
-
40
- The CLI uses environment variables for configuration:
38
+ Or run without installing:
41
39
 
42
40
  ```bash
43
- # Optional configuration
44
- export BLUECOPA_BOILERPLATE_REGISTRY=https://registry.npmjs.org
41
+ npx create-bluecopa-react-app my-dashboard
45
42
  ```
46
43
 
47
- ## Features
44
+ ## Requirements
48
45
 
49
- - 🚀 **Modern React Stack**: React 18, TypeScript, React Router v7, Vite 6
50
- - 🌐 **Microfrontend Support**: Single-spa compatible with module federation
51
- - 📊 **Data Visualization**: Recharts integration for charts and analytics
52
- - 🎨 **UI Components**: shadcn/ui components built on Radix UI primitives
53
- - 📡 **Bluecopa React Components**: Pre-configured [`@bluecopa/react`](packages/react:1) package with hooks (includes TanStack Query integration)
54
- - 🎯 **Type Safety**: Full TypeScript support
55
- - 📱 **Responsive Design**: Tailwind CSS v4 with mobile-first approach and Bluecopa design system
56
- - 🛠️ **Development Tools**: ESLint, TypeScript checking, and Vite fast build system
57
- - ⚡ **Fast Development**: Hot module replacement with Vite
58
- - 🔄 **Server-side Rendering**: React Router v7 with SSR support
59
- - 🌙 **Dark Mode**: Built-in theme switching with next-themes
60
- - 🗂️ **Data Tables**: TanStack Table with sorting, filtering, and pagination
61
- - 🎯 **Drag & Drop**: DND Kit integration for interactive interfaces
46
+ - Node.js >= 18.0.0
47
+ - npm >= 9, or pnpm (recommended). yarn is also supported.
62
48
 
63
49
  ## Usage
64
50
 
65
- ### Creating a New Application
66
-
67
51
  ```bash
68
- # Create new app with default template
69
- create-bluecopa-react-app my-dashboard
52
+ # Interactive prompts for name, template, git, package manager, install
53
+ create-bluecopa-react-app
70
54
 
71
- # Create new app with shadcn/ui template
72
- create-bluecopa-react-app my-dashboard --template shadcn
55
+ # Non-interactive
56
+ create-bluecopa-react-app my-dashboard --yes
73
57
 
74
- # Or use npx
75
- npx create-bluecopa-react-app my-dashboard
76
- npx create-bluecopa-react-app my-dashboard --template shadcn
58
+ # Explicit options
59
+ create-bluecopa-react-app my-app --package-manager pnpm --no-git
60
+ create-bluecopa-react-app my-app --skip-install
77
61
  ```
78
62
 
79
- ### Available Templates
63
+ ## CLI Options
80
64
 
81
- - **Default Template**: Basic React Router setup with essential components
82
- - **shadcn Template**: Full-featured template with shadcn/ui components, data tables, charts, and dark mode support
65
+ Positional argument: `[project-name]` name of the project directory (prompted if omitted).
83
66
 
84
- ### CLI Options
67
+ | Option | Alias | Description | Default |
68
+ | ---------------------------------- | ----- | -------------------------------------- | ---------- |
69
+ | `--template <template>` | `-t` | Template to use (only `latest` exists) | `latest` |
70
+ | `--package-manager <manager>` | | Package manager: `npm`, `yarn`, `pnpm` | `auto` |
71
+ | `--skip-install` | | Skip dependency installation | installs |
72
+ | `--git` / `--no-git` | | Initialize (or skip) a git repository | `--git` |
73
+ | `--yes` | | Skip all prompts and use defaults | off |
74
+ | `--typescript` / `--no-typescript` | | Template language flag (see note) | TypeScript |
75
+ | `--version` | | Print the CLI version | |
76
+ | `--help` | | Show help | |
85
77
 
86
- | Option | Description |
87
- | ---------------- | ---------------------------------- |
88
- | `--skip-install` | Skip dependency installation |
89
- | `--template` | Specify template (default, shadcn) |
90
- | `--help` | Show help information |
78
+ > **Note:** only a single TypeScript template (`latest`) ships today. The
79
+ > `--typescript` / `--no-typescript` flags are parsed but there is no JavaScript
80
+ > template, so they have no effect.
91
81
 
92
- ## API Documentation
82
+ ## Interactive Prompts
93
83
 
94
- ### `create-bluecopa-react-app [project-name] [options]`
84
+ When `--yes` is not passed, the CLI prompts (via inquirer) in order:
95
85
 
96
- Creates a new Bluecopa React application.
86
+ 1. **Project name** — defaults to a random `my-<adjective>-<noun>`; validated against npm naming rules.
87
+ 2. **Template** — `latest` (Bluecopa MFE React app).
88
+ 3. **Initialize git repository?** — default yes (unless `--no-git`).
89
+ 4. **Package manager** — pnpm (recommended) / npm / auto-detect.
90
+ 5. **Install dependencies now?** — default depends on `--skip-install`.
97
91
 
98
- **Parameters:**
92
+ If the target directory already exists, it asks to overwrite (auto-overwrites with `--yes`). After copying the template it sets `package.json` `name`, replaces `{{APP_NAME}}` placeholders in the HTML entry points, and (when git is enabled) writes a `.gitignore` and creates an initial commit.
99
93
 
100
- - `project-name`: Name of the new project directory
101
- - `options`: CLI options (see above)
94
+ ## Features
102
95
 
103
- **Returns:**
96
+ - ⚛️ **React 18 + TypeScript** with the SWC-based Vite plugin
97
+ - 🧩 **Microfrontend-ready** — single-spa mount/unmount + Module Federation (`@originjs/vite-plugin-federation`), SystemJS output
98
+ - 📡 **Bluecopa data layer** — pre-configured [`@bluecopa/react`](https://www.npmjs.com/package/@bluecopa/react) hooks (TanStack Query under the hood)
99
+ - 🎨 **Dream Light design system** on **Tailwind CSS v4** with the `copa:` prefix, plus shadcn/ui (`new-york`) + Radix UI primitives
100
+ - 🗂️ **AG Grid** tables (community + enterprise) with a server-side datasource helper
101
+ - 📊 **ECharts** charts via a `ChartProvider` and themed chart components
102
+ - 🔔 **Toasts** with sonner, icons from lucide-react and Tabler
103
+ - 🧭 **React Router v7** routing
104
+ - ⚡ **Vite** dev server + fast build, `~/` path alias to `app/`
105
+ - 🐳 **Deployment ready** — Dockerfile and `.env.example` included
104
106
 
105
- - Creates project structure
106
- - Installs dependencies
107
- - Configures environment
107
+ ## Generated App
108
108
 
109
- ## Examples
109
+ ### Tech Stack
110
110
 
111
- ### Basic Usage
111
+ | Area | Libraries |
112
+ | ------------- | ------------------------------------------------------------------------------------------------------------------ |
113
+ | Framework | React `^18.3.1`, react-dom `^18.3.1`, react-router-dom `^7.16.0` |
114
+ | Build | Vite `8.0.16`, `@vitejs/plugin-react-swc`, `vite-tsconfig-paths`, TypeScript `^5.8.3` |
115
+ | Data layer | `@bluecopa/react` `0.1.117` (TanStack Query) |
116
+ | Styling | Tailwind CSS v4 (`@tailwindcss/vite`), `tw-animate-css`, `cva`, `clsx`, `tailwind-merge` |
117
+ | UI | shadcn/ui (`new-york`), Radix UI (dialog, dropdown, tabs, tooltip, …), lucide-react, `@tabler/icons-react`, sonner |
118
+ | Tables | `ag-grid-community`, `ag-grid-enterprise`, `ag-grid-react` (v34) |
119
+ | Charts | `echarts` v6 + `echarts-for-react` (also `ag-charts-enterprise` available) |
120
+ | Microfrontend | `single-spa` `6.0.3`, `@originjs/vite-plugin-federation` |
112
121
 
113
- ```bash
114
- create-bluecopa-react-app my-dashboard
115
- ```
122
+ `package.json` `overrides` pin security-sensitive transitive deps: `axios` `1.16.0`, `rollup` `4.59.0`, `ajv` `8.18.0`, `protobufjs` `>=7.5.8 <8`, `postcss` `>=8.5.10`, `ws` `>=8.20.1 <9`.
116
123
 
117
- ### Skipping Dependency Installation
124
+ ### Project Structure
118
125
 
119
- ```bash
120
- create-bluecopa-react-app my-dashboard --skip-install
126
+ The source root is `app/` (aliased as `~/`), not `src/`:
127
+
128
+ ```
129
+ my-app/
130
+ ├── index.html # standalone entry ({{APP_NAME}} placeholder)
131
+ ├── preview/index.html # preview build entry
132
+ ├── vite.config.ts # dev server :8080, Module Federation, SystemJS output
133
+ ├── tsconfig.json # ES2022, bundler resolution, ~/* → app/*
134
+ ├── components.json # shadcn config (new-york, copa prefix, @bluecopa-ui registry)
135
+ ├── Dockerfile, .env.example, .gitignore
136
+ ├── CLAUDE.md, Agent.md # agent/dev guides
137
+ ├── public/ # favicons
138
+ └── app/
139
+ ├── app.tsx # root: QueryClient, ChartProvider, AppProvider, MFE config
140
+ ├── main.tsx # standalone BrowserRouter entry
141
+ ├── single-spa.tsx # MFE MemoryRouter entry (manualMount / manualUnmount)
142
+ ├── app.css # Tailwind v4 + Dream Light theme tokens
143
+ ├── components/ # bluecopa-logo, error-boundary, loading-screen
144
+ │ ├── ui/ # shadcn components (button, card, sidebar, ag-grid-table, …)
145
+ │ ├── charts/ # ECharts: bar-chart, donut-chart, chart-provider, chart-theme
146
+ │ └── layouts/ # app-layout, app-sidebar, nav-main, nav-user, site-header
147
+ ├── contexts/ # app-context
148
+ ├── hooks/ # use-mobile, use-permissions
149
+ ├── pages/ # dashboard, payments, settings
150
+ ├── routes/ # index route table
151
+ ├── constants/, types/ # MfeProps, EnvConfig, …
152
+ └── utils/ # ag-grid-datasource, ag-grid-license, ag-grid-theme,
153
+ # component-style, style-drivers, cn()
121
154
  ```
122
155
 
123
- ### Using npx (Recommended)
156
+ The Vite config exposes `./App` → `app/single-spa.tsx` under the federation name
157
+ `__copa_ext_app__react_route` (`remoteEntry.js`), externalizes `react`/`react-dom`,
158
+ and emits SystemJS (`format: "system"`) so the Bluecopa shell can mount it.
124
159
 
125
- ```bash
126
- npx create-bluecopa-react-app my-dashboard
127
- ```
160
+ ### Scripts
161
+
162
+ | Script | Command | Purpose |
163
+ | ----------- | ------------------------------------ | ----------------------------- |
164
+ | `dev` | `vite` | Dev server on port 8080 |
165
+ | `build` | `tsc && vite build` | Type-check + production build |
166
+ | `start` | `npx serve dist -l 3001 --cors` | Serve the production build |
167
+ | `preview` | `npx serve ./preview -l 8080 --cors` | Serve the preview build |
168
+ | `typecheck` | `tsc` | Type-check without emitting |
128
169
 
129
170
  ## Development
130
171
 
131
- ### Available Scripts
132
-
133
- - `npm run dev` - Start Vite development server with hot reload
134
- - `npm run build` - Build for production (TypeScript + Vite optimization)
135
- - `npm run start` - Start production build locally
136
- - `npm run preview` - Preview production build locally
137
- - `npm run lint` - Run ESLint for code quality
138
- - `npm run lint:fix` - Fix linting issues
139
- - `npm run type-check` - Run TypeScript type checking without emitting files
140
- - `npm run clean` - Clean build artifacts and dependencies
141
-
142
- ### Technologies Used
143
-
144
- - **React 18** - Modern React with concurrent features
145
- - **React Router v7** - Modern routing with SSR support
146
- - **Vite 6** - Fast build tool and development server
147
- - **TypeScript** - Full type safety and developer experience
148
- - **[`@bluecopa/react`](packages/react:1)** - Bluecopa-specific React components and hooks
149
- - **shadcn/ui** - Accessible component library built on Radix UI
150
- - **Radix UI** - Unstyled, accessible UI primitives
151
- - **TanStack Table** - Headless table library for React
152
- - **Recharts** - Composable charting library for React
153
- - **DND Kit** - Drag and drop toolkit for React
154
- - **Tailwind CSS v4** - Utility-first CSS framework with Bluecopa design system
155
- - **next-themes** - Theme switching with dark mode support
156
- - **Lucide React** - Beautiful, customizable icons
172
+ Working on the CLI itself (inside the monorepo):
157
173
 
158
- ## Monorepo Integration
174
+ ```bash
175
+ # From packages/boilerplate/react
176
+ node bin/create-bluecopa-react-app.js my-test-app # run the CLI locally
177
+ pnpm format # format with Prettier
178
+ ```
179
+
180
+ The template lives in `templates/latest/`. Edit files there to change what gets
181
+ scaffolded. Keep the CLI's `.version()` in `bin/create-bluecopa-react-app.js` in
182
+ sync with `package.json` when publishing.
159
183
 
160
- This CLI tool is part of the Bluecopa UI monorepo and integrates with the following packages:
184
+ ## Monorepo Integration
161
185
 
162
- - **[`@bluecopa/react`](packages/react:1)** - Bluecopa-specific React components and hooks
186
+ This CLI is part of the Bluecopa UI monorepo and pairs with:
163
187
 
164
- ### Standalone Development
188
+ - [`@bluecopa/react`](https://www.npmjs.com/package/@bluecopa/react) — React Query hooks over the Bluecopa API
189
+ - [`@bluecopa/core`](https://www.npmjs.com/package/@bluecopa/core) — the underlying TypeScript API SDK
165
190
 
166
- The generated applications can also be developed independently:
191
+ ## License
167
192
 
168
- 1. **Self-contained**: All dependencies are properly installed
169
- 2. **Environment setup**: Includes proper environment variable configuration
170
- 3. **Build optimization**: Uses Vite for fast development and production builds
171
- 4. **Deployment ready**: Includes Docker configuration and deployment guides
193
+ MIT
@@ -17,7 +17,7 @@ const __dirname = path.dirname(__filename);
17
17
  const program = new Command();
18
18
 
19
19
  program
20
- .version("1.0.5")
20
+ .version("1.0.45")
21
21
  .name("create-bluecopa-react-app")
22
22
  .description("Create a new Bluecopa React application")
23
23
  .argument("[project-name]", "Name of the project")
@@ -28,7 +28,7 @@ program
28
28
  .option(
29
29
  "--package-manager <manager>",
30
30
  "Package manager to use (npm, yarn, pnpm)",
31
- "auto"
31
+ "auto",
32
32
  )
33
33
  .option("--git", "Initialize git repository", true)
34
34
  .option("--no-git", "Skip git initialization")
@@ -49,7 +49,7 @@ Templates:
49
49
 
50
50
  For more information, visit:
51
51
  https://github.com/bluecopa/blui/tree/dev/packages/boilerplate/react
52
- `
52
+ `,
53
53
  )
54
54
  .action(async (projectName, options) => {
55
55
  try {
@@ -178,7 +178,7 @@ async function createApp(projectName, options) {
178
178
  // When using --yes flag, validate required options
179
179
  if (!appName) {
180
180
  console.error(
181
- chalk.red("Project name is required when using --yes flag")
181
+ chalk.red("Project name is required when using --yes flag"),
182
182
  );
183
183
  process.exit(1);
184
184
  }
@@ -189,7 +189,7 @@ async function createApp(projectName, options) {
189
189
  if (!validTemplates.includes(selectedTemplate)) {
190
190
  console.error(chalk.red(`Invalid template: ${selectedTemplate}`));
191
191
  console.error(
192
- chalk.yellow(`Available templates: ${validTemplates.join(", ")}`)
192
+ chalk.yellow(`Available templates: ${validTemplates.join(", ")}`),
193
193
  );
194
194
  process.exit(1);
195
195
  }
@@ -199,12 +199,12 @@ async function createApp(projectName, options) {
199
199
  if (!validation.validForNewPackages) {
200
200
  console.error(
201
201
  chalk.red("Invalid project name:"),
202
- validation.errors?.[0] || validation.warnings?.[0]
202
+ validation.errors?.[0] || validation.warnings?.[0],
203
203
  );
204
204
  console.error(
205
205
  chalk.yellow(
206
- "Project names must be lowercase, contain no spaces, and follow npm naming conventions."
207
- )
206
+ "Project names must be lowercase, contain no spaces, and follow npm naming conventions.",
207
+ ),
208
208
  );
209
209
  process.exit(1);
210
210
  }
@@ -215,7 +215,7 @@ async function createApp(projectName, options) {
215
215
  if (fs.existsSync(targetDir)) {
216
216
  if (options.yes) {
217
217
  console.log(
218
- chalk.yellow(`Directory ${appName} already exists. Overwriting...`)
218
+ chalk.yellow(`Directory ${appName} already exists. Overwriting...`),
219
219
  );
220
220
  await fs.remove(targetDir);
221
221
  } else {
@@ -238,7 +238,9 @@ async function createApp(projectName, options) {
238
238
  }
239
239
 
240
240
  console.log(
241
- chalk.blue(`Creating a new Bluecopa React app in ${chalk.green(targetDir)}`)
241
+ chalk.blue(
242
+ `Creating a new Bluecopa React app in ${chalk.green(targetDir)}`,
243
+ ),
242
244
  );
243
245
  console.log(chalk.gray(`Template: ${selectedTemplate}`));
244
246
  console.log();
@@ -256,15 +258,15 @@ async function createApp(projectName, options) {
256
258
  if (!options.skipInstall) {
257
259
  const detectedPackageManager = await detectPackageManager(packageManager);
258
260
  spinner.start(
259
- `Installing dependencies with ${detectedPackageManager}...`
261
+ `Installing dependencies with ${detectedPackageManager}...`,
260
262
  );
261
263
  await installDependencies(targetDir, detectedPackageManager);
262
264
  spinner.succeed("Dependencies installed");
263
265
  } else {
264
266
  console.log(
265
267
  chalk.yellow(
266
- "Skipping dependency installation. You can run it manually later."
267
- )
268
+ "Skipping dependency installation. You can run it manually later.",
269
+ ),
268
270
  );
269
271
  }
270
272
 
@@ -276,7 +278,7 @@ async function createApp(projectName, options) {
276
278
  }
277
279
 
278
280
  spinner.succeed(
279
- chalk.green("Success! Created " + appName + " at " + targetDir)
281
+ chalk.green("Success! Created " + appName + " at " + targetDir),
280
282
  );
281
283
 
282
284
  console.log();
@@ -336,8 +338,8 @@ async function createApp(projectName, options) {
336
338
  console.log(chalk.gray("Need help? Check out the documentation:"));
337
339
  console.log(
338
340
  chalk.gray(
339
- " https://github.com/bluecopa/blui/tree/main/packages/boilerplate/react"
340
- )
341
+ " https://github.com/bluecopa/blui/tree/main/packages/boilerplate/react",
342
+ ),
341
343
  );
342
344
  } catch (error) {
343
345
  spinner.fail("Failed to create project");
@@ -356,7 +358,7 @@ async function createProjectStructure(targetDir, appName, options) {
356
358
  // Validate template directory exists
357
359
  if (!(await fs.pathExists(templateDir))) {
358
360
  throw new Error(
359
- `Template '${options.template}' not found at ${templateDir}`
361
+ `Template '${options.template}' not found at ${templateDir}`,
360
362
  );
361
363
  }
362
364
 
@@ -400,8 +402,8 @@ async function detectPackageManager(preferredManager) {
400
402
  } catch {
401
403
  console.log(
402
404
  chalk.yellow(
403
- `Warning: ${preferredManager} not found, falling back to auto-detection`
404
- )
405
+ `Warning: ${preferredManager} not found, falling back to auto-detection`,
406
+ ),
405
407
  );
406
408
  }
407
409
  }
@@ -437,7 +439,7 @@ async function installDependencies(targetDir, packageManager) {
437
439
  execSync(installCommand, { stdio: "inherit" });
438
440
  } catch (error) {
439
441
  throw new Error(
440
- `Failed to install dependencies with ${packageManager}: ${error.message}`
442
+ `Failed to install dependencies with ${packageManager}: ${error.message}`,
441
443
  );
442
444
  }
443
445
  }
@@ -466,7 +468,7 @@ pnpm-debug.log*
466
468
  if (!fs.existsSync(gitignorePath)) {
467
469
  fs.writeFileSync(gitignorePath, gitignoreContent.trimStart());
468
470
  }
469
-
471
+
470
472
  // Initialize git repository
471
473
  execSync("git init", { stdio: "ignore" });
472
474
  // Create initial commit
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bluecopa-react-app",
3
- "version": "1.0.43",
3
+ "version": "1.0.45",
4
4
  "description": "CLI tool to create bluecopa React applications",
5
5
  "type": "module",
6
6
  "main": "./bin/create-bluecopa-react-app.js",
@@ -1,8 +1,18 @@
1
1
  # API base URL for the Bluecopa platform
2
- VITE_BLUECOPA_API_URL=https://api.bluecopa.com
2
+ VITE_BLUECOPA_API_URL=https://develop.bluecopa.com/api/v1
3
3
 
4
4
  # Workspace ID for standalone development
5
5
  VITE_BLUECOPA_WORKSPACE_ID=YOUR_WORKSPACE_ID
6
6
 
7
- # AG Grid Enterprise license key (optional watermarks shown without it)
7
+ # ─── Auth / identity (standalone dev) ───────────────────────────────
8
+ VITE_BLUECOPA_API_TOKEN=
9
+ VITE_BLUECOPA_USER_ID=
10
+
11
+ # ─── AG Grid Enterprise license ─────────────────────────────────────
8
12
  VITE_AG_GRID_LICENSE_KEY=
13
+
14
+ # ─── Solution context (Input Table V2 / deployed solutions) ─────────
15
+ # Flow through to the x-bluecopa-solution-* SDK headers.
16
+ VITE_BLUECOPA_SOLUTION_ID=
17
+ VITE_BLUECOPA_SOLUTION_BRANCH=main
18
+ VITE_BLUECOPA_SOLUTION_BRANCH_TYPE=REMOTE