@fynd-design-engineering/fynd-one-v2 1.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,355 @@
1
+ # CDN-Starter πŸš€
2
+
3
+ A modern, production-ready starter template for building custom JavaScript/TypeScript code for Webflow projects. Streamline your development workflow with TypeScript, automated builds, live reloading, and comprehensive testing.
4
+
5
+ [![License: ISC](https://img.shields.io/badge/License-ISC-blue.svg)](https://opensource.org/licenses/ISC)
6
+ [![Node.js](https://img.shields.io/badge/Node.js-18%2B-green.svg)](https://nodejs.org/)
7
+ [![PNPM](https://img.shields.io/badge/PNPM-10%2B-orange.svg)](https://pnpm.io/)
8
+
9
+ ## ✨ Features
10
+
11
+ - **πŸ”§ Modern TypeScript Setup** - Full TypeScript support with strict type checking
12
+ - **⚑ Lightning Fast Builds** - Powered by esbuild for instant compilation
13
+ - **πŸ”„ Live Development** - Hot reloading for instant feedback during development
14
+ - **πŸ“¦ Optimized Production Builds** - Minified, tree-shaken, and ES2020-compatible output
15
+ - **πŸ§ͺ Automated Testing** - End-to-end testing with Playwright
16
+ - **πŸ“ Code Quality** - ESLint, Prettier, and TypeScript integration
17
+ - **🎯 Path Aliases** - Clean imports with custom path mappings
18
+ - **πŸ“‹ Changesets** - Automated versioning and changelog generation
19
+ - **🌐 Webflow Ready** - Optimized for Webflow custom code integration
20
+
21
+ ## 🏁 Quick Start
22
+
23
+ ### Prerequisites
24
+
25
+ Ensure you have the following installed:
26
+
27
+ - **Node.js** (v18.0.0 or higher) - [Download here](https://nodejs.org/)
28
+ - **pnpm** (v10.0.0 or higher) - [Install guide](https://pnpm.io/installation)
29
+
30
+ ### Installation
31
+
32
+ 1. **Create a new repository from this template**
33
+
34
+ [πŸ”— Use this template](https://github.com/Fynd-Design-Engineering/CDN-Starter)
35
+
36
+ > **Note:** You must be authenticated with a Fynd Design Engineering GitHub account
37
+
38
+ 2. **Clone and install dependencies**
39
+ After creating a project with above template install all dependencies using pnpm
40
+
41
+ ```bash
42
+ pnpm install
43
+ ```
44
+
45
+ 3. **Start developing**
46
+
47
+ ```bash
48
+ pnpm dev
49
+ ```
50
+
51
+ Open [http://localhost:3000](http://localhost:3000) to see your project in action!
52
+
53
+ ## πŸ› οΈ Development Workflow
54
+
55
+ ### Development Mode
56
+
57
+ Launch the development server with live reloading:
58
+
59
+ ```bash
60
+ pnpm dev
61
+ ```
62
+
63
+ **What happens:**
64
+
65
+ - πŸ“¦ Bundles TypeScript files in real-time
66
+ - 🌐 Serves files at `http://localhost:3000`
67
+ - πŸ”„ Automatically reloads on file changes
68
+ - πŸ—ΊοΈ Generates source maps for debugging
69
+ - πŸ“Š Displays a helpful table of served files with import suggestions
70
+
71
+ ### Production Build
72
+
73
+ Create an optimized build for deployment:
74
+
75
+ ```bash
76
+ pnpm build
77
+ ```
78
+
79
+ **Build optimizations:**
80
+
81
+ - πŸ—œοΈ Code minification and compression
82
+ - 🌳 Tree shaking to remove unused code
83
+ - 🎯 ES2020 target for broad browser compatibility
84
+ - πŸ“ Clean output in the `dist/` directory
85
+
86
+ ## πŸ§ͺ Testing & Quality Assurance
87
+
88
+ ### Running Tests
89
+
90
+ Execute end-to-end tests with Playwright:
91
+
92
+ ```bash
93
+ # Run tests in headless mode
94
+ pnpm test
95
+
96
+ # Interactive test runner with UI
97
+ pnpm test:ui
98
+ ```
99
+
100
+ ### Code Linting
101
+
102
+ Maintain code quality with ESLint:
103
+
104
+ ```bash
105
+ # Check for issues
106
+ pnpm lint
107
+
108
+ # Auto-fix common problems
109
+ pnpm lint:fix
110
+ ```
111
+
112
+ ### Code Formatting
113
+
114
+ Keep code consistent with Prettier:
115
+
116
+ ```bash
117
+ pnpm format
118
+ ```
119
+
120
+ ### Type Checking
121
+
122
+ Verify TypeScript types:
123
+
124
+ ```bash
125
+ pnpm check
126
+ ```
127
+
128
+ ## πŸ“¦ Release Management
129
+
130
+ This project uses [Changesets](https://github.com/changesets/changesets) for professional version management.
131
+
132
+ ### Creating a Release
133
+
134
+ 1. **Work on your feature branch** (never commit directly to `main`)
135
+
136
+ ```bash
137
+ git checkout -b feature/your-feature-name
138
+ ```
139
+
140
+ 2. **Make your changes and build**
141
+
142
+ ```bash
143
+ pnpm build
144
+ ```
145
+
146
+ 3. **Create a changeset**
147
+
148
+ ```bash
149
+ pnpm changeset
150
+ ```
151
+
152
+ Follow the prompts to:
153
+
154
+ - Select which packages changed
155
+ - Choose the semantic version bump (patch/minor/major)
156
+ - Write a clear summary of changes
157
+
158
+ 4. **Commit your changes**
159
+
160
+ ```bash
161
+ git add .
162
+ git commit -m "feat: add your feature description"
163
+ ```
164
+
165
+ 5. **Publish the release**
166
+ ```bash
167
+ pnpm release
168
+ ```
169
+
170
+ ### Dependency Management
171
+
172
+ Keep dependencies up-to-date:
173
+
174
+ ```bash
175
+ pnpm update
176
+ ```
177
+
178
+ ## πŸ“ Project Architecture
179
+
180
+ ```
181
+ cdn-starter/
182
+ β”œβ”€β”€ πŸ“‚ src/
183
+ β”‚ β”œβ”€β”€ πŸ“„ index.ts # Main entry point
184
+ β”‚ └── πŸ“‚ utils/ # Utility functions
185
+ β”‚ └── πŸ“„ *.ts # Your utility modules
186
+ β”œβ”€β”€ πŸ“‚ dist/ # πŸ—οΈ Build output (auto-generated)
187
+ β”œβ”€β”€ πŸ“‚ tests/ # πŸ§ͺ Playwright test files
188
+ β”‚ └── πŸ“„ example.spec.ts # Example test file
189
+ β”œβ”€β”€ πŸ“‚ bin/ # πŸ”§ Build tools
190
+ β”‚ β”œβ”€β”€ πŸ“„ build.js # esbuild configuration
191
+ β”‚ └── πŸ“„ live-reload.js # Development hot reload script
192
+ β”œβ”€β”€ πŸ“„ package.json # Project configuration
193
+ β”œβ”€β”€ πŸ“„ tsconfig.json # TypeScript settings
194
+ β”œβ”€β”€ πŸ“„ eslint.config.js # ESLint rules
195
+ β”œβ”€β”€ πŸ“„ playwright.config.ts # Test configuration
196
+ └── πŸ“„ README.md # This file
197
+ ```
198
+
199
+ ## πŸ›€οΈ Advanced Configuration
200
+
201
+ ### Multiple Entry Points
202
+
203
+ Build multiple files by updating `bin/build.js`:
204
+
205
+ ```javascript
206
+ const ENTRY_POINTS = [
207
+ "src/home/index.ts", // β†’ dist/home/index.js
208
+ "src/contact/form.ts", // β†’ dist/contact/form.js
209
+ "src/shared/utils.ts", // β†’ dist/shared/utils.js
210
+ ];
211
+ ```
212
+
213
+ ### Path Aliases
214
+
215
+ Use clean imports with pre-configured aliases:
216
+
217
+ ```typescript
218
+ // ❌ Avoid relative paths
219
+ import { helper } from "../../utils/helper";
220
+
221
+ // βœ… Use clean path aliases
222
+ import { helper } from "$utils/helper";
223
+ ```
224
+
225
+ **Available aliases:**
226
+
227
+ - `$utils/*` β†’ `src/utils/*`
228
+
229
+ Add more in `tsconfig.json`:
230
+
231
+ ```json
232
+ {
233
+ "compilerOptions": {
234
+ "paths": {
235
+ "$utils/*": ["src/utils/*"],
236
+ "$components/*": ["src/components/*"],
237
+ "$types/*": ["src/types/*"]
238
+ }
239
+ }
240
+ }
241
+ ```
242
+
243
+ ## 🌐 Webflow Integration
244
+
245
+ ### Development Integration
246
+
247
+ For testing in Webflow during development:
248
+
249
+ 1. Start the dev server: `pnpm dev`
250
+ 2. Use the development URLs in Webflow:
251
+ ```html
252
+ <script defer src="http://localhost:3000/index.js"></script>
253
+ ```
254
+
255
+ ### Production Deployment
256
+
257
+ 1. **Build your project**
258
+
259
+ ```bash
260
+ pnpm build
261
+ ```
262
+
263
+ 2. **Upload to your CDN**
264
+ Upload files from the `dist/` directory to your preferred CDN (Cloudflare, AWS CloudFront, etc.)
265
+
266
+ 3. **Include in Webflow**
267
+ Run this to get the generated cdn links with the latest version available
268
+ ```bash
269
+ pnpm cdn
270
+ ```
271
+
272
+ ### Best Practices for Webflow
273
+
274
+ - **Use `defer`** for non-critical scripts
275
+ - **Minimize HTTP requests** by bundling related functionality
276
+ - **Test thoroughly** across different Webflow templates
277
+ - **Use semantic versioning** for cache busting
278
+
279
+ ## 🀝 Contributing
280
+
281
+ We welcome contributions! Please follow these guidelines:
282
+
283
+ 1. **Fork the repository**
284
+ 2. **Create a feature branch**
285
+ ```bash
286
+ git checkout -b feature/amazing-feature
287
+ ```
288
+ 3. **Make your changes** following our code standards
289
+ 4. **Run quality checks**
290
+ ```bash
291
+ pnpm test && pnpm lint && pnpm check
292
+ ```
293
+ 5. **Add a changeset**
294
+ ```bash
295
+ pnpm changeset
296
+ ```
297
+ 6. **Commit with conventional commits**
298
+ ```bash
299
+ git commit -m "feat: add amazing feature"
300
+ ```
301
+ 7. **Push and create a Pull Request**
302
+
303
+ ### Commit Convention
304
+
305
+ We follow [Conventional Commits](https://www.conventionalcommits.org/):
306
+
307
+ - `feat:` New features
308
+ - `fix:` Bug fixes
309
+ - `docs:` Documentation changes
310
+ - `style:` Code style changes
311
+ - `refactor:` Code refactoring
312
+ - `test:` Test additions or changes
313
+ - `chore:` Maintenance tasks
314
+
315
+ ## πŸ“Š Performance Tips
316
+
317
+ - **Bundle analysis**: Use esbuild's metafile option for bundle analysis
318
+ - **Code splitting**: Consider splitting large applications into multiple entry points
319
+ - **Tree shaking**: Write ES modules to enable automatic dead code elimination
320
+ - **Compression**: Enable gzip/brotli compression on your CDN
321
+
322
+ ## πŸ› Troubleshooting
323
+
324
+ ### Common Issues
325
+
326
+ **Build failures:**
327
+
328
+ ```bash
329
+ # Clear node_modules and reinstall
330
+ rm -rf node_modules pnpm-lock.yaml
331
+ pnpm install
332
+ ```
333
+
334
+ **TypeScript errors:**
335
+
336
+ ```bash
337
+ # Check your tsconfig.json configuration
338
+ pnpm check
339
+ ```
340
+
341
+ **Live reload not working:**
342
+
343
+ - Ensure port 3000 is available
344
+ - Check browser console for WebSocket connection errors
345
+ - Verify firewall settings
346
+
347
+ ## πŸ“„ License
348
+
349
+ This project is licensed under the [ISC License](https://opensource.org/licenses/ISC).
350
+
351
+ ---
352
+
353
+ <div align="center">
354
+ <sub>Built with ❀️ by the cool webflow guys at Fynd</sub>
355
+ </div>
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ (() => {
3
+ // bin/live-reload.js
4
+ new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
5
+ "change",
6
+ () => location.reload()
7
+ );
8
+
9
+ // src/utils/sample.ts
10
+ function logMessage(message) {
11
+ console.log("Logged message:", message);
12
+ }
13
+
14
+ // src/index.ts
15
+ logMessage("use this for webflow projects by fynd webflow team");
16
+ })();
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../bin/live-reload.js", "../src/utils/sample.ts", "../src/index.ts"],
4
+ "sourcesContent": ["new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n);\n", "export function logMessage(message: string): void {\n console.log(\"Logged message:\", message);\n}\n", "import { logMessage } from \"$utils/sample\";\nlogMessage(\"use this for webflow projects by fynd webflow team\");\n"],
5
+ "mappings": ";;;AAAA,MAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,IAAiB;AAAA,IAAU,MACpE,SAAS,OAAO;AAAA,EAClB;;;ACFO,WAAS,WAAW,SAAuB;AAChD,YAAQ,IAAI,mBAAmB,OAAO;AAAA,EACxC;;;ACDA,aAAW,oDAAoD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ (() => {
3
+ // bin/live-reload.js
4
+ new EventSource(`${"http://localhost:3000"}/esbuild`).addEventListener(
5
+ "change",
6
+ () => location.reload()
7
+ );
8
+
9
+ // src/sample/test.ts
10
+ console.log("%csrc/cdn/test.ts:");
11
+ })();
12
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../bin/live-reload.js", "../../src/sample/test.ts"],
4
+ "sourcesContent": ["new EventSource(`${SERVE_ORIGIN}/esbuild`).addEventListener(\"change\", () =>\n location.reload()\n);\n", "console.log(\"%csrc/cdn/test.ts:\");\n"],
5
+ "mappings": ";;;AAAA,MAAI,YAAY,GAAG,uBAAY,UAAU,EAAE;AAAA,IAAiB;AAAA,IAAU,MACpE,SAAS,OAAO;AAAA,EAClB;;;ACFA,UAAQ,IAAI,oBAAoB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,5 @@
1
+ /* src/styles/global.css */
2
+ [fynd-webflow] {
3
+ color: red;
4
+ }
5
+ /*# sourceMappingURL=global.css.map */
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/styles/global.css"],
4
+ "sourcesContent": ["[fynd-webflow]{\n color:red\n}"],
5
+ "mappings": ";AAAA,CAAC;AACG,SAAM;AACV;",
6
+ "names": []
7
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@fynd-design-engineering/fynd-one-v2",
3
+ "version": "1.0.1",
4
+ "description": "Updated CDN for fynd.com",
5
+ "homepage": "https://github.com/Fynd-Design-Engineering/Fynd-Utils/blob/main/README.md",
6
+ "license": "ISC",
7
+ "keywords": [],
8
+ "author": {
9
+ "name": "Fynd Design Engineering",
10
+ "url": "https://www.fynd.design/"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/Fynd-Design-Engineering/Fynd-Utils.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/Fynd-Design-Engineering/Fynd-Utils/issues"
18
+ },
19
+ "type": "module",
20
+ "main": "dist/index.ts",
21
+ "module": "dist/index.ts",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "devDependencies": {
29
+ "@changesets/cli": "^2.29.4",
30
+ "cross-env": "^7.0.3",
31
+ "esbuild": "^0.25.5"
32
+ },
33
+ "scripts": {
34
+ "dev": "cross-env NODE_ENV=development node ./bin/build.js",
35
+ "build": "cross-env NODE_ENV=production node ./bin/build.js",
36
+ "cdn": "node ./bin/cdn.js",
37
+ "lint": "eslint ./src && prettier --check ./src",
38
+ "lint:fix": "eslint ./src --fix",
39
+ "check": "tsc --noEmit",
40
+ "format": "prettier --write ./src",
41
+ "test": "playwright test",
42
+ "test:ui": "playwright test --ui",
43
+ "release": "changeset publish",
44
+ "update": "pnpm update -i -L -r"
45
+ }
46
+ }