diff --git a/packages/pulumi/src/generators/init/files/index.ts.template b/packages/pulumi/src/generators/init/files/index.ts.template index 5d0da025..f06f00c6 100644 --- a/packages/pulumi/src/generators/init/files/index.ts.template +++ b/packages/pulumi/src/generators/init/files/index.ts.template @@ -1,17 +1,5 @@ /* eslint-disable */ -import { loadConfig, register } from 'tsconfig-paths' - -const config = loadConfig('.') -if (config.resultType === 'failed') { - console.log('Could not load tsconfig to map paths, aborting.') - process.exit(1) -} - -register({ - baseUrl: config.absoluteBaseUrl, - paths: config.paths -}) - +import '@nx-extend/pulumi' import './pulumi' export * from './pulumi' diff --git a/packages/pulumi/src/generators/init/files/tsconfig.json.template b/packages/pulumi/src/generators/init/files/tsconfig.json.template deleted file mode 100644 index ecad9d75..00000000 --- a/packages/pulumi/src/generators/init/files/tsconfig.json.template +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "<%= offsetFromRoot %>tsconfig.base.json" -} diff --git a/packages/pulumi/src/generators/init/init.impl.ts b/packages/pulumi/src/generators/init/init.impl.ts index 1273fe6f..fbd0d785 100644 --- a/packages/pulumi/src/generators/init/init.impl.ts +++ b/packages/pulumi/src/generators/init/init.impl.ts @@ -1,10 +1,3 @@ -import { - buildCommand, - DefaultGeneratorOptions, - execCommand, - NormalizedSchema, - normalizeOptions -} from '@nx-extend/core' import { addDependenciesToPackageJson, addProjectConfiguration, @@ -16,6 +9,13 @@ import { runTasksInSerial, Tree } from '@nx/devkit' +import { + buildCommand, + DefaultGeneratorOptions, + execCommand, + NormalizedSchema, + normalizeOptions +} from '@nx-extend/core' import { readFileSync, unlinkSync } from 'fs' import { join } from 'path' import { which } from 'shelljs' diff --git a/packages/pulumi/src/index.ts b/packages/pulumi/src/index.ts index e69de29b..20f9f92c 100644 --- a/packages/pulumi/src/index.ts +++ b/packages/pulumi/src/index.ts @@ -0,0 +1,5 @@ +import { workspaceRoot } from '@nx/devkit' + +import { setupTypescript } from './init' + +setupTypescript(workspaceRoot) diff --git a/packages/pulumi/src/init.ts b/packages/pulumi/src/init.ts new file mode 100644 index 00000000..124bcf30 --- /dev/null +++ b/packages/pulumi/src/init.ts @@ -0,0 +1,14 @@ +import { loadConfig, register } from 'tsconfig-paths' + +export function setupTypescript(directory: string): void { + const config = loadConfig(directory) + if (config.resultType === 'failed') { + console.log('Could not load tsconfig to map paths, aborting.') + process.exit(1) + } + + register({ + baseUrl: config.absoluteBaseUrl, + paths: config.paths + }) +}