@edgedev/create-edge-app 1.2.34 → 1.2.36
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 +1 -0
- package/agents.md +124 -2
- package/deploy.sh +60 -1
- package/edge/components/cms/block.vue +763 -301
- package/edge/components/cms/blockEditor.vue +342 -29
- package/edge/components/cms/blockPicker.vue +3 -3
- package/edge/components/cms/blocksManager.vue +48 -13
- package/edge/components/cms/htmlContent.vue +601 -10
- package/edge/components/cms/init_blocks/contact_us.html +55 -47
- package/edge/components/cms/init_blocks/newsletter.html +56 -96
- package/edge/components/cms/menu.vue +92 -31
- package/edge/components/cms/page.vue +165 -50
- package/edge/components/cms/posts.vue +13 -4
- package/edge/components/cms/site.vue +15 -4
- package/edge/components/cms/siteSettingsForm.vue +19 -9
- package/edge/components/cms/themeDefaultMenu.vue +20 -2
- package/edge/composables/siteSettingsTemplate.js +2 -0
- package/edge-pull.sh +16 -2
- package/edge-push.sh +9 -1
- package/edge-remote.sh +20 -0
- package/edge-status.sh +9 -5
- package/edge-update-all.sh +247 -0
- package/package.json +1 -1
package/edge-pull.sh
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
# shellcheck source=./edge-remote.sh
|
|
6
|
+
source "$SCRIPT_DIR/edge-remote.sh"
|
|
7
|
+
|
|
8
|
+
fetch_edge_remote
|
|
9
|
+
|
|
10
|
+
if [ -d "$SCRIPT_DIR/edge" ]
|
|
11
|
+
then
|
|
12
|
+
git subtree pull --prefix=edge "$EDGE_REMOTE_NAME" main --squash
|
|
13
|
+
else
|
|
14
|
+
echo "No edge subtree found. Initializing with git subtree add."
|
|
15
|
+
git subtree add --prefix=edge "$EDGE_REMOTE_NAME" main --squash
|
|
16
|
+
fi
|
package/edge-push.sh
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
# shellcheck source=./edge-remote.sh
|
|
6
|
+
source "$SCRIPT_DIR/edge-remote.sh"
|
|
7
|
+
|
|
8
|
+
ensure_edge_remote
|
|
9
|
+
git subtree push --prefix=edge "$EDGE_REMOTE_NAME" main
|
package/edge-remote.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
EDGE_REMOTE_NAME="${EDGE_REMOTE_NAME:-edge-vue-components}"
|
|
5
|
+
EDGE_REMOTE_URL="${EDGE_REMOTE_URL:-https://github.com/Edge-Marketing-and-Design/edge-vue-components.git}"
|
|
6
|
+
|
|
7
|
+
ensure_edge_remote() {
|
|
8
|
+
if git remote get-url "$EDGE_REMOTE_NAME" >/dev/null 2>&1
|
|
9
|
+
then
|
|
10
|
+
return 0
|
|
11
|
+
fi
|
|
12
|
+
|
|
13
|
+
echo "Remote '$EDGE_REMOTE_NAME' is not configured. Adding '$EDGE_REMOTE_URL'."
|
|
14
|
+
git remote add "$EDGE_REMOTE_NAME" "$EDGE_REMOTE_URL"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
fetch_edge_remote() {
|
|
18
|
+
ensure_edge_remote
|
|
19
|
+
git fetch "$EDGE_REMOTE_NAME"
|
|
20
|
+
}
|
package/edge-status.sh
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
5
|
+
# shellcheck source=./edge-remote.sh
|
|
6
|
+
source "$SCRIPT_DIR/edge-remote.sh"
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
fetch_edge_remote >/dev/null 2>&1
|
|
9
|
+
|
|
10
|
+
UP_TREE="$(git rev-parse "$EDGE_REMOTE_NAME/main^{tree}")"
|
|
7
11
|
LOCAL_TREE="$(git rev-parse HEAD:edge)"
|
|
8
12
|
|
|
9
13
|
if [ "$UP_TREE" = "$LOCAL_TREE" ]
|
|
10
14
|
then
|
|
11
|
-
echo "edge is in sync with
|
|
15
|
+
echo "edge is in sync with $EDGE_REMOTE_NAME/main"
|
|
12
16
|
else
|
|
13
|
-
echo "edge differs from
|
|
14
|
-
fi
|
|
17
|
+
echo "edge differs from $EDGE_REMOTE_NAME/main"
|
|
18
|
+
fi
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)"
|
|
5
|
+
cd "$SCRIPT_DIR"
|
|
6
|
+
|
|
7
|
+
usage() {
|
|
8
|
+
cat <<'EOF'
|
|
9
|
+
Usage: ./edge-update-all.sh
|
|
10
|
+
|
|
11
|
+
Updates:
|
|
12
|
+
1) edge subtree (via edge-pull.sh)
|
|
13
|
+
2) remove @edgedev/template-engine and @edgedev/firebase
|
|
14
|
+
3) install latest @edgedev/template-engine and @edgedev/firebase
|
|
15
|
+
EOF
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
for arg in "$@"
|
|
19
|
+
do
|
|
20
|
+
case "$arg" in
|
|
21
|
+
-h|--help)
|
|
22
|
+
usage
|
|
23
|
+
exit 0
|
|
24
|
+
;;
|
|
25
|
+
*)
|
|
26
|
+
echo "Unknown argument: $arg"
|
|
27
|
+
echo
|
|
28
|
+
usage
|
|
29
|
+
exit 1
|
|
30
|
+
;;
|
|
31
|
+
esac
|
|
32
|
+
done
|
|
33
|
+
|
|
34
|
+
if ! command -v pnpm >/dev/null 2>&1
|
|
35
|
+
then
|
|
36
|
+
echo "pnpm is required (pnpm-lock.yaml is present), but it is not installed."
|
|
37
|
+
echo "Install pnpm and rerun."
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
sync_edge_functions() {
|
|
42
|
+
edge_functions_dir="$SCRIPT_DIR/edge/functions"
|
|
43
|
+
local_functions_dir="$SCRIPT_DIR/functions"
|
|
44
|
+
|
|
45
|
+
if [ ! -d "$edge_functions_dir" ]; then
|
|
46
|
+
return
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
echo "==> Syncing edge/functions into local functions/"
|
|
50
|
+
|
|
51
|
+
find "$edge_functions_dir" -type f | sort | while IFS= read -r src_file; do
|
|
52
|
+
rel_path="${src_file#$edge_functions_dir/}"
|
|
53
|
+
if [ "$rel_path" = "index.js" ]; then
|
|
54
|
+
continue
|
|
55
|
+
fi
|
|
56
|
+
dest_file="$local_functions_dir/$rel_path"
|
|
57
|
+
dest_dir="$(dirname "$dest_file")"
|
|
58
|
+
|
|
59
|
+
mkdir -p "$dest_dir"
|
|
60
|
+
|
|
61
|
+
cp "$src_file" "$dest_file"
|
|
62
|
+
done
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
merge_edge_functions_index() {
|
|
66
|
+
edge_index="$SCRIPT_DIR/edge/functions/index.js"
|
|
67
|
+
local_index="$SCRIPT_DIR/functions/index.js"
|
|
68
|
+
|
|
69
|
+
if [ ! -f "$edge_index" ] || [ ! -f "$local_index" ]; then
|
|
70
|
+
return
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
echo "==> Merging extra edge function exports into local functions/index.js"
|
|
74
|
+
EDGE_FUNCTIONS_INDEX_PATH="$edge_index" LOCAL_FUNCTIONS_INDEX_PATH="$local_index" node <<'EOF'
|
|
75
|
+
const fs = require('fs')
|
|
76
|
+
|
|
77
|
+
const edgePath = process.env.EDGE_FUNCTIONS_INDEX_PATH
|
|
78
|
+
const localPath = process.env.LOCAL_FUNCTIONS_INDEX_PATH
|
|
79
|
+
const startMarker = '// START EXTRA EDGE functions'
|
|
80
|
+
const endMarker = '// END EXTRA EDGE functions'
|
|
81
|
+
|
|
82
|
+
const readText = filePath => fs.readFileSync(filePath, 'utf8')
|
|
83
|
+
|
|
84
|
+
const extractMarkedBlock = (text) => {
|
|
85
|
+
const start = text.indexOf(startMarker)
|
|
86
|
+
const end = text.indexOf(endMarker)
|
|
87
|
+
if (start === -1 || end === -1 || end < start)
|
|
88
|
+
throw new Error(`Missing ${startMarker}/${endMarker} block in ${edgePath}`)
|
|
89
|
+
|
|
90
|
+
const endLine = text.indexOf('\n', end)
|
|
91
|
+
return endLine === -1 ? text.slice(start) : text.slice(start, endLine + 1)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const replaceMarkedBlock = (text, replacement) => {
|
|
95
|
+
const start = text.indexOf(startMarker)
|
|
96
|
+
const end = text.indexOf(endMarker)
|
|
97
|
+
const edgeFirebaseEndMarker = '// END @edge/firebase functions'
|
|
98
|
+
|
|
99
|
+
if (start === -1 || end === -1 || end < start) {
|
|
100
|
+
const edgeFirebaseEnd = text.indexOf(edgeFirebaseEndMarker)
|
|
101
|
+
if (edgeFirebaseEnd !== -1) {
|
|
102
|
+
const edgeFirebaseEndLine = text.indexOf('\n', edgeFirebaseEnd)
|
|
103
|
+
const insertAt = edgeFirebaseEndLine === -1 ? text.length : edgeFirebaseEndLine + 1
|
|
104
|
+
const before = text.slice(0, insertAt)
|
|
105
|
+
const after = text.slice(insertAt)
|
|
106
|
+
const joiner = before.endsWith('\n\n') ? '' : '\n'
|
|
107
|
+
return `${before}${joiner}${replacement}${after}`
|
|
108
|
+
}
|
|
109
|
+
const normalized = text.endsWith('\n') ? text : `${text}\n`
|
|
110
|
+
return `${normalized}\n${replacement}`
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const endLine = text.indexOf('\n', end)
|
|
114
|
+
const after = endLine === -1 ? '' : text.slice(endLine + 1)
|
|
115
|
+
return `${text.slice(0, start)}${replacement}${after}`
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const edgeText = readText(edgePath)
|
|
119
|
+
const localText = readText(localPath)
|
|
120
|
+
const edgeBlock = extractMarkedBlock(edgeText)
|
|
121
|
+
const mergedText = replaceMarkedBlock(localText, edgeBlock)
|
|
122
|
+
|
|
123
|
+
fs.writeFileSync(localPath, mergedText.endsWith('\n') ? mergedText : `${mergedText}\n`)
|
|
124
|
+
EOF
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
merge_firestore_indexes() {
|
|
128
|
+
edge_indexes="$SCRIPT_DIR/edge/root/firestore.indexes.json"
|
|
129
|
+
local_indexes="$SCRIPT_DIR/firestore.indexes.json"
|
|
130
|
+
|
|
131
|
+
if [ ! -f "$edge_indexes" ]; then
|
|
132
|
+
return
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
if [ ! -f "$local_indexes" ]; then
|
|
136
|
+
echo "==> Writing firestore.indexes.json from edge/root"
|
|
137
|
+
cp "$edge_indexes" "$local_indexes"
|
|
138
|
+
return
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
echo "==> Merging firestore.indexes.json with edge/root priority"
|
|
142
|
+
EDGE_INDEXES_PATH="$edge_indexes" LOCAL_INDEXES_PATH="$local_indexes" node <<'EOF'
|
|
143
|
+
const fs = require('fs')
|
|
144
|
+
|
|
145
|
+
const edgePath = process.env.EDGE_INDEXES_PATH
|
|
146
|
+
const localPath = process.env.LOCAL_INDEXES_PATH
|
|
147
|
+
|
|
148
|
+
const readJson = (filePath) => JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
|
149
|
+
const edgeJson = readJson(edgePath)
|
|
150
|
+
const localJson = readJson(localPath)
|
|
151
|
+
|
|
152
|
+
const normalizeArray = value => Array.isArray(value) ? value : []
|
|
153
|
+
const makeKey = index => JSON.stringify({
|
|
154
|
+
collectionGroup: index?.collectionGroup || '',
|
|
155
|
+
queryScope: index?.queryScope || 'COLLECTION',
|
|
156
|
+
fields: normalizeArray(index?.fields).map(field => ({
|
|
157
|
+
fieldPath: field?.fieldPath || '',
|
|
158
|
+
order: field?.order || '',
|
|
159
|
+
arrayConfig: field?.arrayConfig || '',
|
|
160
|
+
vectorConfig: field?.vectorConfig || null,
|
|
161
|
+
})),
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
const mergedMap = new Map()
|
|
165
|
+
for (const index of normalizeArray(localJson.indexes))
|
|
166
|
+
mergedMap.set(makeKey(index), index)
|
|
167
|
+
for (const index of normalizeArray(edgeJson.indexes))
|
|
168
|
+
mergedMap.set(makeKey(index), index)
|
|
169
|
+
|
|
170
|
+
const merged = {
|
|
171
|
+
...localJson,
|
|
172
|
+
...edgeJson,
|
|
173
|
+
indexes: Array.from(mergedMap.values()),
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
fs.writeFileSync(localPath, `${JSON.stringify(merged, null, 2)}\n`)
|
|
177
|
+
EOF
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
merge_history_config() {
|
|
181
|
+
edge_history_config="$SCRIPT_DIR/edge/root/history.config.json"
|
|
182
|
+
local_history_config="$SCRIPT_DIR/functions/history.config.json"
|
|
183
|
+
|
|
184
|
+
if [ ! -f "$edge_history_config" ]; then
|
|
185
|
+
return
|
|
186
|
+
fi
|
|
187
|
+
|
|
188
|
+
if [ ! -f "$local_history_config" ]; then
|
|
189
|
+
echo "==> Writing functions/history.config.json from edge/root"
|
|
190
|
+
mkdir -p "$(dirname "$local_history_config")"
|
|
191
|
+
cp "$edge_history_config" "$local_history_config"
|
|
192
|
+
return
|
|
193
|
+
fi
|
|
194
|
+
|
|
195
|
+
echo "==> Merging functions/history.config.json with local priority"
|
|
196
|
+
EDGE_HISTORY_CONFIG_PATH="$edge_history_config" LOCAL_HISTORY_CONFIG_PATH="$local_history_config" node <<'EOF'
|
|
197
|
+
const fs = require('fs')
|
|
198
|
+
|
|
199
|
+
const edgePath = process.env.EDGE_HISTORY_CONFIG_PATH
|
|
200
|
+
const localPath = process.env.LOCAL_HISTORY_CONFIG_PATH
|
|
201
|
+
|
|
202
|
+
const readJson = filePath => JSON.parse(fs.readFileSync(filePath, 'utf8'))
|
|
203
|
+
|
|
204
|
+
const isPlainObject = value => {
|
|
205
|
+
return !!value && typeof value === 'object' && !Array.isArray(value)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const mergeWithLocalPriority = (edgeValue, localValue) => {
|
|
209
|
+
if (localValue === undefined)
|
|
210
|
+
return edgeValue
|
|
211
|
+
|
|
212
|
+
if (Array.isArray(edgeValue) || Array.isArray(localValue))
|
|
213
|
+
return localValue
|
|
214
|
+
|
|
215
|
+
if (isPlainObject(edgeValue) && isPlainObject(localValue)) {
|
|
216
|
+
const merged = { ...edgeValue }
|
|
217
|
+
for (const key of Object.keys(localValue))
|
|
218
|
+
merged[key] = mergeWithLocalPriority(edgeValue?.[key], localValue[key])
|
|
219
|
+
return merged
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return localValue
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const edgeJson = readJson(edgePath)
|
|
226
|
+
const localJson = readJson(localPath)
|
|
227
|
+
const merged = mergeWithLocalPriority(edgeJson, localJson)
|
|
228
|
+
|
|
229
|
+
fs.writeFileSync(localPath, `${JSON.stringify(merged, null, 2)}\n`)
|
|
230
|
+
EOF
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
echo "==> Updating edge subtree"
|
|
234
|
+
"$SCRIPT_DIR/edge-pull.sh"
|
|
235
|
+
|
|
236
|
+
sync_edge_functions
|
|
237
|
+
merge_edge_functions_index
|
|
238
|
+
merge_firestore_indexes
|
|
239
|
+
merge_history_config
|
|
240
|
+
|
|
241
|
+
echo "==> Removing @edgedev packages"
|
|
242
|
+
pnpm remove @edgedev/template-engine @edgedev/firebase
|
|
243
|
+
|
|
244
|
+
echo "==> Installing latest @edgedev packages"
|
|
245
|
+
pnpm add @edgedev/template-engine@latest @edgedev/firebase@latest
|
|
246
|
+
|
|
247
|
+
echo "==> Done"
|