@puzzmo/sdk 0.0.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 ADDED
@@ -0,0 +1,230 @@
1
+ # @puzzmo/sdk
2
+
3
+ The official Puzzmo SDK for runtime and API access for games.
4
+
5
+ ## Installation
6
+
7
+ ### npm
8
+
9
+ ```bash
10
+ npm install @puzzmo/sdk
11
+ ```
12
+
13
+ ### yarn
14
+
15
+ ```bash
16
+ yarn add @puzzmo/sdk
17
+ ```
18
+
19
+ ### pnpm
20
+
21
+ ```bash
22
+ pnpm add @puzzmo/sdk
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### ES Modules (Node.js, Bundlers)
28
+
29
+ ```javascript
30
+ import { helloWorld, getVersion } from '@puzzmo/sdk'
31
+
32
+ console.log(helloWorld()) // "Hello from Puzzmo SDK!"
33
+ console.log(getVersion()) // "0.0.1"
34
+ ```
35
+
36
+ ### CommonJS (Node.js)
37
+
38
+ ```javascript
39
+ const { helloWorld, getVersion } = require('@puzzmo/sdk')
40
+
41
+ console.log(helloWorld()) // "Hello from Puzzmo SDK!"
42
+ console.log(getVersion()) // "0.0.1"
43
+ ```
44
+
45
+ ### UMD (Browser via CDN)
46
+
47
+ ```html
48
+ <!DOCTYPE html>
49
+ <html>
50
+ <head>
51
+ <script src="https://unpkg.com/@puzzmo/sdk@latest/dist/index.umd.js"></script>
52
+ </head>
53
+ <body>
54
+ <script>
55
+ console.log(PuzzmoSDK.helloWorld()) // "Hello from Puzzmo SDK!"
56
+ console.log(PuzzmoSDK.getVersion()) // "0.0.1"
57
+ </script>
58
+ </body>
59
+ </html>
60
+ ```
61
+
62
+ #### Using a specific version
63
+
64
+ ```html
65
+ <script src="https://unpkg.com/@puzzmo/sdk@0.0.1/dist/index.umd.js"></script>
66
+ ```
67
+
68
+ #### Using jsDelivr CDN
69
+
70
+ ```html
71
+ <script src="https://cdn.jsdelivr.net/npm/@puzzmo/sdk@latest/dist/index.umd.js"></script>
72
+ ```
73
+
74
+ ### IIFE (Browser via CDN, smaller build)
75
+
76
+ IIFE (Immediately Invoked Function Expression) is a more compact format ideal for modern browsers:
77
+
78
+ ```html
79
+ <!DOCTYPE html>
80
+ <html>
81
+ <head>
82
+ <script src="https://unpkg.com/@puzzmo/sdk@latest/dist/index.iife.js"></script>
83
+ </head>
84
+ <body>
85
+ <script>
86
+ console.log(PuzzmoSDK.helloWorld()) // "Hello from Puzzmo SDK!"
87
+ console.log(PuzzmoSDK.getVersion()) // "0.0.1"
88
+ </script>
89
+ </body>
90
+ </html>
91
+ ```
92
+
93
+ ## API Reference
94
+
95
+ ### `helloWorld(): string`
96
+
97
+ Returns a hello world message from the Puzzmo SDK.
98
+
99
+ **Returns:** `string` - A greeting message
100
+
101
+ **Example:**
102
+ ```javascript
103
+ import { helloWorld } from '@puzzmo/sdk'
104
+
105
+ const message = helloWorld()
106
+ console.log(message) // "Hello from Puzzmo SDK!"
107
+ ```
108
+
109
+ ### `getVersion(): string`
110
+
111
+ Returns the current SDK version.
112
+
113
+ **Returns:** `string` - The SDK version
114
+
115
+ **Example:**
116
+ ```javascript
117
+ import { getVersion } from '@puzzmo/sdk'
118
+
119
+ const version = getVersion()
120
+ console.log(version) // "0.0.1"
121
+ ```
122
+
123
+ ## Development
124
+
125
+ ### Setup
126
+
127
+ ```bash
128
+ # Install dependencies (from repository root)
129
+ yarn install
130
+
131
+ # Build the SDK
132
+ yarn workspace @puzzmo/sdk build
133
+
134
+ # Run tests
135
+ yarn workspace @puzzmo/sdk test
136
+
137
+ # Watch mode for tests
138
+ yarn workspace @puzzmo/sdk test:watch
139
+
140
+ # Type checking
141
+ yarn workspace @puzzmo/sdk type-check
142
+ ```
143
+
144
+ ### Project Structure
145
+
146
+ ```
147
+ packages/sdk/
148
+ ├── src/
149
+ │ └── index.ts # Main SDK source
150
+ ├── dist/ # Build output (generated)
151
+ │ ├── index.js # ES module build
152
+ │ ├── index.cjs # CommonJS build
153
+ │ ├── index.umd.js # UMD build (for CDN)
154
+ │ ├── index.iife.js # IIFE build (for CDN, smaller)
155
+ │ └── index.d.ts # TypeScript declarations
156
+ ├── package.json
157
+ ├── tsconfig.json
158
+ ├── vite.config.ts # Build configuration
159
+ └── README.md
160
+ ```
161
+
162
+ ### Build Outputs
163
+
164
+ The SDK provides multiple build outputs to support different environments:
165
+
166
+ - **ESM (`index.js`)**: Modern ES module format for bundlers and modern Node.js
167
+ - **CommonJS (`index.cjs`)**: Traditional CommonJS format for older Node.js environments
168
+ - **UMD (`index.umd.js`)**: Universal Module Definition for browser `<script>` tags via CDN
169
+ - **IIFE (`index.iife.js`)**: Immediately Invoked Function Expression for browser `<script>` tags (smaller than UMD)
170
+ - **TypeScript (`index.d.ts`)**: Type declarations for TypeScript projects
171
+
172
+ ## Publishing
173
+
174
+ The SDK is automatically published to npm when changes are pushed to the `main` branch and the version in `package.json` has been updated.
175
+
176
+ ### OIDC-Based Publishing
177
+
178
+ This package uses **OpenID Connect (OIDC)** for secure, auditable publishing:
179
+
180
+ - **Signed Provenance**: Every published version includes cryptographic proof it was built in GitHub Actions
181
+ - **Supply Chain Security**: Verifiable build attestations prevent tampering
182
+ - **Minimal Permissions**: Uses granular npm tokens scoped to this package only
183
+
184
+ See [PUBLISHING.md](./PUBLISHING.md) for complete setup instructions and security details.
185
+
186
+ ### Quick Start: Publishing a New Version
187
+
188
+ 1. Update the version in `packages/sdk/package.json`:
189
+ ```bash
190
+ npm version patch # or minor/major
191
+ ```
192
+
193
+ 2. Commit and push to `main`:
194
+ ```bash
195
+ git add package.json
196
+ git commit -m "chore(sdk): bump version to x.x.x"
197
+ git push origin main
198
+ ```
199
+
200
+ 3. GitHub Actions automatically:
201
+ - Builds and tests the package
202
+ - Publishes to npm with OIDC provenance
203
+ - Creates a git tag for the release
204
+
205
+ ### Verifying Published Packages
206
+
207
+ Anyone can verify the package was built by this repository:
208
+
209
+ ```bash
210
+ npm view @puzzmo/sdk
211
+ # Look for "provenance" section showing GitHub workflow details
212
+ ```
213
+
214
+ **Setup Required**: A granular npm access token must be configured as `NPM_TOKEN` in repository secrets. See [PUBLISHING.md](./PUBLISHING.md) for detailed instructions.
215
+
216
+ ## License
217
+
218
+ MIT
219
+
220
+ ## Contributing
221
+
222
+ Contributions are welcome! Please ensure:
223
+
224
+ - Tests pass: `yarn workspace @puzzmo/sdk test`
225
+ - Types are correct: `yarn workspace @puzzmo/sdk type-check`
226
+ - Code is formatted: `yarn prettier --write packages/sdk`
227
+
228
+ ## Support
229
+
230
+ For issues and questions, please open an issue on the [GitHub repository](https://github.com/puzzmo-com/games/issues).
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function e(){return"Hello from Puzzmo SDK!"}function o(){return"0.0.1"}exports.getVersion=o;exports.helloWorld=e;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["/**\n * Puzzmo SDK\n * Provides runtime and API access for Puzzmo games\n */\n\n/**\n * Returns a hello world message from the Puzzmo SDK\n * @returns A greeting message\n */\nexport function helloWorld(): string {\n return \"Hello from Puzzmo SDK!\"\n}\n\n/**\n * Returns the SDK version\n * @returns The current SDK version\n */\nexport function getVersion(): string {\n return \"0.0.1\"\n}\n"],"names":["helloWorld","getVersion"],"mappings":"gFASO,SAASA,GAAqB,CACnC,MAAO,wBACT,CAMO,SAASC,GAAqB,CACnC,MAAO,OACT"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Puzzmo SDK
3
+ * Provides runtime and API access for Puzzmo games
4
+ */
5
+ /**
6
+ * Returns a hello world message from the Puzzmo SDK
7
+ * @returns A greeting message
8
+ */
9
+ export declare function helloWorld(): string;
10
+ /**
11
+ * Returns the SDK version
12
+ * @returns The current SDK version
13
+ */
14
+ export declare function getVersion(): string;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAEnC"}
@@ -0,0 +1,2 @@
1
+ var PuzzmoSDK=function(e){"use strict";function o(){return"Hello from Puzzmo SDK!"}function n(){return"0.0.1"}return e.getVersion=n,e.helloWorld=o,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),e}({});
2
+ //# sourceMappingURL=index.iife.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.iife.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Puzzmo SDK\n * Provides runtime and API access for Puzzmo games\n */\n\n/**\n * Returns a hello world message from the Puzzmo SDK\n * @returns A greeting message\n */\nexport function helloWorld(): string {\n return \"Hello from Puzzmo SDK!\"\n}\n\n/**\n * Returns the SDK version\n * @returns The current SDK version\n */\nexport function getVersion(): string {\n return \"0.0.1\"\n}\n"],"names":["helloWorld","getVersion"],"mappings":"uCASO,SAASA,GAAqB,CACnC,MAAO,wBACT,CAMO,SAASC,GAAqB,CACnC,MAAO,OACT"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ function o() {
2
+ return "Hello from Puzzmo SDK!";
3
+ }
4
+ function r() {
5
+ return "0.0.1";
6
+ }
7
+ export {
8
+ r as getVersion,
9
+ o as helloWorld
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Puzzmo SDK\n * Provides runtime and API access for Puzzmo games\n */\n\n/**\n * Returns a hello world message from the Puzzmo SDK\n * @returns A greeting message\n */\nexport function helloWorld(): string {\n return \"Hello from Puzzmo SDK!\"\n}\n\n/**\n * Returns the SDK version\n * @returns The current SDK version\n */\nexport function getVersion(): string {\n return \"0.0.1\"\n}\n"],"names":["helloWorld","getVersion"],"mappings":"AASO,SAASA,IAAqB;AACnC,SAAO;AACT;AAMO,SAASC,IAAqB;AACnC,SAAO;AACT;"}
@@ -0,0 +1,2 @@
1
+ (function(e,o){typeof exports=="object"&&typeof module!="undefined"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(e=typeof globalThis!="undefined"?globalThis:e||self,o(e.PuzzmoSDK={}))})(this,function(e){"use strict";function o(){return"Hello from Puzzmo SDK!"}function n(){return"0.0.1"}e.getVersion=n,e.helloWorld=o,Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})});
2
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/index.ts"],"sourcesContent":["/**\n * Puzzmo SDK\n * Provides runtime and API access for Puzzmo games\n */\n\n/**\n * Returns a hello world message from the Puzzmo SDK\n * @returns A greeting message\n */\nexport function helloWorld(): string {\n return \"Hello from Puzzmo SDK!\"\n}\n\n/**\n * Returns the SDK version\n * @returns The current SDK version\n */\nexport function getVersion(): string {\n return \"0.0.1\"\n}\n"],"names":["helloWorld","getVersion"],"mappings":"mPASO,SAASA,GAAqB,CACnC,MAAO,wBACT,CAMO,SAASC,GAAqB,CACnC,MAAO,OACT"}
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@puzzmo/sdk",
3
+ "version": "0.0.1",
4
+ "description": "Puzzmo runtime and API access for games",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "vite build && tsc --project tsconfig.build.json",
21
+ "type-check": "tsc --noEmit",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest"
24
+ },
25
+ "keywords": [
26
+ "puzzmo",
27
+ "games",
28
+ "sdk"
29
+ ],
30
+ "author": "Puzzmo",
31
+ "license": "MIT",
32
+ "repository": {
33
+ "type": "git",
34
+ "url": "https://github.com/puzzmo-com/games.git",
35
+ "directory": "packages/sdk"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "devDependencies": {
42
+ "typescript": "catalog:",
43
+ "vite": "catalog:",
44
+ "vitest": "catalog:"
45
+ }
46
+ }