sparse-intern-71089
04/28/2021, 9:32 AMbillowy-army-68599
Pulumi.yaml
options
typescript: false
https://www.pulumi.com/docs/reference/pulumi-yaml/lemon-monkey-228
04/28/2021, 3:25 PMlemon-monkey-228
04/28/2021, 3:25 PMpulumi up ?lemon-monkey-228
04/28/2021, 3:27 PMname: creatio-sync
description: Creatio Sync
runtime: nodejs
options:
typescript: false
is my Pulumi.yamllemon-monkey-228
04/28/2021, 3:28 PMnpx tsc index.ts it compiles the index.jslemon-monkey-228
04/28/2021, 3:28 PMpulumi up still seems to be trying to use itlemon-monkey-228
04/28/2021, 3:29 PMpackage.json or something too?lemon-monkey-228
04/28/2021, 3:31 PMruntime:
name: nodejs
options:
typescript: false
but still no dicebillowy-army-68599
pulumi up seems to be trying to use it, do you mean your index.ts ?elegant-pager-5412
04/28/2021, 3:41 PMtsconfig.json specifies that the output dir should be dist which is ignored in .gitignore. Then I needed to tell Pulumi to use the JS file, which we can do so by adding the main property to the package.json.
The thing is that unless we use amd as the module definition in tsconfig, TSC cannot combine all files into a single index.js file.
To solve this, I did some bash magic and created the following command:
"scripts": {
"deploy": "tsc && sed -i '' \"s#\\\"main\\\": \\\".*,#\\\"main\\\": \\\"$(find dist -name 'index.js' -print -maxdepth 3 -quit)\\\",#\" package.json && pulumi up"
},lemon-monkey-228
04/28/2021, 3:41 PMelegant-pager-5412
04/28/2021, 3:41 PMelegant-pager-5412
04/28/2021, 3:41 PM{
"compilerOptions": {
"strict": true,
"outDir": "dist",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"strictNullChecks": true,
"noImplicitAny": true,
"noImplicitThis": true,
"alwaysStrict": true,
"strictPropertyInitialization": false,
"forceConsistentCasingInFileNames": true,
"removeComments": true
}
}lemon-monkey-228
04/28/2021, 3:46 PMDiagnostics:
pulumi:pulumi:Stack (creatio-sync-production):
error: Running program '/Users/james/projects/creatio/creatio-sync/deploy' failed with an unhandled exception:
/Users/james/projects/creatio/creatio-sync/deploy/node_modules/@devops/pulumi-utils/index.ts:1
import * as fs from 'fs'
^^^^^^
SyntaxError: Cannot use import statement outside a modulelemon-monkey-228
04/28/2021, 3:47 PMnpx tsc if the settings were till wrong (feel free to correct me if I’m wrong)elegant-pager-5412
04/28/2021, 3:51 PMlemon-monkey-228
04/28/2021, 4:38 PM{
"compilerOptions": {
"strict": true,
"outDir": "bin",
"target": "es2020",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"resolveJsonModule": true,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"forceConsistentCasingInFileNames": true
}
}lemon-monkey-228
04/28/2021, 4:38 PM{
"name": "creatio-sync",
"main": "bin/index.js",
"devDependencies": {
"@types/node": "^10.0.0"
},
"dependencies": {
"@devops/pulumi-utils": "^0.1.2",
"@pulumi/kubernetes": "^2.0.0",
"@pulumi/kubernetesx": "^0.1.1",
"@pulumi/pulumi": "^2.0.0"
}
}lemon-monkey-228
04/28/2021, 4:39 PMlemon-monkey-228
04/28/2021, 4:41 PMtsc call to the library toolemon-monkey-228
04/29/2021, 4:17 PM