This monorepo hots a suit of web applications that help the user understand, assess, measure, and commit to Service Levels (SLI, SLO, SLA).
The code base is quite opinionated.
- It does not use any compiler or transpiler.
- It uses Vue@3 using a thin JavaScript layer in
./lib/component-loader.jswhich is responsible for loading the template, style, and functionality of the component using separate.html,.css, and.jsfiles. - NEVER create
.vuefiles. ALWAYS use the custom component pattern (3 separate files). - For tests, it uses the native test framework that is available in Node.js@22
Although this application has no compilation process, it needs some packages from NPM.
- We use standard NPM
package.jsonto define the dependencies. - We use
vendepsto bundle each dependency into a single ESM file in thedependencies/directory. Per-dependency config (custom entry points, named exports, esbuilddefineflags) lives under the"vendeps"key inpackage.json. - Run
npm run buildornpx vendepsto regenerate the bundles. They are also regenerated automatically onnpm installvia thepostinstallscript. - The rest of the application imports those modules from
dependencies/package-name.js. - This has the added benefit that the application is self-contained and does not require any external CDN and since the dependencies are checked in to the repo, it is safer from supply chain attacks.
- This app is served using a simple HTTP server that is started using the VS Code extension
Live Server(ritwickdey.liveserverwhich is supposed to be installed in the user's VS Code). - By default,
Live Serverstarts the server on port 5500 but if that port is already in use, it will try the next available port (e.g. 5501, 5502, etc.). - Do not use
python -m http.serveror any other HTTP server. Only useLive Server. - Since there's no build step, the app is served directly from the source code.
Formatting uses the following rules:
- Indentation: 4 spaces
- No semicolon
- Use single quote
'for strings - Use dangling comma when applicable
- No line should be longer than 120 characters
- Use JSDoc as much as possible
- The application uses a bespoke styling library located in
css/directory. - The branding variables (fonts, colors, border thickness, gap, etc.) are all defined in
css/variables.css. css/inputs.cssis the central place for styling all input elements across the app.- Component-specific styles are in
components/component-name.css. - Do not hard code values like
1px,white, or0.5emin the component CSS files. Use CSS variables defined incss/variables.cssfor consistency (colors, spacing, etc.). - Use the latest CSS features including CSS nested rules.
- Avoid using absolute values (like
px) directly in CSS. Always prefer using the defined CSS variables (e.g.,var(--gap),var(--bthick)).- Use
var(--gap...)for margins and paddings. - Use
var(--bthick...)for border widths.
- Use
- Skip flattery and praising my question with sentences like "That's a very insightful question" or "What an excellent observation". - Get to the point as quick as possible with as few words as possible.
- Be honest and challenge my assumptions. Be frank and to the point.
- Please don't modify the code directly unless explicitly instructed to.
- Teach me the concepts and let me figure out how to use them in the code as I see fit.
- Focus on principals, teaching, and learning instead of solving the immediate problem at hand.
- When referring to new concepts, make sure to include links to references like MDN (mozilla developer network), RFCs, or even StackOverflow.
- Don't make up stuff. Say "I don't know" if you are not sure.
- Most engineering questions depend on many factors and are the result of trade-offs. Please ask clarifying questions before answering my questions. If there are alternatives with cons and pros, mention them.