Skip to content

Commit

Permalink
Add new acceptance test for nodejs tsconfig path aliasing
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbieMcKinstry committed Nov 11, 2022
1 parent 59e583b commit 9fb2da3
Show file tree
Hide file tree
Showing 19 changed files with 436 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/codegen/nodejs/gen.go
Expand Up @@ -2591,9 +2591,9 @@ func genTypeScriptProjectFile(info NodePackageInfo, files codegen.Fs) string {
"experimentalDecorators": true,
"noFallthroughCasesInSwitch": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"paths": {
"@/*": ["*"]
},
},
"strict": true
},
"files": [
Expand Down
6 changes: 6 additions & 0 deletions pkg/codegen/testing/test/sdk_driver.go
Expand Up @@ -164,6 +164,12 @@ var PulumiPulumiSDKTests = []*SDKTest{
Description: "A resource with the same name as its property",
SkipCompileCheck: codegen.NewStringSet(dotnet, nodejs),
},
{
Directory: "type-references-resource",
Description: "An instance where a type references a resource",
Skip: allLanguages.Except("nodejs/any"),
// SkipCompileCheck: codegen.NewStringSet(dotnet, golang, python),
},
{
Directory: "hyphen-url",
Description: "A resource url with a hyphen in its path",
Expand Down
Empty file.
@@ -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"
]
}
@@ -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 });
},
});
@@ -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)
@@ -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 {
}
@@ -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"
}
}
@@ -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 {
}
@@ -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);
@@ -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"
]
}
@@ -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,
};
@@ -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";
@@ -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! ***

@@ -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";

@@ -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";

@@ -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";

0 comments on commit 9fb2da3

Please sign in to comment.