create-bluecopa-react-app 1.0.8 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bluecopa-react-app",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "description": "CLI tool to create bluecopa React applications",
5
5
  "type": "module",
6
6
  "main": "./bin/create-bluecopa-react-app.js",
@@ -1,22 +1,29 @@
1
- FROM node:20-alpine AS development-dependencies-env
2
- COPY . /app
3
- WORKDIR /app
4
- RUN npm ci
5
-
6
- FROM node:20-alpine AS production-dependencies-env
7
- COPY ./package.json package-lock.json /app/
8
- WORKDIR /app
9
- RUN npm ci --omit=dev
10
-
11
- FROM node:20-alpine AS build-env
12
- COPY . /app/
13
- COPY --from=development-dependencies-env /app/node_modules /app/node_modules
14
- WORKDIR /app
1
+ FROM node:18-alpine AS production
2
+
3
+ # Set working directory
4
+ WORKDIR /usr/src/app
5
+
6
+ # Copy package files
7
+ COPY package*.json ./
8
+
9
+ # Install dependencies
10
+ RUN npm install
11
+
12
+ # Copy source code
13
+ COPY . .
14
+
15
+ # Build the application
15
16
  RUN npm run build
16
17
 
17
- FROM node:20-alpine
18
- COPY ./package.json package-lock.json /app/
19
- COPY --from=production-dependencies-env /app/node_modules /app/node_modules
20
- COPY --from=build-env /app/build /app/build
21
- WORKDIR /app
22
- CMD ["npm", "run", "start"]
18
+ # Install serve globally
19
+ RUN npm install -g serve@14.2.0
20
+
21
+ # Expose port
22
+ EXPOSE 8080
23
+
24
+ # Health check
25
+ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
26
+ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1
27
+
28
+ # Start the application
29
+ CMD ["npx", "serve", "-s", "dist", "-l", "8080", "--cors"]
@@ -6,7 +6,7 @@ import './app.css'
6
6
 
7
7
  const { QueryClient, QueryClientProvider } = reactQuery;
8
8
 
9
- export default function App() {
9
+ export default function App(props: any) {
10
10
  const [queryClient] = useState(() => new QueryClient({
11
11
  defaultOptions: {
12
12
  queries: {
@@ -29,10 +29,11 @@ export default function App() {
29
29
  }
30
30
 
31
31
  copaSetConfig({
32
- apiBaseUrl: import.meta.env.VITE_BLUECOPA_API_URL || 'https://develop.bluecopa.com',
33
- workspaceId: import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || '',
34
- accessToken: copaUser?.accessToken || '',
35
- });
32
+ apiBaseUrl: props.apiBaseUrl || import.meta.env.VITE_BLUECOPA_API_URL || 'https://develop.bluecopa.com',
33
+ workspaceId: props.workspaceId || import.meta.env.VITE_BLUECOPA_WORKSPACE_ID || '',
34
+ accessToken: props.accessToken || copaUser?.accessToken || '',
35
+ userId: props.userId || ''
36
+ } as any);
36
37
  }, []);
37
38
 
38
39
  return (
@@ -1,6 +1,7 @@
1
- import { Button } from "~/components/ui/button"
2
- import { Separator } from "~/components/ui/separator"
3
- import { SidebarTrigger } from "~/components/ui/sidebar"
1
+ import { navigateToUrl } from "single-spa";
2
+ import { Button } from "~/components/ui/button";
3
+ import { Separator } from "~/components/ui/separator";
4
+ import { SidebarTrigger } from "~/components/ui/sidebar";
4
5
 
5
6
  export function SiteHeader() {
6
7
  return (
@@ -12,8 +13,16 @@ export function SiteHeader() {
12
13
  className="mx-2 data-[orientation=vertical]:h-4"
13
14
  />
14
15
  <h1 className="text-base font-medium">Documents</h1>
15
-
16
+ </div>
17
+ <div className="flex w-full justify-end items-center gap-1 px-4 lg:gap-2 lg:px-6">
18
+ <Button
19
+ onClick={() => {
20
+ navigateToUrl("/apps-studio/portals");
21
+ }}
22
+ >
23
+ Go to portals
24
+ </Button>
16
25
  </div>
17
26
  </header>
18
- )
27
+ );
19
28
  }
@@ -1,14 +1,10 @@
1
- import { AppSidebar } from "~/components/app-sidebar"
2
- import { ChartAreaInteractive } from "~/components/chart-area-interactive"
3
- import { DataTable } from "~/components/data-table"
4
- import { SectionCards } from "~/components/section-cards"
5
- import { SiteHeader } from "~/components/site-header"
6
- import {
7
- SidebarInset,
8
- SidebarProvider,
9
- } from "~/components/ui/sidebar"
10
-
11
- import data from "~/dashboard/data.json"
1
+ import { AppSidebar } from "~/components/app-sidebar";
2
+ import { ChartAreaInteractive } from "~/components/chart-area-interactive";
3
+ import { DataTable } from "~/components/data-table";
4
+ import { SectionCards } from "~/components/section-cards";
5
+ import { SiteHeader } from "~/components/site-header";
6
+ import { SidebarInset, SidebarProvider } from "~/components/ui/sidebar";
7
+ import data from "~/dashboard/data.json";
12
8
 
13
9
  export default function Page() {
14
10
  return (
@@ -36,5 +32,5 @@ export default function Page() {
36
32
  </div>
37
33
  </SidebarInset>
38
34
  </SidebarProvider>
39
- )
35
+ );
40
36
  }
@@ -20,17 +20,17 @@ let root: Root | null = null;
20
20
 
21
21
  // Root component wrapper that handles routing
22
22
  const MicrofrontendRoot: React.FC<{
23
- basename?: string;
24
- isMicroFrontend?: boolean;
25
- }> = ({ basename = "/", isMicroFrontend = false }) => {
23
+ isMicroFrontend: boolean;
24
+ props?: { basename: string };
25
+ }> = ({ isMicroFrontend, props }) => {
26
26
  // Use MemoryRouter for micro-frontend to avoid conflicts with host routing
27
27
  // Use BrowserRouter for standalone mode
28
28
  const Router = isMicroFrontend ? MemoryRouter : BrowserRouter;
29
- const routerProps = isMicroFrontend ? {} : { basename };
29
+ const routerProps = isMicroFrontend ? {} : { basename: props?.basename };
30
30
 
31
31
  return (
32
32
  <Router {...routerProps}>
33
- <App />
33
+ <App {...props} />
34
34
  </Router>
35
35
  );
36
36
  };
@@ -39,16 +39,18 @@ const MicrofrontendRoot: React.FC<{
39
39
  const lifecycles = singleSpaReact({
40
40
  React,
41
41
  ReactDOMClient: { createRoot },
42
- rootComponent: (props: AppProps & { basename: string }) => (
43
- <MicrofrontendRoot isMicroFrontend={true} basename={props.basename} />
44
- ),
42
+ rootComponent: (props: AppProps & { basename: string }) => {
43
+ return <MicrofrontendRoot props={props} isMicroFrontend={true} />;
44
+ },
45
45
  errorBoundary: (err, info) => {
46
46
  console.error("Microfrontend Single-spa Error:", err, info);
47
47
  return <div>Something went wrong loading Microfrontend</div>;
48
48
  },
49
49
  renderType: "createRoot",
50
50
  domElementGetter: () => {
51
- const el = document.getElementById("single-spa-application:bluecopa-preview");
51
+ const el = document.getElementById(
52
+ "single-spa-application:bluecopa-preview"
53
+ );
52
54
  if (!el)
53
55
  throw new Error(
54
56
  "Mount target #single-spa-application:bluecopa-preview not found"
@@ -80,7 +82,9 @@ export const manualMount = async (props: LifecycleProps) => {
80
82
  root.render(
81
83
  <MicrofrontendRoot
82
84
  isMicroFrontend={true}
83
- basename={props.basename || "/app/external/microfrontend"}
85
+ props={{
86
+ basename: props.basename || "/app/external/microfrontend",
87
+ }}
84
88
  />
85
89
  );
86
90
 
@@ -18,5 +18,8 @@
18
18
  "lib": "~/lib",
19
19
  "hooks": "~/hooks"
20
20
  },
21
- "registries": {}
21
+ "registries": {
22
+ "@shadcn": "https://ui.shadcn.com/r/index.json",
23
+ "@bluecopa-ui": "https://shadcn-ui-henna.vercel.app/r/registry.json"
24
+ }
22
25
  }
@@ -1,12 +1,12 @@
1
- System.register(['./__federation_fn_import-CzfA7kmP.js', './client-BZh_TW_6.js'], (function (exports, module) {
1
+ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-Hh38T4k9.js'], (function (exports, module) {
2
2
  'use strict';
3
- var importShared, jsxRuntimeExports, clientExports, MemoryRouter, BrowserRouter, App;
3
+ var importShared, clientExports, jsxRuntimeExports, MemoryRouter, BrowserRouter, App;
4
4
  return {
5
5
  setters: [module => {
6
6
  importShared = module.importShared;
7
7
  }, module => {
8
- jsxRuntimeExports = module.j;
9
8
  clientExports = module.c;
9
+ jsxRuntimeExports = module.j;
10
10
  MemoryRouter = module.M;
11
11
  BrowserRouter = module.B;
12
12
  App = module.A;
@@ -17,56 +17,26 @@ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-BZh_TW_6.js']
17
17
 
18
18
  const React = await importShared('react');
19
19
  let root = null;
20
- const injectStylesIntoShadowDOM = exports("injectStylesIntoShadowDOM", (styles) => {
21
- const shadowRoot = window.__microfrontendShadowRoot;
22
- if (shadowRoot) {
23
- const styleElement = document.createElement("style");
24
- const stylesArray = Array.isArray(styles) ? styles : [styles];
25
- styleElement.textContent = stylesArray.join("\n");
26
- shadowRoot.appendChild(styleElement);
27
- console.log("Styles injected into shadow DOM");
28
- } else {
29
- console.warn("Shadow DOM not available for style injection");
30
- }
31
- });
32
- const loadCSSIntoShadowDOM = exports("loadCSSIntoShadowDOM", async (cssUrls) => {
33
- const shadowRoot = window.__microfrontendShadowRoot;
34
- if (shadowRoot) {
35
- const urlsArray = Array.isArray(cssUrls) ? cssUrls : [cssUrls];
36
- for (const cssUrl of urlsArray) {
37
- try {
38
- console.log(`Loading CSS file: ${cssUrl}`);
39
- const linkElement = document.createElement("link");
40
- linkElement.rel = "stylesheet";
41
- linkElement.href = cssUrl;
42
- linkElement.onload = () => console.log(`CSS loaded: ${cssUrl}`);
43
- linkElement.onerror = () => console.warn(`Failed to load CSS: ${cssUrl}`);
44
- shadowRoot.appendChild(linkElement);
45
- await new Promise((resolve) => setTimeout(resolve, 100));
46
- } catch (error) {
47
- console.warn(`Failed to load CSS: ${cssUrl}`, error);
48
- }
49
- }
50
- } else {
51
- console.warn("Shadow DOM not available for CSS loading");
52
- }
53
- });
54
- const MicrofrontendRoot = ({ basename = "/", isMicroFrontend = false }) => {
20
+ const MicrofrontendRoot = ({ isMicroFrontend, props }) => {
55
21
  const Router = isMicroFrontend ? MemoryRouter : BrowserRouter;
56
- const routerProps = isMicroFrontend ? {} : { basename };
57
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { width: "100%", height: "100%", overflow: "auto" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { ...routerProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) }) });
22
+ const routerProps = isMicroFrontend ? {} : { basename: props?.basename };
23
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Router, { ...routerProps, children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, { ...props }) });
58
24
  };
59
25
  const lifecycles = i({
60
26
  React,
61
27
  ReactDOMClient: { createRoot: clientExports.createRoot },
62
- rootComponent: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(MicrofrontendRoot, { isMicroFrontend: true, basename: props.basename }),
28
+ rootComponent: (props) => {
29
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(MicrofrontendRoot, { props, isMicroFrontend: true });
30
+ },
63
31
  errorBoundary: (err, info) => {
64
32
  console.error("Microfrontend Single-spa Error:", err, info);
65
33
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Something went wrong loading Microfrontend" });
66
34
  },
67
35
  renderType: "createRoot",
68
36
  domElementGetter: () => {
69
- const el = document.getElementById("single-spa-application:bluecopa-preview");
37
+ const el = document.getElementById(
38
+ "single-spa-application:bluecopa-preview"
39
+ );
70
40
  if (!el)
71
41
  throw new Error(
72
42
  "Mount target #single-spa-application:bluecopa-preview not found"
@@ -84,38 +54,8 @@ System.register(['./__federation_fn_import-CzfA7kmP.js', './client-BZh_TW_6.js']
84
54
  root.unmount();
85
55
  root = null;
86
56
  }
87
- injectStylesIntoShadowDOM(`
88
- /* Basic reset for microfrontend */
89
- * {
90
- box-sizing: border-box;
91
- }
92
-
93
- body {
94
- margin: 0;
95
- padding: 0;
96
- font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
97
- font-size: 14px;
98
- line-height: 1.5;
99
- color: #000;
100
- }
101
-
102
- /* Ensure proper display */
103
- #microfrontend-container {
104
- width: 100%;
105
- height: 100%;
106
- overflow: auto;
107
- }
108
- `);
109
57
  root = clientExports.createRoot(props.domElement);
110
- root.render(
111
- /* @__PURE__ */ jsxRuntimeExports.jsx(
112
- MicrofrontendRoot,
113
- {
114
- isMicroFrontend: true,
115
- basename: props.basename || "/app/external/microfrontend"
116
- }
117
- )
118
- );
58
+ root.render(/* @__PURE__ */ jsxRuntimeExports.jsx(MicrofrontendRoot, { isMicroFrontend: true }));
119
59
  console.log("Microfrontend mounted successfully");
120
60
  return;
121
61
  } catch (error) {