sparse-intern-71089
03/05/2019, 11:46 PMimportant-leather-28796
03/05/2019, 11:48 PMsrc elsewhere, I have quickly found out that the pulumi cli does not respect the tsconfig.important-leather-28796
03/05/2019, 11:49 PMgorgeous-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.important-leather-28796
03/06/2019, 12:09 AMmicroscopic-pilot-97530
microscopic-pilot-97530
compilerOptions specified in tsconfig.json….microscopic-pilot-97530
tsc to generate JavaScript, and just have Pulumi run the generated JavaScript file.important-leather-28796
03/06/2019, 12:12 AMimportant-leather-28796
03/06/2019, 12:13 AMinclude to use a src directory instead of at the rootimportant-leather-28796
03/06/2019, 12:16 AMbitter-oil-46081
03/06/2019, 12:17 AMimportant-leather-28796
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.important-leather-28796
03/07/2019, 6:20 PM"@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"],
}
},important-leather-28796
03/07/2019, 6:23 PMimportant-leather-28796
03/07/2019, 6:24 PMcloud/pulumi/src such as test.ts with export const test = () => 'foo'important-leather-28796
03/07/2019, 6:24 PMtestIt.ts in the stack dir and just attempt to run it with ts-node ./testIt.tsimportant-leather-28796
03/07/2019, 6:25 PMimportant-leather-28796
03/07/2019, 6:25 PMlink: while npm uses file: - the package manager semantics matter hereimportant-leather-28796
03/07/2019, 6:27 PMtsconfig-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.jsonimportant-leather-28796
03/07/2019, 6:30 PM{
"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",
}
}important-leather-28796
03/07/2019, 6:32 PM@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 importsmillions-judge-24978
03/07/2019, 6:34 PMbuild in package.json in my case.important-leather-28796
03/07/2019, 6:34 PMimportant-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 PMmillions-judge-24978
03/07/2019, 6:35 PMimportant-leather-28796
03/07/2019, 6:36 PMpathsimportant-leather-28796
03/07/2019, 6:36 PM-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-pathsmillions-judge-24978
03/07/2019, 6:37 PMmillions-judge-24978
03/07/2019, 6:37 PMmillions-judge-24978
03/07/2019, 6:44 PMtsconfig-paths to work with no modification to pulumiimportant-leather-28796
03/07/2019, 6:59 PMimportant-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();
})();