Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new acceptance test for nodejs tsconfig path aliasing
- Loading branch information
1 parent
59e583b
commit 9fb2da3
Showing
19 changed files
with
436 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
19 changes: 19 additions & 0 deletions
19
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/codegen-manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"emittedFiles": [ | ||
"README.md", | ||
"index.ts", | ||
"my_mod/index.ts", | ||
"my_mod/triceratops.ts", | ||
"package.json", | ||
"provider.ts", | ||
"scripts/install-pulumi-plugin.js", | ||
"tsconfig.json", | ||
"types/index.ts", | ||
"types/input.ts", | ||
"types/my_mod/index.ts", | ||
"types/my_mod/input.ts", | ||
"types/my_mod/output.ts", | ||
"types/output.ts", | ||
"utilities.ts" | ||
] | ||
} |
30 changes: 30 additions & 0 deletions
30
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as utilities from "./utilities"; | ||
|
||
// Export members: | ||
export { ProviderArgs } from "./provider"; | ||
export type Provider = import("./provider").Provider; | ||
export const Provider: typeof import("./provider").Provider = null as any; | ||
utilities.lazyLoad(exports, ["Provider"], () => require("./provider")); | ||
|
||
|
||
// Export sub-modules: | ||
import * as my_mod from "./my_mod"; | ||
import * as types from "./types"; | ||
|
||
export { | ||
my_mod, | ||
types, | ||
}; | ||
pulumi.runtime.registerResourcePackage("dinosaurs", { | ||
version: utilities.getVersion(), | ||
constructProvider: (name: string, type: string, urn: string): pulumi.ProviderResource => { | ||
if (type !== "pulumi:providers:dinosaurs") { | ||
throw new Error(`unknown provider type ${type}`); | ||
} | ||
return new Provider(name, <any>undefined, { urn }); | ||
}, | ||
}); |
25 changes: 25 additions & 0 deletions
25
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as utilities from "../utilities"; | ||
|
||
// Export members: | ||
export { TriceratopsArgs } from "./triceratops"; | ||
export type Triceratops = import("./triceratops").Triceratops; | ||
export const Triceratops: typeof import("./triceratops").Triceratops = null as any; | ||
utilities.lazyLoad(exports, ["Triceratops"], () => require("./triceratops")); | ||
|
||
|
||
const _module = { | ||
version: utilities.getVersion(), | ||
construct: (name: string, type: string, urn: string): pulumi.Resource => { | ||
switch (type) { | ||
case "dinosaurs:my_mod:Triceratops": | ||
return new Triceratops(name, <any>undefined, { urn }) | ||
default: | ||
throw new Error(`unknown resource type ${type}`); | ||
} | ||
}, | ||
}; | ||
pulumi.runtime.registerResourceModule("dinosaurs", "my_mod", _module) |
63 changes: 63 additions & 0 deletions
63
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/my_mod/triceratops.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as utilities from "../utilities"; | ||
|
||
/** | ||
* My favorite dino | ||
*/ | ||
export class Triceratops extends pulumi.CustomResource { | ||
/** | ||
* Get an existing Triceratops resource's state with the given name, ID, and optional extra | ||
* properties used to qualify the lookup. | ||
* | ||
* @param name The _unique_ name of the resulting resource. | ||
* @param id The _unique_ provider ID of the resource to lookup. | ||
* @param opts Optional settings to control the behavior of the CustomResource. | ||
*/ | ||
public static get(name: string, id: pulumi.Input<pulumi.ID>, opts?: pulumi.CustomResourceOptions): Triceratops { | ||
return new Triceratops(name, undefined as any, { ...opts, id: id }); | ||
} | ||
|
||
/** @internal */ | ||
public static readonly __pulumiType = 'dinosaurs:my_mod:Triceratops'; | ||
|
||
/** | ||
* Returns true if the given object is an instance of Triceratops. This is designed to work even | ||
* when multiple copies of the Pulumi SDK have been loaded into the same process. | ||
*/ | ||
public static isInstance(obj: any): obj is Triceratops { | ||
if (obj === undefined || obj === null) { | ||
return false; | ||
} | ||
return obj['__pulumiType'] === Triceratops.__pulumiType; | ||
} | ||
|
||
public /*out*/ readonly size!: pulumi.Output<number | undefined>; | ||
|
||
/** | ||
* Create a Triceratops resource with the given unique name, arguments, and options. | ||
* | ||
* @param name The _unique_ name of the resource. | ||
* @param args The arguments to use to populate this resource's properties. | ||
* @param opts A bag of options that control this resource's behavior. | ||
*/ | ||
constructor(name: string, args?: TriceratopsArgs, opts?: pulumi.CustomResourceOptions) { | ||
let resourceInputs: pulumi.Inputs = {}; | ||
opts = opts || {}; | ||
if (!opts.id) { | ||
resourceInputs["size"] = undefined /*out*/; | ||
} else { | ||
resourceInputs["size"] = undefined /*out*/; | ||
} | ||
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); | ||
super(Triceratops.__pulumiType, name, resourceInputs, opts); | ||
} | ||
} | ||
|
||
/** | ||
* The set of arguments for constructing a Triceratops resource. | ||
*/ | ||
export interface TriceratopsArgs { | ||
} |
18 changes: 18 additions & 0 deletions
18
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "@pulumi/dinosaurs", | ||
"version": "${VERSION}", | ||
"scripts": { | ||
"build": "tsc", | ||
"install": "node scripts/install-pulumi-plugin.js resource dinosaurs ${VERSION}" | ||
}, | ||
"dependencies": { | ||
"@pulumi/pulumi": "^3.12" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^3.7.0" | ||
}, | ||
"pulumi": { | ||
"resource": true, | ||
"name": "dinosaurs" | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/provider.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as utilities from "./utilities"; | ||
|
||
export class Provider extends pulumi.ProviderResource { | ||
/** @internal */ | ||
public static readonly __pulumiType = 'dinosaurs'; | ||
|
||
/** | ||
* Returns true if the given object is an instance of Provider. This is designed to work even | ||
* when multiple copies of the Pulumi SDK have been loaded into the same process. | ||
*/ | ||
public static isInstance(obj: any): obj is Provider { | ||
if (obj === undefined || obj === null) { | ||
return false; | ||
} | ||
return obj['__pulumiType'] === Provider.__pulumiType; | ||
} | ||
|
||
|
||
/** | ||
* Create a Provider resource with the given unique name, arguments, and options. | ||
* | ||
* @param name The _unique_ name of the resource. | ||
* @param args The arguments to use to populate this resource's properties. | ||
* @param opts A bag of options that control this resource's behavior. | ||
*/ | ||
constructor(name: string, args?: ProviderArgs, opts?: pulumi.ResourceOptions) { | ||
let resourceInputs: pulumi.Inputs = {}; | ||
opts = opts || {}; | ||
{ | ||
} | ||
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); | ||
super(Provider.__pulumiType, name, resourceInputs, opts); | ||
} | ||
} | ||
|
||
/** | ||
* The set of arguments for constructing a Provider resource. | ||
*/ | ||
export interface ProviderArgs { | ||
} |
26 changes: 26 additions & 0 deletions
26
...en/testing/test/testdata/type-references-resource/nodejs/scripts/install-pulumi-plugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use strict"; | ||
var childProcess = require("child_process"); | ||
|
||
var args = process.argv.slice(2); | ||
|
||
if (args.indexOf("${VERSION}") !== -1) { | ||
process.exit(0); | ||
} | ||
|
||
var res = childProcess.spawnSync("pulumi", ["plugin", "install"].concat(args), { | ||
stdio: ["ignore", "inherit", "inherit"] | ||
}); | ||
|
||
if (res.error && res.error.code === "ENOENT") { | ||
console.error("\nThere was an error installing the resource provider plugin. " + | ||
"It looks like `pulumi` is not installed on your system. " + | ||
"Please visit https://pulumi.com/ to install the Pulumi CLI.\n" + | ||
"You may try manually installing the plugin by running " + | ||
"`pulumi plugin install " + args.join(" ") + "`"); | ||
} else if (res.error || res.status !== 0) { | ||
console.error("\nThere was an error installing the resource provider plugin. " + | ||
"You may try to manually installing the plugin by running " + | ||
"`pulumi plugin install " + args.join(" ") + "`"); | ||
} | ||
|
||
process.exit(0); |
32 changes: 32 additions & 0 deletions
32
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/tsconfig.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"outDir": "bin", | ||
"target": "es2016", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"declaration": true, | ||
"sourceMap": true, | ||
"stripInternal": true, | ||
"experimentalDecorators": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"paths": { | ||
"@/*": ["*"] | ||
}, | ||
"strict": true | ||
}, | ||
"files": [ | ||
"index.ts", | ||
"my_mod/index.ts", | ||
"my_mod/triceratops.ts", | ||
"provider.ts", | ||
"types/index.ts", | ||
"types/input.ts", | ||
"types/my_mod/index.ts", | ||
"types/my_mod/input.ts", | ||
"types/my_mod/output.ts", | ||
"types/output.ts", | ||
"utilities.ts" | ||
] | ||
} |
13 changes: 13 additions & 0 deletions
13
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as utilities from "../utilities"; | ||
|
||
// Export sub-modules: | ||
import * as input from "./input"; | ||
import * as output from "./output"; | ||
|
||
export { | ||
input, | ||
output, | ||
}; |
11 changes: 11 additions & 0 deletions
11
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as inputs from "../types/input"; | ||
import * as outputs from "../types/output"; | ||
import * as utilities from "../utilities"; | ||
|
||
import {Triceratops} from "@/my_mod"; | ||
|
||
export * as my_mod from "./my_mod/input"; |
3 changes: 3 additions & 0 deletions
3
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
10 changes: 10 additions & 0 deletions
10
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/input.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as inputs from "../../types/input"; | ||
import * as outputs from "../../types/output"; | ||
import * as utilities from "../../utilities"; | ||
|
||
import {Triceratops} from "@/my_mod"; | ||
|
10 changes: 10 additions & 0 deletions
10
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/my_mod/output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as inputs from "../../types/input"; | ||
import * as outputs from "../../types/output"; | ||
import * as utilities from "../../utilities"; | ||
|
||
import {Triceratops} from "@/my_mod"; | ||
|
11 changes: 11 additions & 0 deletions
11
pkg/codegen/testing/test/testdata/type-references-resource/nodejs/types/output.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// *** WARNING: this file was generated by test. *** | ||
// *** Do not edit by hand unless you're certain you know what you are doing! *** | ||
|
||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as inputs from "../types/input"; | ||
import * as outputs from "../types/output"; | ||
import * as utilities from "../utilities"; | ||
|
||
import {Triceratops} from "@/my_mod"; | ||
|
||
export * as my_mod from "./my_mod/output"; |
Oops, something went wrong.