@amplifyup/sdk 0.1.0 → 0.1.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/README.md +15 -0
- package/dist/AmplifyRenderer.js +11 -1
- package/dist/AmplifyRenderer.js.map +1 -1
- package/dist/AmplifyRenderer.mjs +11 -1
- package/dist/AmplifyRenderer.mjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.js +11 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +11 -1
- package/dist/react.mjs.map +1 -1
- package/dist/server.js +11 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +11 -1
- package/dist/server.mjs.map +1 -1
- package/package.json +1 -2
package/README.md
CHANGED
|
@@ -100,6 +100,21 @@ npm run dev
|
|
|
100
100
|
npm run lint
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
## Publishing (maintainers)
|
|
104
|
+
|
|
105
|
+
CI publishes via **npm Trusted Publishing** (GitHub ↔ npm, no long-lived token).
|
|
106
|
+
|
|
107
|
+
**One-time setup on npm:**
|
|
108
|
+
|
|
109
|
+
1. **If the package has never been published:** Publish once with a token so the package exists: add `NPM_TOKEN` (Automation token) in repo Secrets, run the workflow, then remove the token and continue below.
|
|
110
|
+
2. On [npmjs.com](https://www.npmjs.com): sign in → **Packages** → **@amplifyup/sdk** → **Settings** → **Trusted publishing**.
|
|
111
|
+
3. Under “Select your publisher” choose **GitHub Actions** and set:
|
|
112
|
+
- **Workflow filename:** `publish-sdk.yml` (must match exactly)
|
|
113
|
+
- Repository/owner as prompted.
|
|
114
|
+
4. Save. Future runs publish with no `NPM_TOKEN` secret.
|
|
115
|
+
|
|
116
|
+
Requires Node 22.14+ and npm 11.5.1+ (workflow uses Node 22).
|
|
117
|
+
|
|
103
118
|
## License
|
|
104
119
|
|
|
105
120
|
MIT
|
package/dist/AmplifyRenderer.js
CHANGED
|
@@ -178,6 +178,16 @@ var AWSAdapter = class {
|
|
|
178
178
|
// src/storage.ts
|
|
179
179
|
var INSTANCE_ID_KEY = "amplifyup_instance_id";
|
|
180
180
|
var USER_ID_KEY = "amplifyup_user_id";
|
|
181
|
+
function generateGuid() {
|
|
182
|
+
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
183
|
+
return crypto.randomUUID();
|
|
184
|
+
}
|
|
185
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
|
|
186
|
+
const r = Math.random() * 16 | 0;
|
|
187
|
+
const v = c === "x" ? r : r & 3 | 8;
|
|
188
|
+
return v.toString(16);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
181
191
|
function getInstanceId() {
|
|
182
192
|
if (typeof window === "undefined") {
|
|
183
193
|
return "";
|
|
@@ -186,7 +196,7 @@ function getInstanceId() {
|
|
|
186
196
|
if (stored) {
|
|
187
197
|
return stored;
|
|
188
198
|
}
|
|
189
|
-
const instanceId = `
|
|
199
|
+
const instanceId = `browser_${generateGuid()}`;
|
|
190
200
|
localStorage.setItem(INSTANCE_ID_KEY, instanceId);
|
|
191
201
|
return instanceId;
|
|
192
202
|
}
|