@stoker-platform/cli 0.5.52 → 0.5.54
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/init-files/bin/build.js +0 -61
- package/init-files/bin/install.js +65 -0
- package/init-files/package.json +1 -1
- package/lib/package.json +1 -1
- package/package.json +4 -4
package/init-files/bin/build.js
CHANGED
|
@@ -116,67 +116,6 @@ try {
|
|
|
116
116
|
filteredLines.push(`DATABASE_REGION=${databaseRegion.split("=")[1].replace(/^"|"$/g, "")}`)
|
|
117
117
|
await writeFile(join(__dirname, "..", "extensions", "firestore-send-email.env"), filteredLines.join("\n"))
|
|
118
118
|
|
|
119
|
-
// Update dependencies according to external.package.json
|
|
120
|
-
|
|
121
|
-
const updateDependencies = async (packageJsonPath, externalDeps) => {
|
|
122
|
-
const packageJsonRaw = await readFile(packageJsonPath, "utf8")
|
|
123
|
-
const packageJson = JSON.parse(packageJsonRaw)
|
|
124
|
-
|
|
125
|
-
const dependencies = packageJson.dependencies || {}
|
|
126
|
-
const previouslyManaged = packageJson.stokerExternalPackages || {}
|
|
127
|
-
|
|
128
|
-
let changed = false
|
|
129
|
-
|
|
130
|
-
for (const managedName of Object.keys(previouslyManaged)) {
|
|
131
|
-
if (!Object.prototype.hasOwnProperty.call(externalDeps, managedName)) {
|
|
132
|
-
if (Object.prototype.hasOwnProperty.call(dependencies, managedName)) {
|
|
133
|
-
delete dependencies[managedName]
|
|
134
|
-
changed = true
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
for (const [depName, depVersion] of Object.entries(externalDeps)) {
|
|
140
|
-
if (dependencies[depName] !== depVersion) {
|
|
141
|
-
dependencies[depName] = depVersion
|
|
142
|
-
changed = true
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
packageJson.dependencies = dependencies
|
|
147
|
-
packageJson.stokerExternalPackages = externalDeps
|
|
148
|
-
|
|
149
|
-
if (changed || JSON.stringify(previouslyManaged) !== JSON.stringify(externalDeps)) {
|
|
150
|
-
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 4) + "\n")
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
return changed
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
const externalPackagesPath = join(process.cwd(), "external.package.json")
|
|
157
|
-
if (existsSync(externalPackagesPath)) {
|
|
158
|
-
const externalRaw = await readFile(externalPackagesPath, "utf8")
|
|
159
|
-
const external = JSON.parse(externalRaw)
|
|
160
|
-
const serverDeps = external.server || {}
|
|
161
|
-
const webDeps = external.web || {}
|
|
162
|
-
|
|
163
|
-
const appDir = join(process.cwd())
|
|
164
|
-
const functionsDir = join(process.cwd(), "functions")
|
|
165
|
-
|
|
166
|
-
const appPackageJson = join(appDir, "package.json")
|
|
167
|
-
const functionsPackageJson = join(functionsDir, "package.json")
|
|
168
|
-
|
|
169
|
-
const appChanged = await updateDependencies(appPackageJson, { ...serverDeps, ...webDeps })
|
|
170
|
-
const functionsChanged = await updateDependencies(functionsPackageJson, serverDeps)
|
|
171
|
-
|
|
172
|
-
if (appChanged) {
|
|
173
|
-
await runChildProcess("npm", ["install", "--no-audit", "--no-fund"], appDir)
|
|
174
|
-
}
|
|
175
|
-
if (functionsChanged) {
|
|
176
|
-
await runChildProcess("npm", ["install", "--no-audit", "--no-fund"], functionsDir)
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
119
|
// Create functions .env file with filtered environment variables
|
|
181
120
|
|
|
182
121
|
const functionsEnvPath = join(process.cwd(), "functions", ".env")
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings
|
|
2
|
+
|
|
3
|
+
import { readFile, writeFile } from "fs/promises"
|
|
4
|
+
import { join } from "path"
|
|
5
|
+
import { existsSync } from "fs"
|
|
6
|
+
import { runChildProcess } from "@stoker-platform/node-client"
|
|
7
|
+
|
|
8
|
+
const updateDependencies = async (packageJsonPath, externalDeps) => {
|
|
9
|
+
const packageJsonRaw = await readFile(packageJsonPath, "utf8")
|
|
10
|
+
const packageJson = JSON.parse(packageJsonRaw)
|
|
11
|
+
|
|
12
|
+
const dependencies = packageJson.dependencies || {}
|
|
13
|
+
const previouslyManaged = packageJson.stokerExternalPackages || {}
|
|
14
|
+
|
|
15
|
+
let changed = false
|
|
16
|
+
|
|
17
|
+
for (const managedName of Object.keys(previouslyManaged)) {
|
|
18
|
+
if (!Object.prototype.hasOwnProperty.call(externalDeps, managedName)) {
|
|
19
|
+
if (Object.prototype.hasOwnProperty.call(dependencies, managedName)) {
|
|
20
|
+
delete dependencies[managedName]
|
|
21
|
+
changed = true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
for (const [depName, depVersion] of Object.entries(externalDeps)) {
|
|
27
|
+
if (dependencies[depName] !== depVersion) {
|
|
28
|
+
dependencies[depName] = depVersion
|
|
29
|
+
changed = true
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
packageJson.dependencies = dependencies
|
|
34
|
+
packageJson.stokerExternalPackages = externalDeps
|
|
35
|
+
|
|
36
|
+
if (changed || JSON.stringify(previouslyManaged) !== JSON.stringify(externalDeps)) {
|
|
37
|
+
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 4) + "\n")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return changed
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const externalPackagesPath = join(process.cwd(), "external.package.json")
|
|
44
|
+
if (existsSync(externalPackagesPath)) {
|
|
45
|
+
const externalRaw = await readFile(externalPackagesPath, "utf8")
|
|
46
|
+
const external = JSON.parse(externalRaw)
|
|
47
|
+
const serverDeps = external.server || {}
|
|
48
|
+
const webDeps = external.web || {}
|
|
49
|
+
|
|
50
|
+
const appDir = join(process.cwd())
|
|
51
|
+
const functionsDir = join(process.cwd(), "functions")
|
|
52
|
+
|
|
53
|
+
const appPackageJson = join(appDir, "package.json")
|
|
54
|
+
const functionsPackageJson = join(functionsDir, "package.json")
|
|
55
|
+
|
|
56
|
+
const appChanged = await updateDependencies(appPackageJson, { ...serverDeps, ...webDeps })
|
|
57
|
+
const functionsChanged = await updateDependencies(functionsPackageJson, serverDeps)
|
|
58
|
+
|
|
59
|
+
if (appChanged) {
|
|
60
|
+
await runChildProcess("npm", ["install", "--no-audit", "--no-fund"], appDir)
|
|
61
|
+
}
|
|
62
|
+
if (functionsChanged) {
|
|
63
|
+
await runChildProcess("npm", ["install", "--no-audit", "--no-fund"], functionsDir)
|
|
64
|
+
}
|
|
65
|
+
}
|
package/init-files/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"format": "prettier . --write",
|
|
16
16
|
"lint": "tsc --noEmit && eslint . && npm --prefix functions run lint",
|
|
17
17
|
"prebuild": "npm run clean:lib && npm run clean:functions",
|
|
18
|
-
"build": "tsc && node bin/build.js && node bin/shim.js && npm --prefix functions run build",
|
|
18
|
+
"build": "node bin/install.js && tsc && node bin/build.js && node bin/shim.js && npm --prefix functions run build",
|
|
19
19
|
"test": "vitest --run",
|
|
20
20
|
"admin-emulators": "export FIREBASE_AUTH_EMULATOR_HOST='127.0.0.1:9099' && export FIREBASE_DATABASE_EMULATOR_HOST='127.0.0.1:9000' && export FIRESTORE_EMULATOR_HOST='127.0.0.1:8080' && export FIREBASE_STORAGE_EMULATOR_HOST='127.0.0.1:9199'"
|
|
21
21
|
},
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoker-platform/cli",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.54",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"main": "./lib/src/main.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"@google-cloud/secret-manager": "^6.1.1",
|
|
25
25
|
"@google-cloud/storage": "^7.19.0",
|
|
26
26
|
"@inquirer/prompts": "^8.3.2",
|
|
27
|
-
"@stoker-platform/node-client": "0.5.
|
|
28
|
-
"@stoker-platform/types": "0.5.
|
|
29
|
-
"@stoker-platform/utils": "0.5.
|
|
27
|
+
"@stoker-platform/node-client": "0.5.41",
|
|
28
|
+
"@stoker-platform/types": "0.5.28",
|
|
29
|
+
"@stoker-platform/utils": "0.5.35",
|
|
30
30
|
"algoliasearch": "^5.50.0",
|
|
31
31
|
"commander": "^14.0.0",
|
|
32
32
|
"cross-spawn": "^7.0.6",
|