puls-dev 0.1.8 → 0.1.9
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/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Intent-driven infrastructure-as-code. Describe what you want — Puls figures out create, update, or skip.**
|
|
4
4
|
|
|
5
|
-
[Live Documentation](https://
|
|
5
|
+
[Live Documentation](https://pulsdev.io/) | Discord: **pulsdev.io** ([Join](https://discord.gg/CjgRayuH))
|
|
6
6
|
|
|
7
7
|
```typescript
|
|
8
8
|
@Deploy({ proxmox: CONFIG.STAGING })
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { BaseBuilder } from "../../core/resource.js";
|
|
2
2
|
export declare class FirebaseHostingBuilder extends BaseBuilder {
|
|
3
3
|
private _sourcePath?;
|
|
4
|
+
private _domain?;
|
|
4
5
|
constructor(siteId: string);
|
|
5
6
|
source(path: string): this;
|
|
7
|
+
domain(name: string): this;
|
|
6
8
|
private discoverSite;
|
|
7
9
|
deploy(): Promise<{
|
|
8
10
|
siteId: string;
|
|
@@ -38,15 +38,20 @@ function sha256(filePath) {
|
|
|
38
38
|
}
|
|
39
39
|
export class FirebaseHostingBuilder extends BaseBuilder {
|
|
40
40
|
_sourcePath;
|
|
41
|
+
_domain;
|
|
41
42
|
constructor(siteId) {
|
|
42
43
|
super(siteId);
|
|
43
|
-
// Discovery: check if the site
|
|
44
|
+
// Discovery: check if the site exists
|
|
44
45
|
this.discoveryPromise = this.discoverSite(siteId);
|
|
45
46
|
}
|
|
46
47
|
source(path) {
|
|
47
48
|
this._sourcePath = path;
|
|
48
49
|
return this;
|
|
49
50
|
}
|
|
51
|
+
domain(name) {
|
|
52
|
+
this._domain = name;
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
50
55
|
async discoverSite(siteId) {
|
|
51
56
|
try {
|
|
52
57
|
const projectId = getProjectId();
|
|
@@ -75,7 +80,8 @@ export class FirebaseHostingBuilder extends BaseBuilder {
|
|
|
75
80
|
throw new Error(`[Firebase.Hosting:${siteId}] No files found in "${this._sourcePath}"`);
|
|
76
81
|
const existing = await this.discoveryPromise;
|
|
77
82
|
if (dryRun) {
|
|
78
|
-
|
|
83
|
+
const displayUrl = this._domain ? `https://${this._domain}` : `https://${siteId}.web.app`;
|
|
84
|
+
console.log(` 📝 [PLAN] Deploy ${files.length} file(s) to ${displayUrl}`);
|
|
79
85
|
if (!existing)
|
|
80
86
|
console.log(` └─ Will create secondary site "${siteId}"`);
|
|
81
87
|
for (const f of files.slice(0, 5)) {
|
|
@@ -83,7 +89,7 @@ export class FirebaseHostingBuilder extends BaseBuilder {
|
|
|
83
89
|
}
|
|
84
90
|
if (files.length > 5)
|
|
85
91
|
console.log(` └─ ... and ${files.length - 5} more`);
|
|
86
|
-
return { siteId, url:
|
|
92
|
+
return { siteId, url: displayUrl };
|
|
87
93
|
}
|
|
88
94
|
// 0. Ensure site exists (for secondary sites)
|
|
89
95
|
if (!existing) {
|
|
@@ -164,7 +170,7 @@ export class FirebaseHostingBuilder extends BaseBuilder {
|
|
|
164
170
|
method: "POST",
|
|
165
171
|
body: JSON.stringify({}),
|
|
166
172
|
});
|
|
167
|
-
const url = `https://${siteId}.web.app`;
|
|
173
|
+
const url = this._domain ? `https://${this._domain}` : `https://${siteId}.web.app`;
|
|
168
174
|
console.log(`🚀 Deployed ${files.length} file(s) → ${url}`);
|
|
169
175
|
return { siteId, url };
|
|
170
176
|
}
|