@webiny/pulumi-sdk 5.35.0-beta.1 → 5.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Pulumi.js +8 -40
- package/Pulumi.js.map +1 -1
- package/downloadBinaries.js +2 -23
- package/downloadBinaries.js.map +1 -1
- package/index.js +0 -2
- package/index.js.map +1 -1
- package/package.json +4 -4
package/Pulumi.js
CHANGED
|
@@ -1,37 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
-
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.Pulumi = exports.FLAG_NON_INTERACTIVE = void 0;
|
|
11
|
-
|
|
12
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
var _set2 = _interopRequireDefault(require("lodash/set"));
|
|
17
|
-
|
|
18
12
|
var _kebabCase2 = _interopRequireDefault(require("lodash/kebabCase"));
|
|
19
|
-
|
|
20
13
|
var _merge2 = _interopRequireDefault(require("lodash/merge"));
|
|
21
|
-
|
|
22
14
|
var _os = _interopRequireDefault(require("os"));
|
|
23
|
-
|
|
24
15
|
var _execa = _interopRequireDefault(require("execa"));
|
|
25
|
-
|
|
26
16
|
var path = _interopRequireWildcard(require("path"));
|
|
27
|
-
|
|
28
17
|
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
29
|
-
|
|
30
18
|
var _downloadBinaries = _interopRequireDefault(require("./downloadBinaries"));
|
|
31
|
-
|
|
32
19
|
const FLAG_NON_INTERACTIVE = "--non-interactive";
|
|
33
20
|
exports.FLAG_NON_INTERACTIVE = FLAG_NON_INTERACTIVE;
|
|
34
|
-
|
|
35
21
|
class Pulumi {
|
|
36
22
|
constructor(options = {}) {
|
|
37
23
|
(0, _defineProperty2.default)(this, "options", void 0);
|
|
@@ -43,58 +29,48 @@ class Pulumi {
|
|
|
43
29
|
this.pulumiFolder = path.join(this.pulumiDownloadFolder, "pulumi");
|
|
44
30
|
this.pulumiBinaryPath = path.join(this.pulumiFolder, "pulumi");
|
|
45
31
|
}
|
|
46
|
-
|
|
47
32
|
run(rawArgs) {
|
|
48
33
|
this.ensureAwsPluginIsInstalled();
|
|
49
34
|
const args = (0, _merge2.default)({}, this.options, rawArgs);
|
|
50
|
-
|
|
51
35
|
if (!Array.isArray(args.command)) {
|
|
52
36
|
args.command = [args.command];
|
|
53
|
-
}
|
|
54
|
-
|
|
37
|
+
}
|
|
55
38
|
|
|
39
|
+
// 1. Prepare Pulumi args.
|
|
56
40
|
const finalArgs = [];
|
|
57
|
-
|
|
58
41
|
for (const key in args.args) {
|
|
59
42
|
const value = args.args[key];
|
|
60
|
-
|
|
61
43
|
if (!value) {
|
|
62
44
|
continue;
|
|
63
45
|
}
|
|
64
|
-
|
|
65
46
|
if (Array.isArray(value)) {
|
|
66
47
|
for (let i = 0; i < value.length; i++) {
|
|
67
48
|
finalArgs.push(`--${(0, _kebabCase2.default)(key)}`, value[i]);
|
|
68
49
|
}
|
|
69
|
-
|
|
70
50
|
continue;
|
|
71
51
|
}
|
|
72
|
-
|
|
73
52
|
if (typeof value === "boolean") {
|
|
74
53
|
finalArgs.push(`--${(0, _kebabCase2.default)(key)}`);
|
|
75
54
|
continue;
|
|
76
55
|
}
|
|
77
|
-
|
|
78
56
|
finalArgs.push(`--${(0, _kebabCase2.default)(key)}`, value);
|
|
79
|
-
}
|
|
80
|
-
|
|
57
|
+
}
|
|
81
58
|
|
|
59
|
+
// Prepare execa args.
|
|
82
60
|
if (!args.execa) {
|
|
83
61
|
args.execa = {};
|
|
84
62
|
}
|
|
85
|
-
|
|
86
63
|
(0, _set2.default)(args.execa, "env.PULUMI_SKIP_UPDATE_CHECK", "true");
|
|
87
64
|
(0, _set2.default)(args.execa, "env.PULUMI_HOME", this.pulumiFolder);
|
|
88
|
-
|
|
89
65
|
if (_os.default.arch() === "arm64") {
|
|
90
66
|
/**
|
|
91
67
|
* This variable is an attempt to resolve this issue:
|
|
92
68
|
* https://yaleman.org/post/2021/2021-01-01-apple-m1-terraform-and-golang/
|
|
93
69
|
*/
|
|
94
70
|
(0, _set2.default)(args.execa, "env.GODEBUG", "asyncpreemptoff=1");
|
|
95
|
-
}
|
|
96
|
-
|
|
71
|
+
}
|
|
97
72
|
|
|
73
|
+
// Use ";" when on Windows. For Mac and Linux, use ":".
|
|
98
74
|
const PATH_SEPARATOR = _os.default.platform() === "win32" ? ";" : ":";
|
|
99
75
|
const execaArgs = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, args.execa), {}, {
|
|
100
76
|
env: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, args.execa.env || {}), {}, {
|
|
@@ -106,34 +82,28 @@ class Pulumi {
|
|
|
106
82
|
*/
|
|
107
83
|
PATH: process.env.PATH + PATH_SEPARATOR + this.pulumiFolder
|
|
108
84
|
})
|
|
109
|
-
});
|
|
85
|
+
});
|
|
110
86
|
|
|
87
|
+
// We want to keep the "interactive" output format of the Pulumi command when `--preview` flag is passed in.
|
|
111
88
|
const flags = args.command && args.command.includes("preview") ? [] : [FLAG_NON_INTERACTIVE];
|
|
112
89
|
return (0, _execa.default)(this.pulumiBinaryPath, [...args.command, ...finalArgs, ...flags], execaArgs);
|
|
113
90
|
}
|
|
114
|
-
|
|
115
91
|
async install(rawArgs) {
|
|
116
92
|
const args = (0, _merge2.default)({}, this.options, rawArgs);
|
|
117
93
|
const installed = await (0, _downloadBinaries.default)(this.pulumiDownloadFolder, args.beforePulumiInstall, args.afterPulumiInstall);
|
|
118
|
-
|
|
119
94
|
if (installed) {
|
|
120
95
|
this.ensureAwsPluginIsInstalled();
|
|
121
96
|
}
|
|
122
|
-
|
|
123
97
|
return installed;
|
|
124
98
|
}
|
|
125
|
-
|
|
126
99
|
ensureAwsPluginIsInstalled() {
|
|
127
100
|
const {
|
|
128
101
|
version
|
|
129
102
|
} = require("@pulumi/aws/package.json");
|
|
130
|
-
|
|
131
103
|
const pluginExists = _fsExtra.default.pathExistsSync(path.join(this.pulumiFolder, "plugins", `resource-aws-${version}`, "pulumi-resource-aws"));
|
|
132
|
-
|
|
133
104
|
if (pluginExists) {
|
|
134
105
|
return;
|
|
135
106
|
}
|
|
136
|
-
|
|
137
107
|
return _execa.default.sync(this.pulumiBinaryPath, ["plugin", "install", "resource", "aws", version], {
|
|
138
108
|
stdio: "inherit",
|
|
139
109
|
env: {
|
|
@@ -142,7 +112,5 @@ class Pulumi {
|
|
|
142
112
|
}
|
|
143
113
|
});
|
|
144
114
|
}
|
|
145
|
-
|
|
146
115
|
}
|
|
147
|
-
|
|
148
116
|
exports.Pulumi = Pulumi;
|
package/Pulumi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["FLAG_NON_INTERACTIVE","Pulumi","constructor","options","pulumiDownloadFolder","path","join","pulumiFolder","process","cwd","os","platform","pulumiBinaryPath","run","rawArgs","ensureAwsPluginIsInstalled","args","Array","isArray","command","finalArgs","key","value","i","length","push","execa","arch","PATH_SEPARATOR","execaArgs","env","PATH","flags","includes","install","installed","downloadBinaries","beforePulumiInstall","afterPulumiInstall","version","require","pluginExists","fs","pathExistsSync","sync","stdio","PULUMI_HOME","PULUMI_SKIP_UPDATE_CHECK"],"sources":["Pulumi.ts"],"sourcesContent":["import os from \"os\";\nimport execa from \"execa\";\nimport * as path from \"path\";\nimport fs from \"fs-extra\";\nimport { merge, kebabCase, set } from \"lodash\";\nimport downloadBinaries from \"./downloadBinaries\";\n\ntype Command = string | string[];\n\nexport interface PulumiArgs {\n [key: string]: string | boolean;\n}\n\nexport interface ExecaArgs {\n env?: {\n [key: string]: string | undefined;\n };\n [key: string]: any;\n}\n\nexport interface Options {\n args?: PulumiArgs;\n execa?: ExecaArgs;\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n\n // A folder into which the Pulumi CLI, along with all of its meta data and config files, will be set up.\n // It's recommended this folder is not checked in into a code repository, since the Pulumi CLI can store\n // sensitive information here, for example - user's Pulumi Service credentials.\n pulumiFolder?: string;\n}\n\nexport interface RunArgs {\n command: Command;\n\n args?: PulumiArgs;\n execa?: ExecaArgs;\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n}\n\nexport interface InstallArgs {\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n}\n\nexport const FLAG_NON_INTERACTIVE = \"--non-interactive\";\n\nexport class Pulumi {\n options: Options;\n pulumiFolder: string;\n pulumiDownloadFolder: string;\n pulumiBinaryPath: string;\n constructor(options: Options = {}) {\n this.options = options;\n\n this.pulumiDownloadFolder = path.join(\n options.pulumiFolder || process.cwd(),\n \"pulumi-cli\",\n os.platform()\n );\n\n this.pulumiFolder = path.join(this.pulumiDownloadFolder, \"pulumi\");\n this.pulumiBinaryPath = path.join(this.pulumiFolder, \"pulumi\");\n }\n\n run(rawArgs: RunArgs) {\n this.ensureAwsPluginIsInstalled();\n\n const args = merge({}, this.options, rawArgs);\n\n if (!Array.isArray(args.command)) {\n args.command = [args.command];\n }\n\n // 1. Prepare Pulumi args.\n const finalArgs = [];\n for (const key in args.args) {\n const value = args.args[key];\n if (!value) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n finalArgs.push(`--${kebabCase(key)}`, value[i]);\n }\n continue;\n }\n\n if (typeof value === \"boolean\") {\n finalArgs.push(`--${kebabCase(key)}`);\n continue;\n }\n\n finalArgs.push(`--${kebabCase(key)}`, value);\n }\n\n // Prepare execa args.\n if (!args.execa) {\n args.execa = {};\n }\n\n set(args.execa, \"env.PULUMI_SKIP_UPDATE_CHECK\", \"true\");\n set(args.execa, \"env.PULUMI_HOME\", this.pulumiFolder);\n\n if (os.arch() === \"arm64\") {\n /**\n * This variable is an attempt to resolve this issue:\n * https://yaleman.org/post/2021/2021-01-01-apple-m1-terraform-and-golang/\n */\n set(args.execa, \"env.GODEBUG\", \"asyncpreemptoff=1\");\n }\n\n // Use \";\" when on Windows. For Mac and Linux, use \":\".\n const PATH_SEPARATOR = os.platform() === \"win32\" ? \";\" : \":\";\n\n const execaArgs = {\n ...args.execa,\n env: {\n ...(args.execa.env || {}),\n /**\n * Due to an issue with Pulumi https://github.com/pulumi/pulumi/issues/8374, and even though this\n * commit suggests it should already work like that https://github.com/pulumi/pulumi/commit/c878916901a997a9c0ffcbed23560e19e224a6f1,\n * we need to specify the exact location of our Pulumi binaries, using the PATH environment variable, so it can correctly resolve\n * plugins necessary for custom resources and dynamic providers to work.\n */\n PATH: process.env.PATH + PATH_SEPARATOR + this.pulumiFolder\n }\n };\n\n // We want to keep the \"interactive\" output format of the Pulumi command when `--preview` flag is passed in.\n const flags =\n args.command && args.command.includes(\"preview\") ? [] : [FLAG_NON_INTERACTIVE];\n\n return execa(this.pulumiBinaryPath, [...args.command, ...finalArgs, ...flags], execaArgs);\n }\n\n async install(rawArgs?: InstallArgs): Promise<boolean> {\n const args = merge({}, this.options, rawArgs);\n\n const installed = await downloadBinaries(\n this.pulumiDownloadFolder,\n args.beforePulumiInstall,\n args.afterPulumiInstall\n );\n\n if (installed) {\n this.ensureAwsPluginIsInstalled();\n }\n\n return installed;\n }\n\n ensureAwsPluginIsInstalled() {\n const { version } = require(\"@pulumi/aws/package.json\");\n\n const pluginExists = fs.pathExistsSync(\n path.join(\n this.pulumiFolder,\n \"plugins\",\n `resource-aws-${version}`,\n \"pulumi-resource-aws\"\n )\n );\n\n if (pluginExists) {\n return;\n }\n\n return execa.sync(\n this.pulumiBinaryPath,\n [\"plugin\", \"install\", \"resource\", \"aws\", version],\n {\n stdio: \"inherit\",\n env: {\n PULUMI_HOME: this.pulumiFolder,\n PULUMI_SKIP_UPDATE_CHECK: \"true\"\n }\n }\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["FLAG_NON_INTERACTIVE","Pulumi","constructor","options","pulumiDownloadFolder","path","join","pulumiFolder","process","cwd","os","platform","pulumiBinaryPath","run","rawArgs","ensureAwsPluginIsInstalled","args","Array","isArray","command","finalArgs","key","value","i","length","push","execa","arch","PATH_SEPARATOR","execaArgs","env","PATH","flags","includes","install","installed","downloadBinaries","beforePulumiInstall","afterPulumiInstall","version","require","pluginExists","fs","pathExistsSync","sync","stdio","PULUMI_HOME","PULUMI_SKIP_UPDATE_CHECK"],"sources":["Pulumi.ts"],"sourcesContent":["import os from \"os\";\nimport execa from \"execa\";\nimport * as path from \"path\";\nimport fs from \"fs-extra\";\nimport { merge, kebabCase, set } from \"lodash\";\nimport downloadBinaries from \"./downloadBinaries\";\n\ntype Command = string | string[];\n\nexport interface PulumiArgs {\n [key: string]: string | boolean;\n}\n\nexport interface ExecaArgs {\n env?: {\n [key: string]: string | undefined;\n };\n [key: string]: any;\n}\n\nexport interface Options {\n args?: PulumiArgs;\n execa?: ExecaArgs;\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n\n // A folder into which the Pulumi CLI, along with all of its meta data and config files, will be set up.\n // It's recommended this folder is not checked in into a code repository, since the Pulumi CLI can store\n // sensitive information here, for example - user's Pulumi Service credentials.\n pulumiFolder?: string;\n}\n\nexport interface RunArgs {\n command: Command;\n\n args?: PulumiArgs;\n execa?: ExecaArgs;\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n}\n\nexport interface InstallArgs {\n beforePulumiInstall?: () => any;\n afterPulumiInstall?: () => any;\n}\n\nexport const FLAG_NON_INTERACTIVE = \"--non-interactive\";\n\nexport class Pulumi {\n options: Options;\n pulumiFolder: string;\n pulumiDownloadFolder: string;\n pulumiBinaryPath: string;\n constructor(options: Options = {}) {\n this.options = options;\n\n this.pulumiDownloadFolder = path.join(\n options.pulumiFolder || process.cwd(),\n \"pulumi-cli\",\n os.platform()\n );\n\n this.pulumiFolder = path.join(this.pulumiDownloadFolder, \"pulumi\");\n this.pulumiBinaryPath = path.join(this.pulumiFolder, \"pulumi\");\n }\n\n run(rawArgs: RunArgs) {\n this.ensureAwsPluginIsInstalled();\n\n const args = merge({}, this.options, rawArgs);\n\n if (!Array.isArray(args.command)) {\n args.command = [args.command];\n }\n\n // 1. Prepare Pulumi args.\n const finalArgs = [];\n for (const key in args.args) {\n const value = args.args[key];\n if (!value) {\n continue;\n }\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n finalArgs.push(`--${kebabCase(key)}`, value[i]);\n }\n continue;\n }\n\n if (typeof value === \"boolean\") {\n finalArgs.push(`--${kebabCase(key)}`);\n continue;\n }\n\n finalArgs.push(`--${kebabCase(key)}`, value);\n }\n\n // Prepare execa args.\n if (!args.execa) {\n args.execa = {};\n }\n\n set(args.execa, \"env.PULUMI_SKIP_UPDATE_CHECK\", \"true\");\n set(args.execa, \"env.PULUMI_HOME\", this.pulumiFolder);\n\n if (os.arch() === \"arm64\") {\n /**\n * This variable is an attempt to resolve this issue:\n * https://yaleman.org/post/2021/2021-01-01-apple-m1-terraform-and-golang/\n */\n set(args.execa, \"env.GODEBUG\", \"asyncpreemptoff=1\");\n }\n\n // Use \";\" when on Windows. For Mac and Linux, use \":\".\n const PATH_SEPARATOR = os.platform() === \"win32\" ? \";\" : \":\";\n\n const execaArgs = {\n ...args.execa,\n env: {\n ...(args.execa.env || {}),\n /**\n * Due to an issue with Pulumi https://github.com/pulumi/pulumi/issues/8374, and even though this\n * commit suggests it should already work like that https://github.com/pulumi/pulumi/commit/c878916901a997a9c0ffcbed23560e19e224a6f1,\n * we need to specify the exact location of our Pulumi binaries, using the PATH environment variable, so it can correctly resolve\n * plugins necessary for custom resources and dynamic providers to work.\n */\n PATH: process.env.PATH + PATH_SEPARATOR + this.pulumiFolder\n }\n };\n\n // We want to keep the \"interactive\" output format of the Pulumi command when `--preview` flag is passed in.\n const flags =\n args.command && args.command.includes(\"preview\") ? [] : [FLAG_NON_INTERACTIVE];\n\n return execa(this.pulumiBinaryPath, [...args.command, ...finalArgs, ...flags], execaArgs);\n }\n\n async install(rawArgs?: InstallArgs): Promise<boolean> {\n const args = merge({}, this.options, rawArgs);\n\n const installed = await downloadBinaries(\n this.pulumiDownloadFolder,\n args.beforePulumiInstall,\n args.afterPulumiInstall\n );\n\n if (installed) {\n this.ensureAwsPluginIsInstalled();\n }\n\n return installed;\n }\n\n ensureAwsPluginIsInstalled() {\n const { version } = require(\"@pulumi/aws/package.json\");\n\n const pluginExists = fs.pathExistsSync(\n path.join(\n this.pulumiFolder,\n \"plugins\",\n `resource-aws-${version}`,\n \"pulumi-resource-aws\"\n )\n );\n\n if (pluginExists) {\n return;\n }\n\n return execa.sync(\n this.pulumiBinaryPath,\n [\"plugin\", \"install\", \"resource\", \"aws\", version],\n {\n stdio: \"inherit\",\n env: {\n PULUMI_HOME: this.pulumiFolder,\n PULUMI_SKIP_UPDATE_CHECK: \"true\"\n }\n }\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AAEA;AAyCO,MAAMA,oBAAoB,GAAG,mBAAmB;AAAC;AAEjD,MAAMC,MAAM,CAAC;EAKhBC,WAAW,CAACC,OAAgB,GAAG,CAAC,CAAC,EAAE;IAAA;IAAA;IAAA;IAAA;IAC/B,IAAI,CAACA,OAAO,GAAGA,OAAO;IAEtB,IAAI,CAACC,oBAAoB,GAAGC,IAAI,CAACC,IAAI,CACjCH,OAAO,CAACI,YAAY,IAAIC,OAAO,CAACC,GAAG,EAAE,EACrC,YAAY,EACZC,WAAE,CAACC,QAAQ,EAAE,CAChB;IAED,IAAI,CAACJ,YAAY,GAAGF,IAAI,CAACC,IAAI,CAAC,IAAI,CAACF,oBAAoB,EAAE,QAAQ,CAAC;IAClE,IAAI,CAACQ,gBAAgB,GAAGP,IAAI,CAACC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IACzB,MAAM;MAAEwB;IAAQ,CAAC,GAAGC,OAAO,CAAC,0BAA0B,CAAC;IAEvD,MAAMC,YAAY,GAAGC,gBAAE,CAACC,cAAc,CAClCtC,IAAI,CAACC,IAAI,CACL,IAAI,CAACC,YAAY,EACjB,SAAS,EACR,gBAAegC,OAAQ,EAAC,EACzB,qBAAqB,CACxB,CACJ;IAED,IAAIE,YAAY,EAAE;MACd;IACJ;IAEA,OAAOf,cAAK,CAACkB,IAAI,CACb,IAAI,CAAChC,gBAAgB,EACrB,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE2B,OAAO,CAAC,EACjD;MACIM,KAAK,EAAE,SAAS;MAChBf,GAAG,EAAE;QACDgB,WAAW,EAAE,IAAI,CAACvC,YAAY;QAC9BwC,wBAAwB,EAAE;MAC9B;IACJ,CAAC,CACJ;EACL;AACJ;AAAC"}
|
package/downloadBinaries.js
CHANGED
|
@@ -4,70 +4,51 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
const os = require("os");
|
|
9
|
-
|
|
10
8
|
const tar = require("tar");
|
|
11
|
-
|
|
12
9
|
const fs = require("fs");
|
|
13
|
-
|
|
14
10
|
const download = require("download");
|
|
15
|
-
|
|
16
11
|
const path = require("path");
|
|
17
|
-
|
|
18
12
|
const decompress = require("decompress");
|
|
13
|
+
const semver = require("semver");
|
|
19
14
|
|
|
20
|
-
|
|
15
|
+
// We gotta sanitize the package version, since on a few occasions, we've detected the Pulumi version
|
|
21
16
|
// can look like the following: "2.25.2+dirty". We want to ensure only "2.25.2" is returned.
|
|
22
17
|
// @see https://github.com/pulumi/pulumi/issues/6847
|
|
23
|
-
|
|
24
|
-
|
|
25
18
|
const getPulumiVersion = () => {
|
|
26
19
|
const {
|
|
27
20
|
version
|
|
28
21
|
} = require("@pulumi/pulumi/package.json");
|
|
29
|
-
|
|
30
22
|
return semver.clean(version);
|
|
31
23
|
};
|
|
32
|
-
|
|
33
24
|
var _default = async (downloadFolder, beforeInstall, afterInstall) => {
|
|
34
25
|
if (fs.existsSync(downloadFolder)) {
|
|
35
26
|
return false;
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
if (typeof beforeInstall === "function") {
|
|
39
29
|
await beforeInstall();
|
|
40
30
|
}
|
|
41
|
-
|
|
42
31
|
const platform = os.platform();
|
|
43
|
-
|
|
44
32
|
switch (platform) {
|
|
45
33
|
case "darwin":
|
|
46
34
|
await setupDarwin(downloadFolder);
|
|
47
35
|
break;
|
|
48
|
-
|
|
49
36
|
case "linux":
|
|
50
37
|
await setupLinux(downloadFolder);
|
|
51
38
|
break;
|
|
52
|
-
|
|
53
39
|
case "win32":
|
|
54
40
|
await setupWindows(downloadFolder);
|
|
55
41
|
break;
|
|
56
|
-
|
|
57
42
|
default:
|
|
58
43
|
throw Error(`Cannot download Pulumi binaries - platform "${platform}" not supported. Supported ones are "darwin", "linux", and "win32"`);
|
|
59
44
|
}
|
|
60
|
-
|
|
61
45
|
if (typeof afterInstall === "function") {
|
|
62
46
|
await afterInstall();
|
|
63
47
|
}
|
|
64
|
-
|
|
65
48
|
return true;
|
|
66
49
|
};
|
|
67
|
-
|
|
68
50
|
exports.default = _default;
|
|
69
51
|
const SUPPORTED_ARCHITECTURES = ["x64", "arm64"];
|
|
70
|
-
|
|
71
52
|
async function setupDarwin(downloadFolder) {
|
|
72
53
|
const version = getPulumiVersion();
|
|
73
54
|
const arch = SUPPORTED_ARCHITECTURES.includes(process.arch) ? process.arch : "x64";
|
|
@@ -80,7 +61,6 @@ async function setupDarwin(downloadFolder) {
|
|
|
80
61
|
});
|
|
81
62
|
fs.unlinkSync(path.join(downloadFolder, filename));
|
|
82
63
|
}
|
|
83
|
-
|
|
84
64
|
async function setupWindows(downloadFolder) {
|
|
85
65
|
const version = getPulumiVersion();
|
|
86
66
|
const filename = `pulumi-v${version}-windows-x64.zip`;
|
|
@@ -93,7 +73,6 @@ async function setupWindows(downloadFolder) {
|
|
|
93
73
|
});
|
|
94
74
|
fs.unlinkSync(path.join(downloadFolder, filename));
|
|
95
75
|
}
|
|
96
|
-
|
|
97
76
|
async function setupLinux(downloadFolder) {
|
|
98
77
|
const version = getPulumiVersion();
|
|
99
78
|
const filename = `pulumi-v${version}-linux-x64.tar.gz`;
|
package/downloadBinaries.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["os","require","tar","fs","download","path","decompress","semver","getPulumiVersion","version","clean","downloadFolder","beforeInstall","afterInstall","existsSync","platform","setupDarwin","setupLinux","setupWindows","Error","SUPPORTED_ARCHITECTURES","arch","includes","process","filename","downloadUrl","extract","cwd","file","join","unlinkSync","archive","destination","strip"],"sources":["downloadBinaries.ts"],"sourcesContent":["const os = require(\"os\");\nconst tar = require(\"tar\");\nconst fs = require(\"fs\");\nconst download = require(\"download\");\nconst path = require(\"path\");\nconst decompress = require(\"decompress\");\nconst semver = require(\"semver\");\n\n// We gotta sanitize the package version, since on a few occasions, we've detected the Pulumi version\n// can look like the following: \"2.25.2+dirty\". We want to ensure only \"2.25.2\" is returned.\n// @see https://github.com/pulumi/pulumi/issues/6847\nconst getPulumiVersion = () => {\n const { version } = require(\"@pulumi/pulumi/package.json\");\n return semver.clean(version);\n};\n\nexport default async (\n downloadFolder: string,\n beforeInstall?: () => void,\n afterInstall?: () => void\n) => {\n if (fs.existsSync(downloadFolder)) {\n return false;\n }\n\n if (typeof beforeInstall === \"function\") {\n await beforeInstall();\n }\n\n const platform = os.platform();\n switch (platform) {\n case \"darwin\":\n await setupDarwin(downloadFolder);\n break;\n case \"linux\":\n await setupLinux(downloadFolder);\n break;\n case \"win32\":\n await setupWindows(downloadFolder);\n break;\n default:\n throw Error(\n `Cannot download Pulumi binaries - platform \"${platform}\" not supported. Supported ones are \"darwin\", \"linux\", and \"win32\"`\n );\n }\n\n if (typeof afterInstall === \"function\") {\n await afterInstall();\n }\n\n return true;\n};\n\nconst SUPPORTED_ARCHITECTURES = [\"x64\", \"arm64\"];\n\nasync function setupDarwin(downloadFolder: string) {\n const version = getPulumiVersion();\n const arch = SUPPORTED_ARCHITECTURES.includes(process.arch) ? process.arch : \"x64\";\n\n const filename = `pulumi-v${version}-darwin-${arch}.tar.gz`;\n const downloadUrl = \"https://get.pulumi.com/releases/sdk/\" + filename;\n\n await download(downloadUrl, downloadFolder);\n\n await tar.extract({\n cwd: downloadFolder,\n file: path.join(downloadFolder, filename)\n });\n\n fs.unlinkSync(path.join(downloadFolder, filename));\n}\n\nasync function setupWindows(downloadFolder: string) {\n const version = getPulumiVersion();\n const filename = `pulumi-v${version}-windows-x64.zip`;\n const downloadUrl = \"https://get.pulumi.com/releases/sdk/\" + filename;\n\n await download(downloadUrl, downloadFolder);\n\n const archive = path.join(downloadFolder, filename);\n const destination = path.join(downloadFolder, \"pulumi\");\n await decompress(archive, destination, { strip: 2 });\n\n fs.unlinkSync(path.join(downloadFolder, filename));\n}\n\nasync function setupLinux(downloadFolder: string) {\n const version = getPulumiVersion();\n const filename = `pulumi-v${version}-linux-x64.tar.gz`;\n const downloadUrl = \"https://get.pulumi.com/releases/sdk/\" + filename;\n\n await download(downloadUrl, downloadFolder);\n\n await tar.extract({\n cwd: downloadFolder,\n file: path.join(downloadFolder, filename)\n });\n\n fs.unlinkSync(path.join(downloadFolder, filename));\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["os","require","tar","fs","download","path","decompress","semver","getPulumiVersion","version","clean","downloadFolder","beforeInstall","afterInstall","existsSync","platform","setupDarwin","setupLinux","setupWindows","Error","SUPPORTED_ARCHITECTURES","arch","includes","process","filename","downloadUrl","extract","cwd","file","join","unlinkSync","archive","destination","strip"],"sources":["downloadBinaries.ts"],"sourcesContent":["const os = require(\"os\");\nconst tar = require(\"tar\");\nconst fs = require(\"fs\");\nconst download = require(\"download\");\nconst path = require(\"path\");\nconst decompress = require(\"decompress\");\nconst semver = require(\"semver\");\n\n// We gotta sanitize the package version, since on a few occasions, we've detected the Pulumi version\n// can look like the following: \"2.25.2+dirty\". We want to ensure only \"2.25.2\" is returned.\n// @see https://github.com/pulumi/pulumi/issues/6847\nconst getPulumiVersion = () => {\n const { version } = require(\"@pulumi/pulumi/package.json\");\n return semver.clean(version);\n};\n\nexport default async (\n downloadFolder: string,\n beforeInstall?: () => void,\n afterInstall?: () => void\n) => {\n if (fs.existsSync(downloadFolder)) {\n return false;\n }\n\n if (typeof beforeInstall === \"function\") {\n await beforeInstall();\n }\n\n const platform = os.platform();\n switch (platform) {\n case \"darwin\":\n await setupDarwin(downloadFolder);\n break;\n case \"linux\":\n await setupLinux(downloadFolder);\n break;\n case \"win32\":\n await setupWindows(downloadFolder);\n break;\n default:\n throw Error(\n `Cannot download Pulumi binaries - platform \"${platform}\" not supported. Supported ones are \"darwin\", \"linux\", and \"win32\"`\n );\n }\n\n if (typeof afterInstall === \"function\") {\n await afterInstall();\n }\n\n return true;\n};\n\nconst SUPPORTED_ARCHITECTURES = [\"x64\", \"arm64\"];\n\nasync function setupDarwin(downloadFolder: string) {\n const version = getPulumiVersion();\n const arch = SUPPORTED_ARCHITECTURES.includes(process.arch) ? process.arch : \"x64\";\n\n const filename = `pulumi-v${version}-darwin-${arch}.tar.gz`;\n const downloadUrl = \"https://get.pulumi.com/releases/sdk/\" + filename;\n\n await download(downloadUrl, downloadFolder);\n\n await tar.extract({\n cwd: downloadFolder,\n file: path.join(downloadFolder, filename)\n });\n\n fs.unlinkSync(path.join(downloadFolder, filename));\n}\n\nasync function setupWindows(downloadFolder: string) {\n const version = getPulumiVersion();\n const filename = `pulumi-v${version}-windows-x64.zip`;\n const downloadUrl = \"https://get.pulumi.com/releases/sdk/\" + filename;\n\n await download(downloadUrl, downloadFolder);\n\n const archive = path.join(downloadFolder, filename);\n const destination = path.join(downloadFolder, \"pulumi\");\n await decompress(archive, destination, { strip: 2 });\n\n fs.unlinkSync(path.join(downloadFolder, filename));\n}\n\nasync function setupLinux(downloadFolder: string) {\n const version = getPulumiVersion();\n const filename = `pulumi-v${version}-linux-x64.tar.gz`;\n const downloadUrl = \"https://get.pulumi.com/releases/sdk/\" + filename;\n\n await download(downloadUrl, downloadFolder);\n\n await tar.extract({\n cwd: downloadFolder,\n file: path.join(downloadFolder, filename)\n });\n\n fs.unlinkSync(path.join(downloadFolder, filename));\n}\n"],"mappings":";;;;;;AAAA,MAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AACxB,MAAMC,GAAG,GAAGD,OAAO,CAAC,KAAK,CAAC;AAC1B,MAAME,EAAE,GAAGF,OAAO,CAAC,IAAI,CAAC;AACxB,MAAMG,QAAQ,GAAGH,OAAO,CAAC,UAAU,CAAC;AACpC,MAAMI,IAAI,GAAGJ,OAAO,CAAC,MAAM,CAAC;AAC5B,MAAMK,UAAU,GAAGL,OAAO,CAAC,YAAY,CAAC;AACxC,MAAMM,MAAM,GAAGN,OAAO,CAAC,QAAQ,CAAC;;AAEhC;AACA;AACA;AACA,MAAMO,gBAAgB,GAAG,MAAM;EAC3B,MAAM;IAAEC;EAAQ,CAAC,GAAGR,OAAO,CAAC,6BAA6B,CAAC;EAC1D,OAAOM,MAAM,CAACG,KAAK,CAACD,OAAO,CAAC;AAChC,CAAC;AAAC,eAEa,OACXE,cAAsB,EACtBC,aAA0B,EAC1BC,YAAyB,KACxB;EACD,IAAIV,EAAE,CAACW,UAAU,CAACH,cAAc,CAAC,EAAE;IAC/B,OAAO,KAAK;EAChB;EAEA,IAAI,OAAOC,aAAa,KAAK,UAAU,EAAE;IACrC,MAAMA,aAAa,EAAE;EACzB;EAEA,MAAMG,QAAQ,GAAGf,EAAE,CAACe,QAAQ,EAAE;EAC9B,QAAQA,QAAQ;IACZ,KAAK,QAAQ;MACT,MAAMC,WAAW,CAACL,cAAc,CAAC;MACjC;IACJ,KAAK,OAAO;MACR,MAAMM,UAAU,CAACN,cAAc,CAAC;MAChC;IACJ,KAAK,OAAO;MACR,MAAMO,YAAY,CAAC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,IAAI,CAAClB,cAAc,EAAE,QAAQ,CAAC;EACvD,MAAML,UAAU,CAACyB,OAAO,EAAEC,WAAW,EAAE;IAAEC,KAAK,EAAE;EAAE,CAAC,CAAC;EAEpD9B,EAAE,CAAC2B,UAAU,CAACzB,IAAI,CAACwB,IAAI,CAAClB,cAAc,EAAEa,QAAQ,CAAC,CAAC;AACtD;AAEA,eAAeP,UAAU,CAACN,cAAsB,EAAE;EAC9C,MAAMF,OAAO,GAAGD,gBAAgB,EAAE;EAClC,MAAMgB,QAAQ,GAAI,WAAUf,OAAQ,mBAAkB;EACtD,MAAMgB,WAAW,GAAG,sCAAsC,GAAGD,QAAQ;EAErE,MAAMpB,QAAQ,CAACqB,WAAW,EAAEd,cAAc,CAAC;EAE3C,MAAMT,GAAG,CAACwB,OAAO,CAAC;IACdC,GAAG,EAAEhB,cAAc;IACnBiB,IAAI,EAAEvB,IAAI,CAACwB,IAAI,CAAClB,cAAc,EAAEa,QAAQ;EAC5C,CAAC,CAAC;EAEFrB,EAAE,CAAC2B,UAAU,CAACzB,IAAI,CAACwB,IAAI,CAAClB,cAAc,EAAEa,QAAQ,CAAC,CAAC;AACtD"}
|
package/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _Pulumi = require("./Pulumi");
|
|
8
|
-
|
|
9
7
|
Object.keys(_Pulumi).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _Pulumi[key]) return;
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Pulumi\";\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./Pulumi\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/pulumi-sdk",
|
|
3
|
-
"version": "5.35.0
|
|
3
|
+
"version": "5.35.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"@babel/cli": "^7.19.3",
|
|
29
29
|
"@babel/core": "^7.19.3",
|
|
30
30
|
"@types/lodash": "^4.14.190",
|
|
31
|
-
"@webiny/cli": "^5.35.0
|
|
32
|
-
"@webiny/project-utils": "^5.35.0
|
|
31
|
+
"@webiny/cli": "^5.35.0",
|
|
32
|
+
"@webiny/project-utils": "^5.35.0",
|
|
33
33
|
"rimraf": "^3.0.2",
|
|
34
34
|
"typescript": "4.7.4"
|
|
35
35
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"build": "yarn webiny run build",
|
|
46
46
|
"watch": "yarn webiny run watch"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "948cd1e05978e0ed25137ace7dd6c15ed0bf2cca"
|
|
49
49
|
}
|