@designcrowd/fe-shared-lib 1.8.5-edge-fallback-6 → 1.8.5
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/package.json
CHANGED
package/scripts/publish-uat.sh
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
#
|
|
3
|
-
# publish-uat.sh — publish
|
|
3
|
+
# publish-uat.sh — publish @designcrowd/fe-shared-lib (UAT or stable)
|
|
4
4
|
#
|
|
5
|
-
# Usage: ./scripts/publish-uat.sh <suffix>
|
|
5
|
+
# Usage: ./scripts/publish-uat.sh <suffix> # UAT pre-release
|
|
6
|
+
# ./scripts/publish-uat.sh --stable # final release (no suffix)
|
|
6
7
|
# Example: ./scripts/publish-uat.sh edge-fallback-2
|
|
8
|
+
# ./scripts/publish-uat.sh --stable
|
|
7
9
|
#
|
|
8
10
|
# Reads the npm publish token from $NPM_PUBLISH_TOKEN_FILE
|
|
9
11
|
# (default ~/.config/designcrowd/npm-publish-token, mode 600).
|
|
10
12
|
# The token is never written into the repo.
|
|
11
13
|
#
|
|
12
14
|
# Workflow:
|
|
13
|
-
# 1. Validate
|
|
14
|
-
# 2. Compute new version
|
|
15
|
+
# 1. Validate args; in UAT mode also refuse master/main.
|
|
16
|
+
# 2. Compute new version (<base>-<suffix> or <base>); refuse if already published.
|
|
15
17
|
# 3. Bump package.json, run bundle-translation.
|
|
16
18
|
# 4. npm pack — produces a tarball.
|
|
17
19
|
# 5. Secret scan: dangerous filenames + token-shaped strings + the
|
|
@@ -33,16 +35,28 @@ TOKEN_FILE="${NPM_PUBLISH_TOKEN_FILE:-$HOME/.config/designcrowd/npm-publish-toke
|
|
|
33
35
|
abort() { echo "ABORT: $*" >&2; exit 1; }
|
|
34
36
|
|
|
35
37
|
# --- args ---
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
MODE="uat"
|
|
39
|
+
SUFFIX=""
|
|
40
|
+
ARG="${1:-}"
|
|
41
|
+
if [[ "$ARG" == "--stable" ]]; then
|
|
42
|
+
MODE="stable"
|
|
43
|
+
elif [[ -n "$ARG" ]]; then
|
|
44
|
+
SUFFIX="$ARG"
|
|
45
|
+
# Semver pre-release identifiers are [0-9A-Za-z-], dot-separated. Reject underscores etc.
|
|
46
|
+
# so we fail before npm rejects the version mid-flight with a dirty tree.
|
|
47
|
+
[[ "$SUFFIX" =~ ^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*$ ]] || abort "suffix must match semver pre-release: alphanumerics/hyphens, optionally dot-separated"
|
|
48
|
+
else
|
|
49
|
+
abort $'usage: '"$0"$' <suffix> # UAT pre-release (e.g. edge-fallback-2)\n '"$0"$' --stable # final release'
|
|
50
|
+
fi
|
|
41
51
|
|
|
42
52
|
# --- repo state ---
|
|
43
53
|
cd "$(git rev-parse --show-toplevel)"
|
|
44
54
|
BRANCH=$(git symbolic-ref --short HEAD)
|
|
45
|
-
|
|
55
|
+
# UAT publishes from feature branches only; stable can come from any branch
|
|
56
|
+
# (master is the typical case but feature-branch hot publishes are allowed too).
|
|
57
|
+
if [[ "$MODE" == "uat" ]]; then
|
|
58
|
+
[[ "$BRANCH" == "master" || "$BRANCH" == "main" ]] && abort "refusing UAT publish from $BRANCH"
|
|
59
|
+
fi
|
|
46
60
|
|
|
47
61
|
# --- preconditions: files we'll commit must be clean, so unrelated edits don't get swept into the version-bump commit ---
|
|
48
62
|
[[ -z "$(git status --porcelain -- package.json)" ]] || abort "package.json has uncommitted changes; commit or stash before publishing"
|
|
@@ -70,10 +84,18 @@ fi
|
|
|
70
84
|
|
|
71
85
|
# --- compute version ---
|
|
72
86
|
BASE=$(node -p "require('./package.json').version.replace(/-.*/, '')")
|
|
73
|
-
|
|
87
|
+
if [[ "$MODE" == "stable" ]]; then
|
|
88
|
+
NEW="$BASE"
|
|
89
|
+
else
|
|
90
|
+
NEW="$BASE-$SUFFIX"
|
|
91
|
+
fi
|
|
74
92
|
|
|
75
93
|
if npm view "$PKG@$NEW" version >/dev/null 2>&1; then
|
|
76
|
-
|
|
94
|
+
if [[ "$MODE" == "stable" ]]; then
|
|
95
|
+
abort "$PKG@$NEW already published — bump the base version in package.json first"
|
|
96
|
+
else
|
|
97
|
+
abort "$PKG@$NEW already published — pick a new suffix"
|
|
98
|
+
fi
|
|
77
99
|
fi
|
|
78
100
|
|
|
79
101
|
echo "==> publishing $PKG@$NEW from branch $BRANCH"
|
|
@@ -94,10 +94,8 @@ const variantClasses = computed(() => {
|
|
|
94
94
|
};
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
// Keep recognition language in sync with prop
|
|
98
97
|
watch(toRef(props, 'lang'), setLang);
|
|
99
98
|
|
|
100
|
-
// Watch for transcript changes and emit appropriate events
|
|
101
99
|
watch(
|
|
102
100
|
[transcript, isFinal],
|
|
103
101
|
([newTranscript, newIsFinal]) => {
|
|
@@ -110,7 +108,6 @@ watch(
|
|
|
110
108
|
{ flush: 'sync' },
|
|
111
109
|
);
|
|
112
110
|
|
|
113
|
-
// Watch for listening state changes
|
|
114
111
|
watch(isListening, (newVal, oldVal) => {
|
|
115
112
|
if (newVal && !oldVal) {
|
|
116
113
|
emit('on-start');
|
|
@@ -120,7 +117,6 @@ watch(isListening, (newVal, oldVal) => {
|
|
|
120
117
|
}
|
|
121
118
|
});
|
|
122
119
|
|
|
123
|
-
// Watch for errors
|
|
124
120
|
watch(error, (newError) => {
|
|
125
121
|
if (newError) {
|
|
126
122
|
emit('on-error', newError);
|
package/src/useVoiceToText.ts
CHANGED
|
@@ -67,17 +67,14 @@ function getState(): VoiceToTextState {
|
|
|
67
67
|
export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToTextReturn {
|
|
68
68
|
const { lang = 'en-US' } = options;
|
|
69
69
|
|
|
70
|
-
// Get or create shared state
|
|
71
70
|
const { isListening, transcript, isFinal, error } = getState();
|
|
72
71
|
|
|
73
|
-
// Check for browser support
|
|
74
72
|
const SpeechRecognitionCtor: typeof SpeechRecognition | null =
|
|
75
73
|
typeof window !== 'undefined' ? window.SpeechRecognition || window.webkitSpeechRecognition : null;
|
|
76
74
|
|
|
77
75
|
const supported = !!SpeechRecognitionCtor && !isEdgeBrowser();
|
|
78
76
|
const isSupported = computed(() => supported);
|
|
79
77
|
|
|
80
|
-
// Initialize singleton once
|
|
81
78
|
if (!isInitialized && supported && SpeechRecognitionCtor) {
|
|
82
79
|
recognition = new SpeechRecognitionCtor();
|
|
83
80
|
recognition.continuous = true;
|
|
@@ -112,7 +109,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
112
109
|
// eslint-disable-next-line no-console
|
|
113
110
|
console.warn('[useVoiceToText]', event.error, message);
|
|
114
111
|
|
|
115
|
-
// Auto-clear error after timeout
|
|
116
112
|
if (errorClearTimeout) {
|
|
117
113
|
clearTimeout(errorClearTimeout);
|
|
118
114
|
}
|
|
@@ -128,7 +124,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
128
124
|
isInitialized = true;
|
|
129
125
|
}
|
|
130
126
|
|
|
131
|
-
// Update language on existing instance
|
|
132
127
|
if (recognition) {
|
|
133
128
|
recognition.lang = lang;
|
|
134
129
|
}
|
|
@@ -136,7 +131,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
136
131
|
const start = () => {
|
|
137
132
|
if (!recognition || isListening.value) return;
|
|
138
133
|
|
|
139
|
-
// Clear previous state
|
|
140
134
|
transcript.value = '';
|
|
141
135
|
isFinal.value = false;
|
|
142
136
|
error.value = null;
|
|
@@ -149,7 +143,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
149
143
|
recognition.start();
|
|
150
144
|
isListening.value = true;
|
|
151
145
|
} catch (e: unknown) {
|
|
152
|
-
// Handle case where recognition is already started
|
|
153
146
|
// eslint-disable-next-line no-console
|
|
154
147
|
console.warn('[useVoiceToText] Failed to start:', (e as Error).message);
|
|
155
148
|
}
|
|
@@ -162,7 +155,6 @@ export function useVoiceToText(options: UseVoiceToTextOptions = {}): UseVoiceToT
|
|
|
162
155
|
try {
|
|
163
156
|
recognition.stop();
|
|
164
157
|
} catch (e: unknown) {
|
|
165
|
-
// Handle case where recognition is already stopped
|
|
166
158
|
// eslint-disable-next-line no-console
|
|
167
159
|
console.warn('[useVoiceToText] Failed to stop:', (e as Error).message);
|
|
168
160
|
}
|