pulumi/sdk/nodejs/dist/pulumi-resource-pulumi-nodejs.cmd
Matt Ellis d7575072f2 Do not use relative path when launching dynamic provider
Previously, we assumed that the dynamic provider was located in
`./node_modules/@pulumi/pulumi/../` which is correct in the majority
of cases. However, tools like lerna or yarn workspaces (or custom
workflows) allow the node_modules folder to be located elsewhere on
disk, and node will still find it because of its algorithm for module
resolution.

So, do what we do in the language host itself, first launch node and
ask it to tell us where it resolves a require statement to on disk and
then launch node against that script.

Fixes #2261
2018-12-05 13:45:06 -08:00

7 lines
275 B
Batchfile

@echo off
setlocal
for /f "delims=" %%i in ('node -e "console.log(require.resolve('@pulumi/pulumi/cmd/dynamic-provider'))"') do set PULUMI_DYNAMIC_PROVIDER_SCRIPT_PATH=%%i
if DEFINED PULUMI_DYNAMIC_PROVIDER_SCRIPT_PATH (
@node "%PULUMI_DYNAMIC_PROVIDER_SCRIPT_PATH%" %*
)