@storm-software/pulumi-tools 0.9.0 → 0.10.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/.eslintrc.json +40 -0
- package/CHANGELOG.md +28 -0
- package/README.md +2 -1
- package/dist/{chunk-E5AP6CDG.mjs → chunk-2DGPOHPV.mjs} +1 -1
- package/dist/{chunk-2TYNPYBU.mjs → chunk-2WOVRK7D.mjs} +1 -1
- package/dist/{chunk-R3EJZLX2.js → chunk-DQF4ETOO.js} +8 -0
- package/dist/{chunk-36ZCRXV6.mjs → chunk-EX7FIDME.mjs} +1 -1
- package/dist/{chunk-RWNDPKJK.js → chunk-FLSGBXS4.js} +2 -2
- package/dist/{chunk-ZUJ3PY3K.js → chunk-FPC2C44G.js} +5 -5
- package/dist/{chunk-SSY3QNGM.mjs → chunk-IOQCO27P.mjs} +1 -1
- package/dist/{chunk-IWIZJWH3.mjs → chunk-PJUV5DSE.mjs} +22 -14
- package/dist/{chunk-DFUGKUEV.js → chunk-Q4CKWHPM.js} +3 -3
- package/dist/{chunk-TXKOR3ID.js → chunk-TDUXEEJE.js} +2 -2
- package/dist/{chunk-O2YJQKYB.js → chunk-UFAAW3EP.js} +2 -2
- package/dist/{chunk-T6O7JL6L.mjs → chunk-UIUSAJII.mjs} +1 -1
- package/dist/{chunk-N7ZQU3A6.js → chunk-X6FOFN6M.js} +2 -2
- package/dist/{chunk-2PVTUX4W.mjs → chunk-XGW62IC4.mjs} +1 -1
- package/dist/{chunk-2QARL2O5.js → chunk-YEORYOVK.js} +2 -2
- package/dist/{chunk-DIIDXD4R.mjs → chunk-YO5I6TUI.mjs} +1 -1
- package/dist/executors.js +7 -7
- package/dist/executors.mjs +7 -7
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +2 -2
- package/dist/index.js +9 -9
- package/dist/index.mjs +8 -8
- package/dist/src/base/base-executor.js +3 -3
- package/dist/src/base/base-executor.mjs +2 -2
- package/dist/src/base/index.js +3 -3
- package/dist/src/base/index.mjs +2 -2
- package/dist/src/executors/config/executor.js +4 -4
- package/dist/src/executors/config/executor.mjs +3 -3
- package/dist/src/executors/import/executor.js +4 -4
- package/dist/src/executors/import/executor.mjs +3 -3
- package/dist/src/executors/preview/executor.js +4 -4
- package/dist/src/executors/preview/executor.mjs +3 -3
- package/dist/src/executors/refresh/executor.js +4 -4
- package/dist/src/executors/refresh/executor.mjs +3 -3
- package/dist/src/executors/up/executor.js +4 -4
- package/dist/src/executors/up/executor.mjs +3 -3
- package/dist/src/generators/init/generator.js +3 -3
- package/dist/src/generators/init/generator.mjs +2 -2
- package/executors.ts +10 -0
- package/generators.ts +2 -0
- package/index.ts +3 -0
- package/package.json +1 -1
- package/project.json +57 -0
- package/src/base/base-executor.ts +77 -0
- package/src/base/index.ts +2 -0
- package/src/base/providers.ts +9 -0
- package/src/executors/config/executor.ts +11 -0
- package/src/executors/import/executor.ts +10 -0
- package/src/executors/preview/executor.ts +10 -0
- package/src/executors/refresh/executor.ts +12 -0
- package/src/executors/up/executor.ts +12 -0
- package/src/generators/init/generator.ts +167 -0
- package/tsconfig.json +31 -0
- package/tsup.config.ts +24 -0
- /package/{dist/src → src}/executors/config/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/config/schema.json +0 -0
- /package/{dist/src → src}/executors/import/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/import/schema.json +0 -0
- /package/{dist/src → src}/executors/preview/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/preview/schema.json +0 -0
- /package/{dist/src → src}/executors/refresh/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/refresh/schema.json +0 -0
- /package/{dist/src → src}/executors/up/schema.d.ts +0 -0
- /package/{dist/src → src}/executors/up/schema.json +0 -0
- /package/{dist/src → src}/generators/init/files/src/index.ts.template +0 -0
- /package/{dist/src → src}/generators/init/schema.d.ts +0 -0
- /package/{dist/src → src}/generators/init/schema.json +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
5
|
-
require('../../../chunk-
|
|
3
|
+
var _chunkX6FOFN6Mjs = require('../../../chunk-X6FOFN6M.js');
|
|
4
|
+
require('../../../chunk-Q4CKWHPM.js');
|
|
5
|
+
require('../../../chunk-DQF4ETOO.js');
|
|
6
6
|
require('../../../chunk-3RG5ZIWI.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.default =
|
|
9
|
+
exports.default = _chunkX6FOFN6Mjs.executor_default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executor_default
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-2DGPOHPV.mjs";
|
|
4
|
+
import "../../../chunk-UIUSAJII.mjs";
|
|
5
|
+
import "../../../chunk-PJUV5DSE.mjs";
|
|
6
6
|
import "../../../chunk-IEZKYJSF.mjs";
|
|
7
7
|
export {
|
|
8
8
|
executor_default as default
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
5
|
-
require('../../../chunk-
|
|
3
|
+
var _chunkTDUXEEJEjs = require('../../../chunk-TDUXEEJE.js');
|
|
4
|
+
require('../../../chunk-Q4CKWHPM.js');
|
|
5
|
+
require('../../../chunk-DQF4ETOO.js');
|
|
6
6
|
require('../../../chunk-3RG5ZIWI.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.default =
|
|
9
|
+
exports.default = _chunkTDUXEEJEjs.executor_default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executor_default
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-EX7FIDME.mjs";
|
|
4
|
+
import "../../../chunk-UIUSAJII.mjs";
|
|
5
|
+
import "../../../chunk-PJUV5DSE.mjs";
|
|
6
6
|
import "../../../chunk-IEZKYJSF.mjs";
|
|
7
7
|
export {
|
|
8
8
|
executor_default as default
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
5
|
-
require('../../../chunk-
|
|
3
|
+
var _chunkYEORYOVKjs = require('../../../chunk-YEORYOVK.js');
|
|
4
|
+
require('../../../chunk-Q4CKWHPM.js');
|
|
5
|
+
require('../../../chunk-DQF4ETOO.js');
|
|
6
6
|
require('../../../chunk-3RG5ZIWI.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.default =
|
|
9
|
+
exports.default = _chunkYEORYOVKjs.executor_default;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
executor_default
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import "../../../chunk-
|
|
5
|
-
import "../../../chunk-
|
|
3
|
+
} from "../../../chunk-IOQCO27P.mjs";
|
|
4
|
+
import "../../../chunk-UIUSAJII.mjs";
|
|
5
|
+
import "../../../chunk-PJUV5DSE.mjs";
|
|
6
6
|
import "../../../chunk-IEZKYJSF.mjs";
|
|
7
7
|
export {
|
|
8
8
|
executor_default as default
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkFPC2C44Gjs = require('../../../chunk-FPC2C44G.js');
|
|
5
5
|
require('../../../chunk-HUKXHFCA.js');
|
|
6
|
-
require('../../../chunk-
|
|
6
|
+
require('../../../chunk-DQF4ETOO.js');
|
|
7
7
|
require('../../../chunk-3RG5ZIWI.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.default =
|
|
11
|
+
exports.default = _chunkFPC2C44Gjs.generator_default; exports.initGeneratorFn = _chunkFPC2C44Gjs.initGeneratorFn;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generator_default,
|
|
3
3
|
initGeneratorFn
|
|
4
|
-
} from "../../../chunk-
|
|
4
|
+
} from "../../../chunk-XGW62IC4.mjs";
|
|
5
5
|
import "../../../chunk-KPFHCT4A.mjs";
|
|
6
|
-
import "../../../chunk-
|
|
6
|
+
import "../../../chunk-PJUV5DSE.mjs";
|
|
7
7
|
import "../../../chunk-IEZKYJSF.mjs";
|
|
8
8
|
export {
|
|
9
9
|
generator_default as default,
|
package/executors.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./src/executors/config/executor";
|
|
2
|
+
export { type ConfigExecutorSchema } from "./src/executors/config/schema.d";
|
|
3
|
+
export * from "./src/executors/import/executor";
|
|
4
|
+
export { type ImportExecutorSchema } from "./src/executors/import/schema.d";
|
|
5
|
+
export * from "./src/executors/preview/executor";
|
|
6
|
+
export { type PreviewExecutorSchema } from "./src/executors/preview/schema.d";
|
|
7
|
+
export * from "./src/executors/refresh/executor";
|
|
8
|
+
export { type RefreshExecutorSchema } from "./src/executors/refresh/schema.d";
|
|
9
|
+
export * from "./src/executors/up/executor";
|
|
10
|
+
export { type UpExecutorSchema } from "./src/executors/up/schema.d";
|
package/generators.ts
ADDED
package/index.ts
ADDED
package/package.json
CHANGED
package/project.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "pulumi-tools",
|
|
3
|
+
"$schema": "../../node_modules/nx/schemas/project-schema.json",
|
|
4
|
+
"sourceRoot": "packages/pulumi-tools/src",
|
|
5
|
+
"projectType": "library",
|
|
6
|
+
"implicitDependencies": ["workspace-tools", "config-tools", "config"],
|
|
7
|
+
"targets": {
|
|
8
|
+
"build-untyped": {
|
|
9
|
+
"executor": "nx:run-commands",
|
|
10
|
+
"dependsOn": ["clean", "^build"],
|
|
11
|
+
"inputs": [
|
|
12
|
+
"{projectRoot}/src/**/untyped.ts",
|
|
13
|
+
"{projectRoot}/src/**/*.untyped.ts"
|
|
14
|
+
],
|
|
15
|
+
"outputs": [
|
|
16
|
+
"{projectRoot}/src/**/schema.d.ts",
|
|
17
|
+
"{projectRoot}/src/**/*.schema.d.ts",
|
|
18
|
+
"{projectRoot}/src/**/schema.md",
|
|
19
|
+
"{projectRoot}/src/**/*.schema.md",
|
|
20
|
+
"{projectRoot}/src/**/schema.json",
|
|
21
|
+
"{projectRoot}/src/**/*.schema.json"
|
|
22
|
+
],
|
|
23
|
+
"options": {
|
|
24
|
+
"commands": [
|
|
25
|
+
"node dist/packages/untyped/bin/untyped.cjs generate --entry=\"packages/pulumi-tools/**/{untyped.ts,*.untyped.ts}\" "
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"build-base": {
|
|
30
|
+
"executor": "nx:run-commands",
|
|
31
|
+
"dependsOn": ["build-untyped", "clean", "^build"],
|
|
32
|
+
"options": {
|
|
33
|
+
"command": "tsup-node --config=tsup.config.ts",
|
|
34
|
+
"cwd": "{projectRoot}"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"build": {
|
|
38
|
+
"executor": "nx:run-commands",
|
|
39
|
+
"dependsOn": ["build-base", "build-untyped"],
|
|
40
|
+
"options": {
|
|
41
|
+
"commands": [
|
|
42
|
+
"pnpm copyfiles LICENSE dist/packages/pulumi-tools",
|
|
43
|
+
"pnpm copyfiles --up=2 ./packages/pulumi-tools/*.md ./packages/pulumi-tools/executors.json ./packages/pulumi-tools/generators.json ./packages/pulumi-tools/package.json dist/packages/pulumi-tools",
|
|
44
|
+
"pnpm copyfiles --up=3 \"./packages/pulumi-tools/dist/**/*\" dist/packages/pulumi-tools/dist",
|
|
45
|
+
"pnpm copyfiles --up=3 \"./packages/pulumi-tools/src/**/*schema.d.ts\" dist/packages/pulumi-tools/dist/src",
|
|
46
|
+
"pnpm copyfiles --up=3 \"./packages/pulumi-tools/src/**/*schema.json\" dist/packages/pulumi-tools/dist/src",
|
|
47
|
+
"pnpm copyfiles --up=3 \"./packages/pulumi-tools/src/**/*.md\" dist/packages/pulumi-tools/docs/api",
|
|
48
|
+
"pnpm copyfiles --up=4 \"./packages/pulumi-tools/src/generators/*/files/**/*\" dist/packages/pulumi-tools/dist/src/generators"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
"nx-release-publish": {
|
|
54
|
+
"executor": "@storm-software/workspace-tools:npm-publish"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type { ExecutorContext } from "@nx/devkit";
|
|
2
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
3
|
+
import { ProjectTokenizerOptions, run } from "@storm-software/config-tools";
|
|
4
|
+
import type { BaseExecutorOptions } from "@storm-software/workspace-tools";
|
|
5
|
+
import { withRunExecutor } from "@storm-software/workspace-tools";
|
|
6
|
+
import { BaseExecutorSchema } from "@storm-software/workspace-tools/base/base-executor.schema.d";
|
|
7
|
+
import { join } from "node:path";
|
|
8
|
+
import { which } from "shelljs";
|
|
9
|
+
|
|
10
|
+
export interface PulumiCommandOptions {
|
|
11
|
+
stack?: string;
|
|
12
|
+
root?: string;
|
|
13
|
+
parent?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type PulumiExecutorSchema = BaseExecutorSchema &
|
|
18
|
+
Partial<PulumiCommandOptions>;
|
|
19
|
+
|
|
20
|
+
export type NormalizedPulumiExecutorOptions<
|
|
21
|
+
TExecutorSchema extends PulumiExecutorSchema = PulumiExecutorSchema
|
|
22
|
+
> = ProjectTokenizerOptions & TExecutorSchema;
|
|
23
|
+
|
|
24
|
+
export const withPulumiExecutor =
|
|
25
|
+
<TExecutorSchema extends PulumiExecutorSchema = PulumiExecutorSchema>(
|
|
26
|
+
command: string,
|
|
27
|
+
argsMapper: (
|
|
28
|
+
options: NormalizedPulumiExecutorOptions<TExecutorSchema>
|
|
29
|
+
) => Array<string | false | undefined>,
|
|
30
|
+
executorOptions: BaseExecutorOptions<TExecutorSchema> = {}
|
|
31
|
+
) =>
|
|
32
|
+
async (
|
|
33
|
+
_options: TExecutorSchema,
|
|
34
|
+
context: ExecutorContext
|
|
35
|
+
): Promise<{ success: boolean }> => {
|
|
36
|
+
return withRunExecutor<TExecutorSchema>(
|
|
37
|
+
`Pulumi \`${command}\` Command Executor`,
|
|
38
|
+
async (
|
|
39
|
+
options: NormalizedPulumiExecutorOptions<TExecutorSchema>,
|
|
40
|
+
context: ExecutorContext,
|
|
41
|
+
config: StormWorkspaceConfig
|
|
42
|
+
) => {
|
|
43
|
+
if (!which("pulumi")) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
"Pulumi is not installed. Please install it before running this executor."
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (
|
|
50
|
+
!context.projectsConfigurations?.projects ||
|
|
51
|
+
!context.projectName ||
|
|
52
|
+
!context.projectsConfigurations.projects[context.projectName]
|
|
53
|
+
) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
"The Build process failed because the context is not valid. Please run this command from a workspace."
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const { sourceRoot } =
|
|
60
|
+
context.projectsConfigurations.projects[context.projectName]!;
|
|
61
|
+
|
|
62
|
+
run(
|
|
63
|
+
config,
|
|
64
|
+
["pulumi", command, ...argsMapper(options)].filter(Boolean).join(" "),
|
|
65
|
+
join(config.workspaceRoot, (options.root || sourceRoot)!),
|
|
66
|
+
"inherit",
|
|
67
|
+
{
|
|
68
|
+
...process.env,
|
|
69
|
+
PULUMI_EXPERIMENTAL: "true"
|
|
70
|
+
}
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
return null;
|
|
74
|
+
},
|
|
75
|
+
executorOptions
|
|
76
|
+
)(_options, context);
|
|
77
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { withPulumiExecutor } from "../../base/base-executor";
|
|
2
|
+
import { ConfigExecutorSchema } from "./schema";
|
|
3
|
+
|
|
4
|
+
export default withPulumiExecutor<ConfigExecutorSchema>("config", (options) => [
|
|
5
|
+
options.action,
|
|
6
|
+
options.showSecrets && `--show-secrets`,
|
|
7
|
+
options.secret && `--secret`,
|
|
8
|
+
options.path && `--path`,
|
|
9
|
+
options.name && options.value && `"${options.name}" "${options.value}"`,
|
|
10
|
+
options.stack && `--stack=${options.stack}`,
|
|
11
|
+
]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withPulumiExecutor } from "../../base/base-executor";
|
|
2
|
+
import { ImportExecutorSchema } from "./schema";
|
|
3
|
+
|
|
4
|
+
export default withPulumiExecutor<ImportExecutorSchema>("import", (options) => [
|
|
5
|
+
options.target,
|
|
6
|
+
options.name,
|
|
7
|
+
options.id,
|
|
8
|
+
options.parent && `--parent 'parent=${options.parent}'`,
|
|
9
|
+
options.stack && `--stack=${options.stack}`,
|
|
10
|
+
]);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { withPulumiExecutor } from "../../base/base-executor";
|
|
2
|
+
import { PreviewExecutorSchema } from "./schema.d";
|
|
3
|
+
|
|
4
|
+
export default withPulumiExecutor<PreviewExecutorSchema>(
|
|
5
|
+
"preview",
|
|
6
|
+
(options) => [
|
|
7
|
+
options.stack && `--stack=${options.stack}`,
|
|
8
|
+
options.expectNoChanges && "--expect-no-changes",
|
|
9
|
+
],
|
|
10
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { withPulumiExecutor } from "../../base/base-executor";
|
|
2
|
+
import { RefreshExecutorSchema } from "./schema";
|
|
3
|
+
|
|
4
|
+
export default withPulumiExecutor<RefreshExecutorSchema>(
|
|
5
|
+
"refresh",
|
|
6
|
+
(options) => [
|
|
7
|
+
"--suppress-progress",
|
|
8
|
+
options.stack && `--stack=${options.stack}`,
|
|
9
|
+
options.skipPreview && "--skip-preview",
|
|
10
|
+
options.yes && "--yes",
|
|
11
|
+
],
|
|
12
|
+
);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { withPulumiExecutor } from "../../base/base-executor";
|
|
2
|
+
import { UpExecutorSchema } from "./schema";
|
|
3
|
+
|
|
4
|
+
export default withPulumiExecutor<UpExecutorSchema>("up", (options) => [
|
|
5
|
+
"--suppress-progress",
|
|
6
|
+
options.stack && `--stack=${options.stack}`,
|
|
7
|
+
options.skipPreview && "--skip-preview",
|
|
8
|
+
options.yes && "--yes",
|
|
9
|
+
options.suppressOutputs && "--suppress-outputs",
|
|
10
|
+
options.debug && "--debug",
|
|
11
|
+
options.json && "--json",
|
|
12
|
+
]);
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import {
|
|
2
|
+
addDependenciesToPackageJson,
|
|
3
|
+
addProjectConfiguration,
|
|
4
|
+
formatFiles,
|
|
5
|
+
GeneratorCallback,
|
|
6
|
+
readJsonFile,
|
|
7
|
+
runTasksInSerial,
|
|
8
|
+
type Tree
|
|
9
|
+
} from "@nx/devkit";
|
|
10
|
+
import { StormWorkspaceConfig } from "@storm-software/config";
|
|
11
|
+
import { run } from "@storm-software/config-tools";
|
|
12
|
+
import {
|
|
13
|
+
initGenerator as baseInitGenerator,
|
|
14
|
+
withRunGenerator
|
|
15
|
+
} from "@storm-software/workspace-tools";
|
|
16
|
+
import { readFileSync, unlinkSync } from "node:fs";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { getCloudTemplateName } from "../../base/providers";
|
|
19
|
+
import type { InitGeneratorSchema } from "./schema";
|
|
20
|
+
|
|
21
|
+
export async function initGeneratorFn(
|
|
22
|
+
tree: Tree,
|
|
23
|
+
options: InitGeneratorSchema,
|
|
24
|
+
config: StormWorkspaceConfig
|
|
25
|
+
) {
|
|
26
|
+
const task = baseInitGenerator(tree, options);
|
|
27
|
+
|
|
28
|
+
addProjectConfiguration(tree, options.name || "deployment", {
|
|
29
|
+
root: options.directory || "./deployment",
|
|
30
|
+
projectType: "application",
|
|
31
|
+
sourceRoot: options.directory || "./deployment",
|
|
32
|
+
targets: {
|
|
33
|
+
up: {
|
|
34
|
+
executor: "@nx-extend/pulumi:up",
|
|
35
|
+
options: {}
|
|
36
|
+
},
|
|
37
|
+
preview: {
|
|
38
|
+
executor: "@nx-extend/pulumi:preview",
|
|
39
|
+
options: {}
|
|
40
|
+
},
|
|
41
|
+
refresh: {
|
|
42
|
+
executor: "@nx-extend/pulumi:refresh",
|
|
43
|
+
options: {}
|
|
44
|
+
},
|
|
45
|
+
import: {
|
|
46
|
+
executor: "@nx-extend/pulumi:import",
|
|
47
|
+
options: {}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
tags: ["infra:pulumi"]
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
await runTasksInSerial(
|
|
54
|
+
generateNewPulumiProject(tree, options, config),
|
|
55
|
+
loginToPulumi(tree, options, config),
|
|
56
|
+
addPulumiDeps(tree, options),
|
|
57
|
+
cleanupProject(tree, options)
|
|
58
|
+
)();
|
|
59
|
+
|
|
60
|
+
if (!options.skipFormat) {
|
|
61
|
+
await formatFiles(tree);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return task;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default withRunGenerator<InitGeneratorSchema>(
|
|
68
|
+
"Initialize Storm Pulumi workspace",
|
|
69
|
+
initGeneratorFn
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
function generateNewPulumiProject(
|
|
73
|
+
tree: Tree,
|
|
74
|
+
options: InitGeneratorSchema,
|
|
75
|
+
config: StormWorkspaceConfig
|
|
76
|
+
): GeneratorCallback {
|
|
77
|
+
return () => {
|
|
78
|
+
const template = getCloudTemplateName(options.provider);
|
|
79
|
+
|
|
80
|
+
run(
|
|
81
|
+
config,
|
|
82
|
+
[
|
|
83
|
+
`pulumi new ${template}`,
|
|
84
|
+
`--name=${options.name || "deployment"}`,
|
|
85
|
+
`--dir=${options.directory || "./deployment"}`,
|
|
86
|
+
options.secretsProvider &&
|
|
87
|
+
`--secrets-provider=${options.secretsProvider}`,
|
|
88
|
+
"--generate-only",
|
|
89
|
+
"--yes",
|
|
90
|
+
"--force"
|
|
91
|
+
]
|
|
92
|
+
.filter(Boolean)
|
|
93
|
+
.join(" "),
|
|
94
|
+
join(config.workspaceRoot, options.directory || "./deployment"),
|
|
95
|
+
"inherit"
|
|
96
|
+
);
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function loginToPulumi(
|
|
101
|
+
tree: Tree,
|
|
102
|
+
options: InitGeneratorSchema,
|
|
103
|
+
config: StormWorkspaceConfig
|
|
104
|
+
): GeneratorCallback {
|
|
105
|
+
return () => {
|
|
106
|
+
if (!options.login) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (options.login.startsWith("file://")) {
|
|
111
|
+
options.login = `file://${tree.root}/${
|
|
112
|
+
options.directory || "./deployment"
|
|
113
|
+
}/${options.login.replace("file://", "")}`;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
run(
|
|
117
|
+
config,
|
|
118
|
+
["pulumi login", options.login].filter(Boolean).join(" "),
|
|
119
|
+
join(config.workspaceRoot, options.directory || "./deployment"),
|
|
120
|
+
"inherit",
|
|
121
|
+
{
|
|
122
|
+
...process.env,
|
|
123
|
+
PULUMI_EXPERIMENTAL: "true"
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function addPulumiDeps(
|
|
130
|
+
tree: Tree,
|
|
131
|
+
options: InitGeneratorSchema
|
|
132
|
+
): GeneratorCallback {
|
|
133
|
+
return () => {
|
|
134
|
+
const packageJson = readJsonFile(`${options.directory}/package.json`);
|
|
135
|
+
|
|
136
|
+
if (packageJson) {
|
|
137
|
+
addDependenciesToPackageJson(tree, {}, packageJson.dependencies || {})();
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function cleanupProject(
|
|
143
|
+
tree: Tree,
|
|
144
|
+
options: InitGeneratorSchema
|
|
145
|
+
): GeneratorCallback {
|
|
146
|
+
return () => {
|
|
147
|
+
const indexTsLocation = join(
|
|
148
|
+
tree.root,
|
|
149
|
+
`${options.directory || "./deployment"}/index.ts`
|
|
150
|
+
);
|
|
151
|
+
tree.write(
|
|
152
|
+
`${options.directory}/pulumi.ts`,
|
|
153
|
+
readFileSync(indexTsLocation).toString()
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
// Remove the unneeded files
|
|
157
|
+
unlinkSync(
|
|
158
|
+
join(tree.root, `${options.directory || "./deployment"}/.gitignore`)
|
|
159
|
+
);
|
|
160
|
+
unlinkSync(
|
|
161
|
+
join(tree.root, `${options.directory || "./deployment"}/package.json`)
|
|
162
|
+
);
|
|
163
|
+
unlinkSync(
|
|
164
|
+
join(tree.root, `${options.directory || "./deployment"}/tsconfig.json`)
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../dist/out-tsc",
|
|
5
|
+
"rootDir": "../..",
|
|
6
|
+
"target": "ESNext",
|
|
7
|
+
"module": "ESNext",
|
|
8
|
+
"lib": ["ESNext"],
|
|
9
|
+
"skipLibCheck": true,
|
|
10
|
+
"skipDefaultLibCheck": true,
|
|
11
|
+
"moduleResolution": "Bundler",
|
|
12
|
+
"moduleDetection": "force",
|
|
13
|
+
"types": ["node"]
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"executors.ts",
|
|
17
|
+
"generators.ts",
|
|
18
|
+
"index.ts",
|
|
19
|
+
"src/**/*.ts",
|
|
20
|
+
"src/**/*.d.ts",
|
|
21
|
+
"src/**/*.json",
|
|
22
|
+
"tsup.config.ts"
|
|
23
|
+
],
|
|
24
|
+
"exclude": [
|
|
25
|
+
"jest.config.ts",
|
|
26
|
+
"src/generators/**/files/**/*",
|
|
27
|
+
"src/**/untyped.ts",
|
|
28
|
+
"src/**/*.spec.ts",
|
|
29
|
+
"src/**/*.test.ts"
|
|
30
|
+
]
|
|
31
|
+
}
|
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig([
|
|
4
|
+
{
|
|
5
|
+
name: "pulumi-tools",
|
|
6
|
+
target: "node22",
|
|
7
|
+
entryPoints: [
|
|
8
|
+
"./*.ts",
|
|
9
|
+
"./src/base/*.ts",
|
|
10
|
+
"./src/executors/*/executor.ts",
|
|
11
|
+
"./src/generators/*/generator.ts",
|
|
12
|
+
],
|
|
13
|
+
outDir: "dist",
|
|
14
|
+
format: ["cjs", "esm"],
|
|
15
|
+
platform: "node",
|
|
16
|
+
splitting: true,
|
|
17
|
+
clean: true,
|
|
18
|
+
dts: true,
|
|
19
|
+
sourcemap: false,
|
|
20
|
+
shims: true,
|
|
21
|
+
tsconfig: "./tsconfig.json",
|
|
22
|
+
external: ["@storm-software/workspace-tools"],
|
|
23
|
+
},
|
|
24
|
+
]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|