diff --git a/lerna.json b/lerna.json index 95fcbb2bd2..a48879718e 100644 --- a/lerna.json +++ b/lerna.json @@ -3,6 +3,7 @@ "version": "independent", "npmClient": "pnpm", "packages": [ - "packages/*" + "packages/*", + "shared/*" ] } diff --git a/package.json b/package.json index 22091eb65e..7c16f07407 100644 --- a/package.json +++ b/package.json @@ -4,11 +4,11 @@ "scripts": { "dev": "lerna run dev", "build": "lerna run build", - "dev:webapp": "lerna run dev --scope \"@bigcapital/webapp\"", - "build:webapp": "lerna run build --scope \"@bigcapital/webapp\"", - "dev:server": "lerna run dev --scope \"@bigcapital/server\"", - "build:server": "lerna run build --scope \"@bigcapital/server\"", - "serve:server": "lerna run serve --scope \"@bigcapital/server\"", + "dev:webapp": "lerna run dev --scope \"@bigcapital/webapp\" --scope \"@bigcapital/utils\"", + "build:webapp": "lerna run build --scope \"@bigcapital/webapp\" --scope \"@bigcapital/utils\"", + "dev:server": "lerna run dev --scope \"@bigcapital/server\" --scope \"@bigcapital/utils\"", + "build:server": "lerna run build --scope \"@bigcapital/server\" --scope \"@bigcapital/utils\"", + "serve:server": "lerna run serve --scope \"@bigcapital/server\" --scope \"@bigcapital/utils\"", "test:e2e": "playwright test", "prepare": "husky install" }, diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index be44264053..9b8baa0514 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -90,11 +90,7 @@ RUN chown node:node / RUN npm install -g pnpm # Copy application dependency manifests to the container image. -COPY ./package*.json ./ -COPY ./pnpm-lock.yaml ./pnpm-lock.yaml -COPY ./lerna.json ./lerna.json -COPY ./pnpm-workspace.yaml ./pnpm-workspace.yaml -COPY ./packages/server/package*.json ./packages/server/ +COPY --chown=node:node ./ ./ # Install application dependencies RUN apk update @@ -109,6 +105,6 @@ RUN pnpm install COPY --chown=node:node ./packages/server ./packages/server # # Creates a "dist" folder with the production build -RUN npm run build:server --skip-nx-cache +RUN pnpm run build:server --skip-nx-cache CMD [ "node", "./packages/server/build/index.js" ] \ No newline at end of file diff --git a/packages/webapp/Dockerfile b/packages/webapp/Dockerfile index 72db057691..58a754df45 100644 --- a/packages/webapp/Dockerfile +++ b/packages/webapp/Dockerfile @@ -5,11 +5,7 @@ USER root WORKDIR /app # Copy application dependency manifests to the container image. -COPY ./package*.json ./ -COPY ./pnpm-lock.yaml ./pnpm-lock.yaml -COPY ./lerna.json ./lerna.json -COPY ./pnpm-workspace.yaml ./pnpm-workspace.yaml -COPY ./packages/webapp/package*.json ./packages/webapp/ +COPY . . # Install application dependencies RUN apk update @@ -23,7 +19,6 @@ RUN npm install -g pnpm RUN pnpm install # Build webapp package -COPY ./packages/webapp /app/packages/webapp RUN pnpm run build:webapp FROM nginx diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8986b25c40..c5abfc7bc8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,8 +37,6 @@ importers: specifier: ^9.0.5 version: 9.1.2 - packages/bigcapital-utils: {} - packages/server: dependencies: '@aws-sdk/client-s3': @@ -49,7 +47,7 @@ importers: version: 3.583.0 '@bigcapital/utils': specifier: '*' - version: link:../bigcapital-utils + version: link:../../shared/bigcapital-utils '@casl/ability': specifier: ^5.4.3 version: 5.4.4 @@ -482,7 +480,7 @@ importers: dependencies: '@bigcapital/utils': specifier: '*' - version: link:../bigcapital-utils + version: link:../../shared/bigcapital-utils '@blueprintjs-formik/core': specifier: ^0.3.6 version: 0.3.6(@babel/core@7.24.5)(@blueprintjs/core@4.20.2)(@blueprintjs/select@4.9.24)(formik@2.4.6)(react-dom@18.3.1)(react-is@18.3.1)(react@18.3.1) @@ -841,6 +839,8 @@ importers: specifier: ^0.28.1 version: 0.28.5 + shared/bigcapital-utils: {} + packages: /@alloc/quick-lru@5.2.0: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 067a01bf0f..d4e22b5d70 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,4 @@ packages: # all packages in direct subdirs of packages/ - 'packages/*' + - 'shared/*' diff --git a/packages/bigcapital-utils/.gitignore b/shared/bigcapital-utils/.gitignore similarity index 100% rename from packages/bigcapital-utils/.gitignore rename to shared/bigcapital-utils/.gitignore diff --git a/packages/bigcapital-utils/package.json b/shared/bigcapital-utils/package.json similarity index 100% rename from packages/bigcapital-utils/package.json rename to shared/bigcapital-utils/package.json diff --git a/packages/bigcapital-utils/src/countries/constant.ts b/shared/bigcapital-utils/src/countries/constant.ts similarity index 100% rename from packages/bigcapital-utils/src/countries/constant.ts rename to shared/bigcapital-utils/src/countries/constant.ts diff --git a/packages/bigcapital-utils/src/countries/index.ts b/shared/bigcapital-utils/src/countries/index.ts similarity index 100% rename from packages/bigcapital-utils/src/countries/index.ts rename to shared/bigcapital-utils/src/countries/index.ts diff --git a/packages/bigcapital-utils/src/countries/types.ts b/shared/bigcapital-utils/src/countries/types.ts similarity index 100% rename from packages/bigcapital-utils/src/countries/types.ts rename to shared/bigcapital-utils/src/countries/types.ts diff --git a/packages/bigcapital-utils/src/index.ts b/shared/bigcapital-utils/src/index.ts similarity index 100% rename from packages/bigcapital-utils/src/index.ts rename to shared/bigcapital-utils/src/index.ts diff --git a/packages/bigcapital-utils/tsconfig.json b/shared/bigcapital-utils/tsconfig.json similarity index 100% rename from packages/bigcapital-utils/tsconfig.json rename to shared/bigcapital-utils/tsconfig.json