stackblitz / starters

StackBlitz Starter Project
MIT License
37 stars 16 forks source link

refactor: remove unneeded .stackblitzrc, update template dependencies #17

Closed fvsch closed 1 year ago

fvsch commented 1 year ago

This PR harmonizes what basic config files we find in a starter template.

What's in package.json

Almost all starters have a package.json file. I've tried to harmonize those files to follow this pattern:

{
  "name": "{folder-name}-demo",
  "version": "0.0.0",
  "private": true,
  "scripts": { … },
  "dependencies": { … },
  "devDependencies": { … }
}

Some templates may not have "scripts" (most for some EngineBlock starters), some may not have "devDependencies".

Open questions:

  1. What should we use for the package name?
    • Should we include one at all?
    • Is the "{folder-name}-demo" pattern okay, or do we want to use “starter” or “template” instead of “demo” maybe?
    • Note that if we end up using a name that matches an existing package on npm, running npm info will show information for that package merged with info from the local package.json, which is quite strange, but maybe a very rare problem.
  2. Is the "version" even useful? I’m tempted to just drop it.

Removing all the .stackblitzrc files

All the .stackblitzrc files in WebContainer projects were spelling out defaults, such as { "installDependencies": true, startCommand: "npm run dev" }.

I removed them for the sake of readability, but if we want to include one with defaults in every WC starter template we could do that too.

Making sure every WC template has a .gitignore

For every WebContainer-based template, I made sure it had a .gitignore file that listed at least:

Harmonizing index.html files

Harmonizing base CSS styles

We had base style.css files which looked like:

h1, h2 {
  font-family: Lato;
}

That's not super useful, especially since the preview documents don't load the Lato fonts at all. (They used to, in EngineBlock projects, but we removed those fonts in early 2022 for performance reasons.)

Instead I'm proposing a very basic stylesheet looking like this:

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1rem;
  font-family: system-ui, sans-serif;
  color: black;
  background-color: white;
}

h1 {
  font-weight: 800;
  font-size: 1.5rem;
}
fvsch commented 1 year ago

I'd drop version as well, but I don't have strong feelings about that.

Dropped it. I agree that it's not useful for projects.

For the package name, I think the -starter makes a bit more sense

Changed from -demo suffix to -starter suffix.