Reputation: 20152
I can't get this to copy my migrations folder to dist.
I have a folder in src/graphql/DB
called pgMem
which has a migrations folder in it with .sql
files.
Also even though I have package.json
there in includes
it's not copying that either.
src/graphql/
tsconfig.json
{
"compilerOptions": {
"noEmit": false,
"rootDir": ".",
"outDir": "../../dist/graphql",
"esModuleInterop": true,
"lib": ["esnext"],
"skipLibCheck": true
},
"include": [
"./*.ts",
"package.json",
"/DB/pgMem/migrations/*.sql"
],
"exclude": [
"dist",
"/node_modules",
"/src/test/**/*"
],
"resolveJsonModule": true
}
When I go to dist, everything is there but my migrations folder. Am I not going about this right?
Upvotes: 4
Views: 8408
Reputation: 595
This issue is described here: github.com/microsoft/TypeScript/issues/30835 - The typescript - compiler ignores other files than json / TS and JS - Files. You can for example use an external copy - script to solve that issue.
Alternative solution:
An alternative is to create an additional folder in the same folder that contains your dist - folder. Let's call this folder assets. The assets - folder will be commited to the git - repository.
In the folder "assets" you can put all the static files that will be used after the deployment.
The deployment - process will then get the dist and the assets - folder (together with the other relevant files like node_modules).
When you read the files in your code it's just important that the correct path is used (../../assets/migrations/mySqlFile.sql).
Upvotes: 1