'NestJs / Typescript: Export client.ts to public folder

I have a NestJs / Typescript project. In the analytics module, I have a client.ts (libs/analytics/src/client/client.ts) file which I want to host in my public folder (public/js), accessible by the client angular application.

How do I export this one client.ts file to the public folder when the project compiles?

Below is my .tsconfig.json file:

{
  "compilerOptions": {
    "module": "commonjs",
    "declaration": true,
    "removeComments": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "allowSyntheticDefaultImports": true,
    "resolveJsonModule": true,
    "target": "es2017",
    "sourceMap": true,
    "outDir": "./dist",
    "baseUrl": "./",
    "incremental": true,
    "paths": {
      "@app/google": ["libs/google/src"],
      "@app/google/*": ["libs/google/src/*"],
      "@app/o-auth": ["libs/o-auth/src"],
      "@app/o-auth/*": ["libs/o-auth/src/*"],
      "@app/analytics": ["libs/analytics/src"],
      "@app/analytics/*": ["libs/analytics/src/*"],
    }
  }
}

Analytics Module tsconfig.lib.json

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "declaration": true,
    "outDir": "../../dist/libs/analytics"
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
}

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source