important-leather-28796
03/05/2019, 11:46 PMpulumi
cli does not respect the configurations I place in the tsconfig.json - which really impacts code reuse. Who can chat with me about the internals of the cli?src
elsewhere, I have quickly found out that the pulumi
cli does not respect the tsconfig.gorgeous-egg-16927
03/05/2019, 11:49 PMimportant-leather-28796
03/05/2019, 11:51 PMpaths
in the tsconfig compilerOptions
but any execution of pulumi up
fails. If I know a bit more about how this works I can probably work it outmicroscopic-pilot-97530
important-leather-28796
03/06/2019, 12:06 AMpaths
, but no joy here.microscopic-pilot-97530
compilerOptions
specified in tsconfig.json….tsc
to generate JavaScript, and just have Pulumi run the generated JavaScript file.important-leather-28796
03/06/2019, 12:12 AMinclude
to use a src
directory instead of at the rootbitter-oil-46081
03/06/2019, 12:17 AMimportant-leather-28796
03/06/2019, 12:17 AMbitter-oil-46081
03/06/2019, 12:18 AMimportant-leather-28796
03/06/2019, 12:22 AMbitter-oil-46081
03/06/2019, 12:26 AMimportant-leather-28796
03/06/2019, 2:23 AMmillions-judge-24978
03/07/2019, 6:18 PMimportant-leather-28796
03/07/2019, 6:20 PMcloud
dir. I have shared code in a pulumi
folder with a package.json name of @acme/pulumi
."@acme/pulumi": "link:../pulumi",
millions-judge-24978
03/07/2019, 6:21 PMimportant-leather-28796
03/07/2019, 6:23 PM"compilerOptions": {
"baseUrl": ".",
"paths": {
"@acme/pulumi": ["./cloud/pulumi/src"],
}
},
cloud/pulumi/src
such as test.ts
with export const test = () => 'foo'
testIt.ts
in the stack dir and just attempt to run it with ts-node ./testIt.ts
link:
while npm uses file:
- the package manager semantics matter heretsconfig-paths
you probably want to get tested/setup to run without itmillions-judge-24978
03/07/2019, 6:28 PMpaths
from tsconfig.json
is not getting picked up for me at all.
I'm just trying to add a simple alias to get rid of relative imports, no workspaces or anything
"compilerOptions": {
"baseUrl": "./src",
"paths": {
"Modules/*": ["modules/*"]
}
},
important-leather-28796
03/07/2019, 6:29 PMmain
is set in the package.json{
"name": "@acme/pulumi",
"main": "lib/cjs/index.js",
"typings": "src/index.ts",
"license": "UNLICENSED",
"scripts": {
"build": "../../node_modules/.bin/tsc"
},
"dependencies": {
"@pulumi/gcp": "^0.17.0",
"@pulumi/kubernetes": "^0.21.0",
"@pulumi/pulumi": "^0.17.1",
"@pulumi/random": "^0.5.0",
}
}
@acme/pulumi
tsconfig.json
is effectively:
{
"compilerOptions": {
"module": "commonjs",
"target": "es2015",
"jsx": "react",
"lib": ["es2017", "esnext.asynciterable", "dom"],
"allowSyntheticDefaultImports": true,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": false,
"moduleResolution": "node",
"noImplicitAny": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"noEmitOnError": true,
"noUnusedLocals": false,
"strict": true,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true
"outDir": "lib/cjs",
"rootDir": "src"
},
"include": ["../../../js/typings/**/*", "../../typings/**/*", "./src/**/*"],
"exclude": ["node_modules", "./lib"]
}
millions-judge-24978
03/07/2019, 6:33 PMtsconfig.json
in the root of normal pulumi typescript bootstrap, and hoping to be able to set paths
to simplify some importsbuild
in package.json
in my case.important-leather-28796
03/07/2019, 6:34 PMpulumi *
commandsmillions-judge-24978
03/07/2019, 6:35 PMpulumi
cli?important-leather-28796
03/07/2019, 6:35 PMbuild
shared code, not a stackmillions-judge-24978
03/07/2019, 6:35 PMimportant-leather-28796
03/07/2019, 6:36 PMpaths
-r tsconfig-paths
to use paths
with ts-node, so you will need to figure out how to make pulumi’s use of ts-node via api register tsconfig-paths
millions-judge-24978
03/07/2019, 6:37 PMtsconfig-paths
to work with no modification to pulumiimportant-leather-28796
03/07/2019, 6:59 PMmillions-judge-24978
03/07/2019, 7:50 PM// This file is a hack so we can keep pulumi happy
import * as tsConfigPaths from 'tsconfig-paths';
const baseUrl = './src';
const cleanup = tsConfigPaths.register({
baseUrl,
paths: {
'Modules/*': ['modules/*']
},
});
import main from './src'; // eslint-disable-line
(async () => {
await main();
// When path registration is no longer needed
cleanup();
})();