@benshawmean/envedit 1.4.1-2 → 1.4.1
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/.gitlab-ci.yml +4 -2
- package/cli/cmd/environmentCmd/add.ts +2 -0
- package/cli/index.ts +3 -0
- package/lib/config.ts +5 -5
- package/package.json +1 -1
package/.gitlab-ci.yml
CHANGED
|
@@ -87,10 +87,12 @@ publish:
|
|
|
87
87
|
- bunx npm publish ${PUBLISH_FLAGS[*]} package.tgz
|
|
88
88
|
- sh ci/npm.sh
|
|
89
89
|
- bun publish ${PUBLISH_FLAGS[*]} package.tgz
|
|
90
|
+
- sleep 15 # wait for the package to be available in the registry
|
|
90
91
|
|
|
92
|
+
after_script:
|
|
91
93
|
- |
|
|
92
94
|
export GLAB_DATA=$(glab api "projects/:id/packages?order_by=created_at&sort=asc" | jq .[-1])
|
|
93
|
-
export GLAB_PACKAGE_URL=$(echo $GLAB_DATA | jq ._links.web_path
|
|
95
|
+
export GLAB_PACKAGE_URL=$(echo $GLAB_DATA | jq ._links.web_path)
|
|
94
96
|
export VERSION_NUMBER=$(echo $GLAB_DATA | jq .version)
|
|
95
97
|
|
|
96
98
|
echo "GLAB_PACKAGE_URL=$GLAB_PACKAGE_URL" >> variables.env
|
|
@@ -127,5 +129,5 @@ release:
|
|
|
127
129
|
url: "https://www.npmjs.com/package/@$CI_PROJECT_PATH/v/$VERSION_NUMBER"
|
|
128
130
|
link_type: package
|
|
129
131
|
- name: "GitLab Package Registry Release"
|
|
130
|
-
url: "https://gitlab.com
|
|
132
|
+
url: "https://gitlab.com$GLAB_PACKAGE_URL"
|
|
131
133
|
link_type: package
|
package/cli/index.ts
CHANGED
package/lib/config.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface VariableConfiguration {
|
|
|
19
19
|
type: VariableType;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
export interface
|
|
22
|
+
export interface EnvironmentConfiguration {
|
|
23
23
|
name: string;
|
|
24
24
|
prefix: string;
|
|
25
25
|
file: string;
|
|
@@ -28,13 +28,13 @@ export interface EnviornmentConfiguration {
|
|
|
28
28
|
|
|
29
29
|
export interface GeneralConfiguration {
|
|
30
30
|
version: number;
|
|
31
|
-
environments:
|
|
31
|
+
environments: EnvironmentConfiguration[];
|
|
32
32
|
variables: VariableConfiguration[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export class Configuration {
|
|
36
36
|
public readonly vars: Map<string, VariableConfiguration> = new Map();
|
|
37
|
-
public readonly envs: Map<string,
|
|
37
|
+
public readonly envs: Map<string, EnvironmentConfiguration> = new Map();
|
|
38
38
|
public readonly version: number = 1;
|
|
39
39
|
private readonly configFilePath: string = 'env.config.yaml';
|
|
40
40
|
|
|
@@ -48,18 +48,18 @@ export class Configuration {
|
|
|
48
48
|
const configContent = Bun.YAML.parse(read(this.configFilePath, "utf-8")) as GeneralConfiguration;
|
|
49
49
|
|
|
50
50
|
const setWrapper = <
|
|
51
|
-
K extends
|
|
51
|
+
K extends EnvironmentConfiguration | VariableConfiguration
|
|
52
52
|
>(map: Map<string, K>): ((item: K) => void) => (item: K) => void map.set(item.name, item);
|
|
53
53
|
|
|
54
54
|
configContent.environments.forEach(setWrapper(this.envs))
|
|
55
55
|
configContent.variables.forEach(setWrapper(this.vars))
|
|
56
|
-
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
public save() {
|
|
60
59
|
write(
|
|
61
60
|
this.configFilePath,
|
|
62
61
|
Bun.YAML.stringify({
|
|
62
|
+
"$schema": "https://benshawmean.com/api/schema/envedit",
|
|
63
63
|
version: this.version,
|
|
64
64
|
environments: Array.from(this.envs.values()),
|
|
65
65
|
variables: Array.from(this.vars.values()),
|