Skip to content

Commit e781952

Browse files
eamonnfahertyclaude
andcommitted
Add Python and TypeScript SDK docs with syntax highlighting and copy buttons
- Add sdks.html overview page with language cards (Python available, TypeScript available, others coming soon) - Add sdk-python.html with quick start first, drop-in replacement section, pytest fixtures, helpers, mocking, chaos, IAM, log capture - Add sdk-typescript.html with Jest quick start, AWS SDK v3 drop-in replacement, full API reference - Add lws.js for auto language detection, Prism syntax highlighting, and click-to-copy on all code blocks - Update nav across all pages to include SDKs link - Update index.html hero to lead with SDK install, feature Python and TypeScript SDK cards - Fix Python package name to local-web-services-python-sdk (was local-web-services-testing) - Fix TypeScript package name to local-web-services-typescript-sdk - Add PyPI and npm links in page headers and footers - Add comparison --code CSS variant for side-by-side code examples Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 627a09a commit e781952

File tree

11 files changed

+1557
-14
lines changed

11 files changed

+1557
-14
lines changed

chaos.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>Chaos Engineering - Local Web Services</title>
77
<meta name="description" content="Inject failures into AWS service emulations and external mock servers. Test error rates, latency, timeouts, and connection resets before production.">
88
<link rel="stylesheet" href="style.css">
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
910
</head>
1011
<body>
1112

@@ -14,6 +15,7 @@
1415
<a href="index.html" class="nav-logo">Local Web Services</a>
1516
<ul class="nav-links">
1617
<li><a href="getting-started.html">Get Started</a></li>
18+
<li><a href="sdks.html">SDKs</a></li>
1719
<li><a href="services.html">Cloud Emulation</a></li>
1820
<li><a href="mocking.html">Mocking Services</a></li>
1921
<li><a href="chaos.html" class="nav-active">Chaos Engineering</a></li>
@@ -329,5 +331,12 @@ <h3>Error Reporting</h3>
329331
</div>
330332
</footer>
331333

334+
335+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
336+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
337+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
338+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
339+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
340+
<script src="lws.js"></script>
332341
</body>
333342
</html>

cli.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>CLI Reference - Local Web Services</title>
77
<meta name="description" content="Complete command reference for the ldk and lws CLI tools.">
88
<link rel="stylesheet" href="style.css">
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
910
</head>
1011
<body>
1112

@@ -14,6 +15,7 @@
1415
<a href="index.html" class="nav-logo">Local Web Services</a>
1516
<ul class="nav-links">
1617
<li><a href="getting-started.html">Get Started</a></li>
18+
<li><a href="sdks.html">SDKs</a></li>
1719
<li><a href="services.html">Cloud Emulation</a></li>
1820
<li><a href="mocking.html">Mocking Services</a></li>
1921
<li><a href="chaos.html">Chaos Engineering</a></li>
@@ -392,5 +394,12 @@ <h4>lws iam-auth</h4>
392394
</div>
393395
</footer>
394396

397+
398+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
399+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
400+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
401+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
402+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
403+
<script src="lws.js"></script>
395404
</body>
396405
</html>

getting-started.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>Getting Started - Local Web Services</title>
77
<meta name="description" content="Install Local Web Services and get running with AWS CDK or Terraform in under five minutes.">
88
<link rel="stylesheet" href="style.css">
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
910
</head>
1011
<body>
1112

@@ -14,6 +15,7 @@
1415
<a href="index.html" class="nav-logo">Local Web Services</a>
1516
<ul class="nav-links">
1617
<li><a href="getting-started.html" class="nav-active">Get Started</a></li>
18+
<li><a href="sdks.html">SDKs</a></li>
1719
<li><a href="services.html">Cloud Emulation</a></li>
1820
<li><a href="mocking.html">Mocking Services</a></li>
1921
<li><a href="chaos.html">Chaos Engineering</a></li>
@@ -231,5 +233,12 @@ <h3>What Gets Added to CLAUDE.md</h3>
231233
</div>
232234
</footer>
233235

236+
237+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
238+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
239+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
240+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
241+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
242+
<script src="lws.js"></script>
234243
</body>
235244
</html>

index.html

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>Local Web Services - The Fastest Feedback Loop for Cloud-Native Development</title>
77
<meta name="description" content="Local Web Services reads your AWS CDK or Terraform project and recreates your application locally. Build, test, and debug cloud-native AWS apps without deploying — no credentials, no cost, no waiting.">
88
<link rel="stylesheet" href="style.css">
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
910
</head>
1011
<body>
1112

@@ -14,6 +15,7 @@
1415
<a href="index.html" class="nav-logo">Local Web Services</a>
1516
<ul class="nav-links">
1617
<li><a href="getting-started.html">Get Started</a></li>
18+
<li><a href="sdks.html">SDKs</a></li>
1719
<li><a href="services.html">Cloud Emulation</a></li>
1820
<li><a href="mocking.html">Mocking Services</a></li>
1921
<li><a href="chaos.html">Chaos Engineering</a></li>
@@ -26,29 +28,34 @@
2628
<header class="hero">
2729
<div class="container">
2830
<h1>Local Web Services</h1>
29-
<p class="hero-subtitle">Run your AWS CDK and Terraform applications locally with ldk dev.<br>
30-
Interact with local services using lws.<br>
31+
<p class="hero-subtitle">Test AWS applications with realistic in-process local services using native language SDKs.<br>
32+
Or run <code>ldk dev</code> as a local development server for CDK and Terraform projects.<br>
3133
No credentials. No cost. No waiting.</p>
3234
<div class="hero-actions">
33-
<a href="getting-started.html" class="btn btn-primary">Get Started</a>
35+
<a href="sdks.html" class="btn btn-primary">Explore the SDKs</a>
3436
<a href="https://github.com/local-web-services/local-web-services" class="btn btn-secondary">View on GitHub</a>
3537
</div>
3638
<div class="hero-install">
37-
<code>uvx --from local-web-services ldk dev</code>
39+
<code>pip install local-web-services-python-sdk</code>
3840
</div>
3941
</div>
4042
</header>
4143

4244
<section class="section" id="what">
4345
<div class="container">
4446
<h2>What is Local Web Services?</h2>
45-
<p class="section-lead">Local Web Services is an open-source tool that reads your AWS CDK or Terraform project and recreates your entire application locally. It supports both CDK (via <code>cdk synth</code>) and Terraform (via <code>terraform apply</code>) with automatic project type detection. Two complementary CLI tools work together: <code>ldk</code> runs your infrastructure, and <code>lws</code> lets you interact with it.</p>
47+
<p class="section-lead">Local Web Services emulates AWS services locally for development and testing. Use the language SDKs for in-process pytest or unit testing, or run <code>ldk dev</code> to start a full local development server that reads your CDK or Terraform project and recreates your entire stack.</p>
4648

47-
<div class="feature-grid feature-grid--2col">
49+
<div class="feature-grid">
50+
<div class="feature-card">
51+
<div class="feature-icon"><img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/python/python-original.svg" alt="Python" width="40" height="40" style="vertical-align: middle;"></div>
52+
<h3>Python SDK</h3>
53+
<p>In-process AWS service testing for pytest. Start DynamoDB, SQS, S3 and more in background threads — no external process, no ports. Fluent APIs for mocking, chaos, and IAM.</p>
54+
</div>
4855
<div class="feature-card">
4956
<div class="feature-icon">&#9889;</div>
5057
<h3>ldk</h3>
51-
<p>The development server. Parses your CDK or Terraform project and spins up local providers for every AWS service you use — DynamoDB, Lambda, S3, SQS, and more. Your entire stack runs locally.</p>
58+
<p>The local development server. Parses your CDK or Terraform project and spins up local providers for every AWS service you use — DynamoDB, Lambda, S3, SQS, and more. Hot reloading included.</p>
5259
</div>
5360
<div class="feature-card">
5461
<div class="feature-icon">&#128295;</div>
@@ -235,24 +242,32 @@ <h3>Apply</h3>
235242

236243
<section class="section section-alt">
237244
<div class="container">
238-
<h2>Explore the Docs</h2>
239-
<p class="section-lead">Follow the developer journey: install, set up services, mock external dependencies, and test failure handling.</p>
245+
<h2>Build with Local Web Services</h2>
246+
<p class="section-lead">From in-process SDK testing to full local development servers — choose your path.</p>
240247

241-
<div class="journey-grid">
248+
<div class="journey-grid journey-grid--5">
249+
<a href="sdks.html" class="feature-card" style="text-decoration: none;">
250+
<div class="feature-icon" style="display:flex;gap:6px;justify-content:center;align-items:center;">
251+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/python/python-original.svg" alt="Python" width="32" height="32">
252+
<img src="https://cdn.jsdelivr.net/gh/devicons/devicon@latest/icons/typescript/typescript-original.svg" alt="TypeScript" width="32" height="32">
253+
</div>
254+
<h3>SDKs</h3>
255+
<p>In-process testing with native language SDKs. Python and TypeScript available now.</p>
256+
</a>
242257
<a href="getting-started.html" class="feature-card" style="text-decoration: none;">
243258
<div class="feature-icon">&#128640;</div>
244259
<h3>Get Started</h3>
245-
<p>Install prerequisites, clone a sample project, run your first local stack, and set up Claude Code integration.</p>
260+
<p>Install prerequisites, run your first local stack, and set up Claude Code integration.</p>
246261
</a>
247262
<a href="services.html" class="feature-card" style="text-decoration: none;">
248263
<div class="feature-icon">&#9729;&#65039;</div>
249264
<h3>Cloud Emulation</h3>
250-
<p>Browse all 25 supported AWS service emulations with full operation lists and CDK construct mappings.</p>
265+
<p>25 supported AWS service emulations with full operation lists and CDK construct mappings.</p>
251266
</a>
252267
<a href="mocking.html" class="feature-card" style="text-decoration: none;">
253268
<div class="feature-icon">&#127917;</div>
254269
<h3>Mock Servers</h3>
255-
<p>Create mock HTTP, GraphQL, and gRPC servers for external APIs with template variables and OpenAPI import.</p>
270+
<p>Mock AWS operations and external APIs with HTTP, GraphQL, and gRPC mock servers.</p>
256271
</a>
257272
<a href="chaos.html" class="feature-card" style="text-decoration: none;">
258273
<div class="feature-icon">&#128165;</div>
@@ -281,5 +296,12 @@ <h3>Chaos Testing</h3>
281296
</div>
282297
</footer>
283298

299+
300+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
301+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
302+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
303+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
304+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
305+
<script src="lws.js"></script>
284306
</body>
285307
</html>

lws.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
(function () {
2+
'use strict';
3+
4+
function detectLanguage(text) {
5+
const t = text.trim();
6+
// TypeScript: TS-specific syntax
7+
if (/\b(interface |const |let |var |async |await |import\s+\{|from\s+'|LwsSession|session\.client<|\.assertItem|beforeAll|afterAll|beforeEach)\b/.test(t)) {
8+
return 'typescript';
9+
}
10+
// Python: typical Python keywords / lws SDK patterns
11+
if (/\b(def |import |from |class |@pytest|lws_session|session\.|pytest\.|lws_reset)\b/.test(t)) {
12+
return 'python';
13+
}
14+
// YAML: multiple "key: value" lines not starting with a shell command
15+
if (!/^(pip|uv|uvx|ldk|lws|git|docker|aws|npm|yarn|curl)\b/.test(t)) {
16+
const yamlLines = (t.match(/^\s*[\w-]+\s*:/gm) || []).length;
17+
if (yamlLines >= 2) return 'yaml';
18+
}
19+
// Default: bash / shell
20+
return 'bash';
21+
}
22+
23+
function copySVG() {
24+
return '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';
25+
}
26+
27+
function checkSVG() {
28+
return '<svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>';
29+
}
30+
31+
function copyText(text, btn) {
32+
var clean = text.replace(/\n$/, '');
33+
var succeed = function () {
34+
btn.innerHTML = checkSVG() + '<span>Copied!</span>';
35+
btn.classList.add('copy-btn--copied');
36+
setTimeout(function () {
37+
btn.innerHTML = copySVG() + '<span>Copy</span>';
38+
btn.classList.remove('copy-btn--copied');
39+
}, 2000);
40+
};
41+
if (navigator.clipboard) {
42+
navigator.clipboard.writeText(clean).then(succeed);
43+
} else {
44+
var ta = document.createElement('textarea');
45+
ta.value = clean;
46+
ta.style.position = 'fixed';
47+
ta.style.opacity = '0';
48+
document.body.appendChild(ta);
49+
ta.select();
50+
document.execCommand('copy');
51+
document.body.removeChild(ta);
52+
succeed();
53+
}
54+
}
55+
56+
document.addEventListener('DOMContentLoaded', function () {
57+
document.querySelectorAll('.code-block').forEach(function (block) {
58+
var code = block.querySelector('code');
59+
if (!code) return;
60+
61+
// Set language class for Prism
62+
if (!code.className.includes('language-')) {
63+
code.className = 'language-' + detectLanguage(code.textContent);
64+
}
65+
66+
// Wrap in <pre> so Prism can highlight it
67+
if (code.parentElement.tagName !== 'PRE') {
68+
var pre = document.createElement('pre');
69+
code.parentNode.replaceChild(pre, code);
70+
pre.appendChild(code);
71+
}
72+
73+
// Inject copy button
74+
var btn = document.createElement('button');
75+
btn.className = 'copy-btn';
76+
btn.setAttribute('aria-label', 'Copy code');
77+
btn.innerHTML = copySVG() + '<span>Copy</span>';
78+
btn.addEventListener('click', function () { copyText(code.textContent, btn); });
79+
block.appendChild(btn);
80+
});
81+
82+
// Run Prism after language classes are set
83+
if (window.Prism) {
84+
Prism.highlightAll();
85+
}
86+
});
87+
}());

mocking.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<title>Mocking Services - Local Web Services</title>
77
<meta name="description" content="Mock AWS service operations and external API dependencies. Override AWS responses at the operation level, or create mock HTTP/GraphQL/gRPC servers for third-party APIs.">
88
<link rel="stylesheet" href="style.css">
9+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-tomorrow.min.css">
910
</head>
1011
<body>
1112

@@ -14,6 +15,7 @@
1415
<a href="index.html" class="nav-logo">Local Web Services</a>
1516
<ul class="nav-links">
1617
<li><a href="getting-started.html">Get Started</a></li>
18+
<li><a href="sdks.html">SDKs</a></li>
1719
<li><a href="services.html">Cloud Emulation</a></li>
1820
<li><a href="mocking.html" class="nav-active">Mocking Services</a></li>
1921
<li><a href="chaos.html">Chaos Engineering</a></li>
@@ -448,5 +450,12 @@ <h3>Validate Coverage</h3>
448450
</div>
449451
</footer>
450452

453+
454+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"></script>
455+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-clike.min.js"></script>
456+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-bash.min.js"></script>
457+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-python.min.js"></script>
458+
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-yaml.min.js"></script>
459+
<script src="lws.js"></script>
451460
</body>
452461
</html>

0 commit comments

Comments
 (0)