c7ed4024ff
An exploration into how we could support int64 as well as float64 as a first class type in Pulumi. There's some inherit trickiness with this because we use JSON in a few places, state files most obviously but `PropertyValue` on the wire is using the protobuf `Struct` and `Value` types which are just mappings to JSON as well. JSON doesn't have an int64 type, and while the Go JSON marshaller can read/write int64s it's not a great behaviour to rely on given mixed support for that across languages. Further the protobuf `Value` type only supports float64s. So we support integers similar to our other special types (like assets) and wrap them in an object with a special signature field. The value itself is either a number (if it can safely roundtrip to float64 and back again) or a string. Providers, SDKs and the engine communicate support for integers via `AcceptsIntegers` fields in their interfaces (or similar). When transmitting to a peer that doesn't support integers (e.g. an old SDK, or old provider) all integer values are mapped back to standard number values. As this changes the serialisation of property values in the state file it will trigger errors if old engines try to load a state file containing integers. |
||
---|---|---|
.. | ||
asset | ||
automation | ||
cmd | ||
dist | ||
dynamic | ||
iterable | ||
log | ||
npm | ||
proto | ||
provider | ||
queryable | ||
runtime | ||
tests | ||
tests_with_mocks | ||
types | ||
vendor | ||
.eslintrc.js | ||
.gitignore | ||
Makefile | ||
README.md | ||
biome.json | ||
config.ts | ||
errors.ts | ||
index.ts | ||
invoke.ts | ||
metadata.ts | ||
output.ts | ||
package.json | ||
resource.ts | ||
stackReference.ts | ||
tsconfig.json | ||
tsutils.ts | ||
typescript-shim.ts | ||
utils.ts | ||
version.ts | ||
yarn.lock |
README.md
Pulumi Node.js SDK
The Pulumi Node.js SDK lets you write cloud programs in JavaScript.
Installation
Using npm:
$ npm install --save @pulumi/pulumi
Using yarn:
$ yarn add @pulumi/pulumi
This SDK is meant for use with the Pulumi CLI. Visit Pulumi's Download & Install to install the CLI.
Building and Testing
For anybody who wants to build from source, here is how you do it.
Prerequisites
This SDK uses Node.js and we support any of the Current, Active and Maintenance LTS versions. We support both NPM and Yarn for package management.
At the moment, we only support building on macOS and Linux, where standard GNU tools like make
are available.
Make Targets
To build the SDK, simply run make
from the root directory (where this README
lives, at sdk/nodejs/
from the repo's
root). This will build the code, run tests, and install the package and its supporting artifacts.
At the moment, for local development, we install everything into $HOME/.dev-pulumi
. You will want this on your $PATH
.
The tests will verify that everything works, but feel free to try running pulumi preview
and/or pulumi up
from
the examples/minimal/
directory. Remember to run tsc
first, since pulumi
expects JavaScript, not TypeScript.