SlamaFR / BULB

Beautiful Urban Line Builder
https://bulb.slama.io
MIT License
35 stars 7 forks source link
editor map public transport

🌘 Nightrunner

Nightrunner is a simple, fast, and ready to use starter template for Nuxt 3. It features the necessary tools to get you started immediately on your next project.

Summary

πŸš€ Quick start

  1. Get pnpm.

    Nightrunner uses pnpm as its package manager. You can install it with the following command:

    npm install -g pnpm
  2. Create a Nightrunner project.

    Use the Nightrunner template to create a new project:

    npx degit "notKamui/Nightrunner" my-project
  3. Replace all the occurrences of Nightrunner with your project's name.

    This includes both Nightrunner and nightrunner. Also, DO NOT FORGET TO UPDATE THE LICENSE FILE, otherwise, I'll be in legal possession of your project, which isn't good for you.

  4. Start developing.

    Install the dependencies and run the development server:

    cd my-project
    pnpm install
    pnpm dev

    You may also want to check if there are any updates to the dependencies. Do so by running taze, but note that breakages may occur.

    pnpm taze
  5. Enjoy your new Nightrunner project!

    Your site is now running at http://localhost:3000!

✨ Features

Nightrunner uses the following technologies:

For more information on each of these, please refer to their respective documentation.

πŸ€” What's included

πŸ› οΈ Configurations

For each of the included technologies, Nightrunner provides a basic setup that you can use as a starting point for your project.

Nightrunner uses Nuxt 3 in SSR Mode by default, but you can use full static mode by uncommenting the marked line in the nuxt.config.ts file.

Moreover, a default UnoCSS configuration is provided in the unocss.config.ts file.

Along with it is provided a dependency to use UnoCSS as an icon provider. The icons are served by Iconify. The default icon set is Tabler Icons, but you can change it to whatever you want. For that, remove the @iconify-json/tabler dependency and install the one you want. The naming scheme is generally the same, that is to say @iconify-json/<icon-set-name>. If you want a preview of all the icons available, check out icones.js.org.

The default configuration for ESLint is based on Antfu's configuration (see @antfu/eslint-config)

This project uses Vue Macros, and in particular, the reactivity transform API and short v-model syntax (v-model becomes ::). You can configure those in both the nuxt.config.ts and tsconfig.json files.

Pinia stores are stored in the stores directory, and are automatically registered for auto-import.

🌐 Localization

Nightrunner uses Nuxt i18n for localization. The default language is the system's language, and English is the fallback, but it can be changed. You can add as many locales as you want by creating a file in the locales directory, following the same scheme as the already provided files.

To interact with it, there are several files and composables available to you:

For more information on Nuxt i18n, please refer to the documentation.

πŸ–ŒοΈ Theme: Light and Dark

Nightrunner provides a basic theme system, with a light and a dark theme. The theme can be interacted with thanks to the useDark composable, which provides a ref to the current theme, a boolean ref to know if the current theme is dark, the user's preferred theme, and a function to toggle the theme. The current theme is stored and persisted in locale storage. When the ref is updated, the locale storage is updated as well.

Along with the locale storage, the theme is also stored as a class on the html element. This allows you to use CSS variables to style your app, and have the theme change automatically when the user changes it. In particular, this works well with UnoCSS (or Tailwind-like CSS frameworks) with the dark: pseudo-class prefix.

πŸ§‘β€πŸ’» Development

βš™οΈ Setup

Prefer VSCode to work using this template. You can use whatever IDE you want, but you will have to configure it yourself, and won't be able to have access to the recommended extensions.

When opening VSCode, you will be prompted to install recommended extensions. Do so and reload.

On your first reload, you will be prompted to disabled some extensions (such as built-in TypeScript language features). Do so and reload.

Install pnpm globally if it is not already installed:

npm install -g pnpm

Install dependencies:

pnpm i

πŸƒβ€β™‚οΈ Running in development mode

pnpm dev

πŸ’ͺ Building for production

In SSR Mode:

pnpm build

The output will be generated in the .output/ directory.

In SPA Mode:

pnpm generate

The static output will be generated in the .output/public/ directory.

πŸ“ Other scripts

pnpm nuxi add <template> <name> # Add a new page, component, store, composable, etc.
pnpm taze # Update dependencies
pnpm lint --fix # Lint the code and fix errors, following the ESLint configuration

TODO