pepr 0.1.29 → 0.1.31
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/dist/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pepr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Kubernetes application engine",
|
|
5
5
|
"author": "Defense Unicorns",
|
|
6
6
|
"homepage": "https://github.com/defenseunicorns/pepr",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"bin": "dist/
|
|
8
|
+
"bin": "dist/cli.js",
|
|
9
9
|
"repository": "defenseunicorns/pepr",
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.0.0"
|
package/dist/src/cli/index.js
CHANGED
|
@@ -26,8 +26,9 @@ program
|
|
|
26
26
|
});
|
|
27
27
|
(0, init_1.default)(program);
|
|
28
28
|
(0, build_1.default)(program);
|
|
29
|
-
(0, capability_1.default)(program);
|
|
30
|
-
(0, test_1.default)(program);
|
|
31
29
|
(0, deploy_1.default)(program);
|
|
32
30
|
(0, dev_1.default)(program);
|
|
31
|
+
// @todo: finish/re-evaluate these commands
|
|
32
|
+
(0, test_1.default)(program);
|
|
33
|
+
(0, capability_1.default)(program);
|
|
33
34
|
program.parse();
|
|
@@ -15,7 +15,9 @@ function default_1(program) {
|
|
|
15
15
|
program
|
|
16
16
|
.command("init")
|
|
17
17
|
.description("Initialize a new Pepr Module")
|
|
18
|
-
|
|
18
|
+
// skip auto npm install and git init
|
|
19
|
+
.option("--skip-post-init", "Skip npm install, git init and VSCode launch")
|
|
20
|
+
.action(async (opts) => {
|
|
19
21
|
const response = await (0, walkthrough_1.walkthrough)();
|
|
20
22
|
const dirName = (0, utils_1.sanitizeName)(response.name);
|
|
21
23
|
const packageJSON = (0, templates_1.genPkgJSON)(response);
|
|
@@ -33,13 +35,29 @@ function default_1(program) {
|
|
|
33
35
|
await (0, utils_1.write)((0, path_1.resolve)(dirName, templates_1.readme.path), templates_1.readme.data);
|
|
34
36
|
await (0, utils_1.write)((0, path_1.resolve)(dirName, templates_1.tsConfig.path), templates_1.tsConfig.data);
|
|
35
37
|
await (0, utils_1.write)((0, path_1.resolve)(dirName, peprTS.path), peprTS.data);
|
|
36
|
-
await (0, utils_1.write)((0, path_1.resolve)(dirName, ".vscode", templates_1.
|
|
37
|
-
await (0, utils_1.write)((0, path_1.resolve)(dirName, "capabilities", templates_1.
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
await (0, utils_1.write)((0, path_1.resolve)(dirName, ".vscode", templates_1.snippet.path), templates_1.snippet.data);
|
|
39
|
+
await (0, utils_1.write)((0, path_1.resolve)(dirName, "capabilities", templates_1.samplesYaml.path), templates_1.samplesYaml.data);
|
|
40
|
+
await (0, utils_1.write)((0, path_1.resolve)(dirName, "capabilities", templates_1.helloPeprTS.path), templates_1.helloPeprTS.data);
|
|
41
|
+
if (!opts.skipPostInit) {
|
|
42
|
+
// run npm install from the new directory
|
|
43
|
+
process.chdir(dirName);
|
|
44
|
+
(0, child_process_1.execSync)("npm install", {
|
|
45
|
+
stdio: "inherit",
|
|
46
|
+
});
|
|
47
|
+
// setup git
|
|
48
|
+
(0, child_process_1.execSync)("git init", {
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
});
|
|
51
|
+
// try to open vscode
|
|
52
|
+
try {
|
|
53
|
+
(0, child_process_1.execSync)("code .", {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
// vscode not found, do nothing
|
|
59
|
+
}
|
|
60
|
+
}
|
|
43
61
|
console.log(`New Pepr module created at ${dirName}`);
|
|
44
62
|
console.log(`Open VSCode or your editor of choice in ${dirName} to get started!`);
|
|
45
63
|
}
|
|
@@ -72,11 +72,15 @@ export declare const readme: {
|
|
|
72
72
|
path: string;
|
|
73
73
|
data: string;
|
|
74
74
|
};
|
|
75
|
-
export declare const
|
|
75
|
+
export declare const samplesYaml: {
|
|
76
76
|
path: string;
|
|
77
77
|
data: string;
|
|
78
78
|
};
|
|
79
|
-
export declare const
|
|
79
|
+
export declare const helloPeprTS: {
|
|
80
|
+
path: string;
|
|
81
|
+
data: string;
|
|
82
|
+
};
|
|
83
|
+
export declare const snippet: {
|
|
80
84
|
path: string;
|
|
81
85
|
data: string;
|
|
82
86
|
};
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
// SPDX-FileCopyrightText: 2023-Present The Pepr Authors
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.snippet = exports.helloPeprTS = exports.samplesYaml = exports.readme = exports.prettierRC = exports.gitIgnore = exports.tsConfig = exports.genPkgJSON = exports.genPeprTS = void 0;
|
|
6
6
|
const util_1 = require("util");
|
|
7
7
|
const uuid_1 = require("uuid");
|
|
8
8
|
const package_json_1 = require("../../../package.json");
|
|
9
9
|
const utils_1 = require("./utils");
|
|
10
|
+
const client_node_1 = require("@kubernetes/client-node");
|
|
10
11
|
function genPeprTS() {
|
|
11
12
|
return {
|
|
12
13
|
path: "pepr.ts",
|
|
@@ -85,9 +86,10 @@ exports.tsConfig = {
|
|
|
85
86
|
};
|
|
86
87
|
exports.gitIgnore = {
|
|
87
88
|
path: ".gitignore",
|
|
88
|
-
data: `# Ignore node_modules
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
data: `# Ignore node_modules and Pepr build artifacts
|
|
90
|
+
node_modules
|
|
91
|
+
dist
|
|
92
|
+
insecure*
|
|
91
93
|
`,
|
|
92
94
|
};
|
|
93
95
|
exports.prettierRC = {
|
|
@@ -131,10 +133,63 @@ Module Root
|
|
|
131
133
|
\`\`\`
|
|
132
134
|
`,
|
|
133
135
|
};
|
|
134
|
-
exports.
|
|
136
|
+
exports.samplesYaml = {
|
|
137
|
+
path: "samples.yaml",
|
|
138
|
+
data: (0, client_node_1.dumpYaml)([
|
|
139
|
+
{
|
|
140
|
+
apiVersion: "v1",
|
|
141
|
+
kind: "Namespace",
|
|
142
|
+
metadata: {
|
|
143
|
+
name: "pepr-demo",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
apiVersion: "v1",
|
|
148
|
+
kind: "ConfigMap",
|
|
149
|
+
metadata: {
|
|
150
|
+
name: "example-1",
|
|
151
|
+
namespace: "pepr-demo",
|
|
152
|
+
},
|
|
153
|
+
data: {
|
|
154
|
+
key: "ex-1-val",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
apiVersion: "v1",
|
|
159
|
+
kind: "ConfigMap",
|
|
160
|
+
metadata: {
|
|
161
|
+
name: "example-2",
|
|
162
|
+
namespace: "pepr-demo",
|
|
163
|
+
},
|
|
164
|
+
data: {
|
|
165
|
+
key: "ex-2-val",
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
apiVersion: "v1",
|
|
170
|
+
kind: "ConfigMap",
|
|
171
|
+
metadata: {
|
|
172
|
+
name: "example-3",
|
|
173
|
+
namespace: "pepr-demo",
|
|
174
|
+
labels: {
|
|
175
|
+
change: "by-label",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
data: {
|
|
179
|
+
key: "ex-3-val",
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
]),
|
|
183
|
+
};
|
|
184
|
+
exports.helloPeprTS = {
|
|
135
185
|
path: "hello-pepr.ts",
|
|
136
186
|
data: `import { Capability, a } from "pepr";
|
|
137
187
|
|
|
188
|
+
/**
|
|
189
|
+
* The HelloPepr is an example capability to demonstrate some general concepts of Pepr.
|
|
190
|
+
* To test this capability you can run \`pepr dev\` and then run the following command:
|
|
191
|
+
* \`kubectl apply -f capabilities/hello-pepr/samples.yaml\`
|
|
192
|
+
*/
|
|
138
193
|
export const HelloPepr = new Capability({
|
|
139
194
|
name: "hello-pepr",
|
|
140
195
|
description: "A simple example capability to show how things work.",
|
|
@@ -181,11 +236,12 @@ When(a.ConfigMap)
|
|
|
181
236
|
|
|
182
237
|
/**
|
|
183
238
|
* This Capability Action combines different styles. Unlike the previous actions, this one will look for any ConfigMap
|
|
184
|
-
* in the \`pepr-demo\` namespace that has the label \`change=by-label
|
|
185
|
-
* \`WithLabel()\`, \`InNamespace()\`, are ANDs so all conditions must be true
|
|
239
|
+
* in the \`pepr-demo\` namespace that has the label \`change=by-label\` during either CREATE or UPDATE. Note that all
|
|
240
|
+
* conditions added such as \`WithName()\`, \`WithLabel()\`, \`InNamespace()\`, are ANDs so all conditions must be true
|
|
241
|
+
* for the request to be procssed.
|
|
186
242
|
*/
|
|
187
243
|
When(a.ConfigMap)
|
|
188
|
-
.
|
|
244
|
+
.IsCreatedOrUpdated()
|
|
189
245
|
.WithLabel("change", "by-label")
|
|
190
246
|
.Then(request => {
|
|
191
247
|
// The K8s object e are going to mutate
|
|
@@ -203,7 +259,7 @@ When(a.ConfigMap)
|
|
|
203
259
|
});
|
|
204
260
|
`,
|
|
205
261
|
};
|
|
206
|
-
exports.
|
|
262
|
+
exports.snippet = {
|
|
207
263
|
path: "pepr.code-snippets",
|
|
208
264
|
data: `{
|
|
209
265
|
"Create a new Pepr capability": {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pepr",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.31",
|
|
4
4
|
"description": "Kubernetes application engine",
|
|
5
5
|
"author": "Defense Unicorns",
|
|
6
6
|
"homepage": "https://github.com/defenseunicorns/pepr",
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"bin": "dist/
|
|
8
|
+
"bin": "dist/cli.js",
|
|
9
9
|
"repository": "defenseunicorns/pepr",
|
|
10
10
|
"engines": {
|
|
11
11
|
"node": ">=18.0.0"
|