Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 'pluginVersion' and 'pluginName' from nodejs schema options. #13646

Merged
merged 1 commit into from Aug 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -0,0 +1,4 @@
changes:
- type: chore
scope: sdkgen/nodejs
description: Remove the pluginVersion and pluginName options from nodejs schema options.
24 changes: 4 additions & 20 deletions pkg/codegen/nodejs/gen.go
Expand Up @@ -2353,28 +2353,12 @@ func genNPMPackageMetadata(pkg *schema.Package, info NodePackageInfo) string {
devDependencies["@types/node"] = MinimumNodeTypesVersion

version := "${VERSION}"
versionSet := pkg.Version != nil && info.RespectSchemaVersion
if versionSet {
pluginVersion := ""
if pkg.Version != nil && info.RespectSchemaVersion {
version = pkg.Version.String()
}

pluginVersion := info.PluginVersion
if versionSet && pluginVersion == "" {
pluginVersion = version
}

scriptVersion := "${VERSION}"
if pluginVersion != "" {
scriptVersion = pluginVersion
}

pluginName := info.PluginName
// Default to the pulumi package name if PluginName isn't set by the user. This is different to the npm
// package name, e.g. the npm package "@pulumiverse/sentry" has a pulumi package name of just "sentry".
if pluginName == "" {
pluginName = pkg.Name
}

// Create info that will get serialized into an NPM package.json.
npminfo := npmPackage{
Name: packageName,
Expand All @@ -2386,13 +2370,13 @@ func genNPMPackageMetadata(pkg *schema.Package, info NodePackageInfo) string {
License: pkg.License,
Scripts: map[string]string{
"build": "tsc",
"install": fmt.Sprintf("node scripts/install-pulumi-plugin.js resource %s %s", pkg.Name, scriptVersion),
"install": fmt.Sprintf("node scripts/install-pulumi-plugin.js resource %s %s", pkg.Name, version),
},
DevDependencies: devDependencies,
Pulumi: plugin.PulumiPluginJSON{
Resource: true,
Server: pkg.PluginDownloadURL,
Name: pluginName,
Name: pkg.Name,
Version: pluginVersion,
},
}
Expand Down
4 changes: 0 additions & 4 deletions pkg/codegen/nodejs/importer.go
Expand Up @@ -54,10 +54,6 @@ type NodePackageInfo struct {
ContainsEnums bool `json:"containsEnums,omitempty"`
// A map allowing you to map the name of a provider to the name of the module encapsulating the provider.
ProviderNameToModuleName map[string]string `json:"providerNameToModuleName,omitempty"`
// The name of the plugin, which might be different from the package name.
PluginName string `json:"pluginName,omitempty"`
// The version of the plugin, which might be different from the version of the package..
PluginVersion string `json:"pluginVersion,omitempty"`
// Additional files to include in TypeScript compilation.
// These paths are added to the `files` section of the
// generated `tsconfig.json`. A typical use case for this is
Expand Down
Expand Up @@ -62,8 +62,7 @@
"devDependencies": {
"typescript": "^3.7.0",
"@types/node": "ts3.7"
},
"pluginVersion": "3.2.1"
}
},
"go": {
"importBasePath": "enum-reference/example",
Expand Down
Expand Up @@ -3,7 +3,7 @@
"version": "${VERSION}",
"scripts": {
"build": "tsc",
"install": "node scripts/install-pulumi-plugin.js resource example 3.2.1"
"install": "node scripts/install-pulumi-plugin.js resource example ${VERSION}"
},
"dependencies": {
"@pulumi/google-native": "^0.20.0",
Expand All @@ -15,7 +15,6 @@
},
"pulumi": {
"resource": true,
"name": "example",
"version": "3.2.1"
"name": "example"
}
}
Expand Up @@ -31,8 +31,7 @@
"devDependencies": {
"typescript": "^3.7.0",
"@types/node": "ts3.7"
},
"pluginVersion": "3.2.1"
}
},
"go": {
"importBasePath": "enum-reference/example",
Expand Down
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.1",
"scripts": {
"build": "tsc",
"install": "node scripts/install-pulumi-plugin.js resource example 3.2.1"
"install": "node scripts/install-pulumi-plugin.js resource example 0.0.1"
},
"dependencies": {
"@pulumi/google-native": "^0.20.0",
Expand All @@ -16,6 +16,6 @@
"pulumi": {
"resource": true,
"name": "example",
"version": "3.2.1"
"version": "0.0.1"
}
}
Expand Up @@ -49,8 +49,7 @@
"typescript": "^3.7.0",
"@types/node": "ts3.7"
},
"respectSchemaVersion": true,
"pluginVersion": "3.2.1"
"respectSchemaVersion": true
},
"python": {
"requires": {
Expand Down
Expand Up @@ -3,7 +3,7 @@
"version": "1.2.3",
"scripts": {
"build": "tsc",
"install": "node scripts/install-pulumi-plugin.js resource example 3.2.1"
"install": "node scripts/install-pulumi-plugin.js resource example 1.2.3"
},
"dependencies": {
"@pulumi/pulumi": "^3.42.0"
Expand All @@ -18,7 +18,7 @@
"pulumi": {
"resource": true,
"name": "example",
"version": "3.2.1",
"version": "1.2.3",
"server": "example.com/download"
}
}
Expand Up @@ -269,8 +269,7 @@
"extraTypeScriptFiles": [
"tests/codegen.spec.ts"
],
"respectSchemaVersion": true,
"pluginVersion": "3.2.1"
"respectSchemaVersion": true
},
"python": {
"respectSchemaVersion": true
Expand Down