Coder Social home page Coder Social logo

franciscokloganb / vitesse-enterprise Goto Github PK

View Code? Open in Web Editor NEW
42.0 3.0 7.0 1.76 MB

Home Page: vitesse-enterprise.vercel.app

License: MIT License

TypeScript 55.74% HTML 4.97% Vue 19.87% CSS 6.61% JavaScript 9.92% Shell 1.30% Dockerfile 1.59%

vitesse-enterprise's Introduction

Vitesse Enterprise Starter

Vitesse - Opinionated Vite starter template with rigorous linting


Features

*CLI only. VSCode plugin does not support configuration files.

Pre-packed

UI Frameworks

  • UnoCSS - The instant on-demand atomic CSS engine.

Icons

Plugins

Coding Style

Dev tools

Developer Experience

  • Alias @ to <rootDir>
  • Alias ~ to <rootDir>/src a.k.a. <srcDir>
  • Predefined and fully typed global variables:
    • VITE_APP_VERSION is read from package.json version at build time
    • VITE_APP_BUILD_EPOCH is populated as new Date().getTime() at build time

Variations

This template is strongly opinionated with my personal preferences and feature sets. It is a fork of the original template created by @antfu and also takes inspiration from vitesse-stackter made by @shamscorner.

For an up-to-date list of official and community contributions to the vitesse ecosystem, we recommend checking the official repository's variations section.

Try it now

GitHub Template

Create a repo from this template on GitHub.

Clone to local

If you prefer to do it manually with the cleaner git history

npx degit FranciscoKloganB/vitesse-enterprise my-vitesse-enterprise-app
cd my-vitesse-enterprise-app
pnpm i # If you don't have pnpm installed, run: npm install -g pnpm

Checklist

When you use this template, try follow the checklist to update your info properly

  • Remove .github/funding.yml file which contains the funding info
  • Remove vercel.json or netlify.yml depending on your deployment provider.
  • Rename name field in package.json
  • Rename projectId field in cypress.json
  • Change the author name in LICENSE
  • Change the title in App.vue
  • Change the hostname in vite.config.ts
  • Change the favicon in public
  • Clean up the READMEs and remove routes
  • Bump project dependencies (e.g.: dependabot) - We update them on a best-effort-basis, every now and then.

Usage

Development

Run and visit http://localhost:4000

pnpm dev

Code formatting and linting

pnpm lint

Testing

pnpm run:test

Build for production

# Alias for "run-s prebuild 'build:prod:ssg'"
pnpm run:build
# Other builds
# Ouputs files to dist folder. Ready to be served in SPA mode.
pnpm build:prod
# Outputs files to dist folder which passed through the Vite SSG pipeline. Ready to be served.
pnpm build:prod:ssg

Previewing

# Runs project locally with files from dist folder
pnpm run:preview
# Can also run locally with HTTPS (may require sudo) - requires available dist/ folder
pnpm preview:https

Separation of Concerns

  • Create separate folder for each module and place them under /src folder
  • The following folders are auto imported within each module
    • components/
    • modules/
    • pages/
    • stores/
  • Place all the layouts in the core/layouts folder
  • Place all the custom styles in the core/assets/styles folder and import them into main.{css,scss}

Deploy on Netlify

Go to Netlify and select your clone, OK along the way, and your App will be live in a minute.

Docker Production Build

First, build the vitesse image by opening the terminal in the project's root directory.

# One of either
DOCKER_BUILDKIT=1 docker build . -t vitesse:latest
# Docker Buildx is a CLI plugin to extend docker command and support BuildKit without the env var.
docker buildx build . -t vitesse:latest

Run the image and specify port mapping with the -p flag.

docker run --rm -it -p 8080:80 vitesse:latest

Deploy on Vercel

Vercel has some short-commings regarding pnpm based projects. After creating and importing the project on Vercel dashboard you will need to navigate to the project settings and override the Build Command and Install Command respectively, with the following bash commands:

  # Build Command
  npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run:build
  # Install Command
  npm i -g pnpm && pnpm -i

Alternatevely, for zero configuration on import you need to alter package.json scripts to have a build and install entries with the commands above.

Why

On top of what was mentioned by Anthony Fu in the original post, working in conjunction with others often requires strict styling rules. Creating a seamless developer experience across VSCode, CLI and CI/CD consumes time. Vue, Vite and, Vitesse, are amazing tools for web developmen and are now my go to choices for development. To avoid repeating myself over and over again for to get this configurations going, I decided to fork Vitesse repository and create a baseline project for my own (or other people) use, enabling us to be vite. Pun intended.

Feedback

If you notice any bug, inconsistency or change for improvement, feel free to either create an issue so that I may try to fix it later or to propose a pull request with the changes.

vitesse-enterprise's People

Contributors

8bu avatar binaryfire avatar dayepython avatar dependabot[bot] avatar franciscokloganb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vitesse-enterprise's Issues

issue: package.json build for production misleading

Description

As a user
I want to be reassured that my package.json#build script is also a production build and that package.json#build:prod is an alternative that adds compilation for server side rendering
so I can use either one without bias or fear of loss of performance.

Acceptance criteria

Scenario user reads package.json
Given a set of scripts
Then the build method should be named build:prod
And the build:prod method should be named build:prod:ssr

Additional notes

Files that depend on this scripts, e.g.: README, CI/CD files and, others, might need to be updated.

Add unplug-vue-macros and other updates from vitesse

Thanks for sharing this template. We're finding it very helpful.

There have been a couple of updates to vitesse in the last year. Would you be able to add them?

I think that's all the changes... I may have missed something though

404 not found when using base prefix

Context (Environment)

I set a base url prefix in vite.config.ts

export default defineConfig({
  base: '/test/',
  ...
})

I ran pnpm dev but the page http://localhost:4000/test/ is a 404 not found
I can't access to the page until I hard reload (cmd + maj + R) the page.
Same for hot-reload, after each I'm redirecting to the 404 page, and I have to hard reload.

Add folder aliases

Hey,

Well done on on setting up an enterprise structure; this is similar to how I build my projects too.

I see in your "nice to haves" you mentioned folder aliasing. You might want to consider Alias HQ (one of mine) to expand on this.

You set up your aliases once only in tsconfig.json then choose an integration for each toolchain, for example Vite:

import { defineConfig } from 'vite'
import hq from 'alias-hq'

export default defineConfig({
  resolve: {
    alias: hq.get('rollup')
  }
})

Anyway. Hope that's helpful.

Multiple builds / bundles

Great work @FranciscoKloganB!

I need to do 2 different builds for my current project (from the same codebase). Each build is just a different combination of modules. Do you have any suggestions on the best way to set that up?

Thanks in advance

bug: unable to run component tests in gitlab ci

Context (Environment)

When in Gitlab pipeline component-tests seem to initiate but then are stuck at the start of the process, eventually, timing out after 15 minutes. Consequently the pipeline is currently only executing e2e-tests.

Expected Behavior

It would be expected for Component tests to run smoothly on the GitLab CI/CD pipeline just as they do on GitHub Actions.

Current Behavior

Component tests do not execute. Tried multiple methods and none seemed to work.

Steps to Reproduce

  1. Import this public repository onto your GitLab account
  2. Go to the project's dashboard and open the new project
  3. On the project menu, select CI/CD > Editor, make and commit a change
  4. See how the pipeline gets stuck when trying to run component tests

Possible Solution

Do not know any but the Yarn implementation seen in this repository seems to work: https://github.com/Uninen/vite-ts-tailwind-starter/blob/main/.gitlab-ci.yml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.