Coder Social home page Coder Social logo

michalkvasnicak / spust Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 635 KB

Quickly bootstrap universal javascript application. No configuration needed.

License: MIT License

JavaScript 99.85% Shell 0.15%
javascript bundler universal-javascript create-react-app nextjs webpack

spust's Introduction

Hi there 👋

I'm Michal Kvasničák a full stack engineer from 🇸🇰. I ❤️ React, GraphQL, Node.js, Typescript...

I know this README is boring, what'd you like to know? Ask me anything!

spust's People

Contributors

michalkvasnicak avatar

Stargazers

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

Watchers

 avatar  avatar

spust's Issues

Strip /static from ASSETS_PATH

Because we are using /static/(js|css|media)/** so we should only point to client bundle directory and make server side middleware for serving static files resolve whole path to assets.

Fix killing previous server

Sometimes it seems that spust can't manage previous server instance (probably it loses a reference to child process). In this case just keep all references and kill all server process.

For example spust will fail starting a new server with message that another process is listening on given port.

Kill server process after timeout

Sometimes when you send SIGINT, SIGTERM to the process, it can "postpone" termination because of a reference that keeps process alive. We should kill the process if it isn't terminated in 5 seconds for example.

This is causing indefinite compilation, because compiler's after-emit event won't be resolved in async because it is waiting for a server process to terminate.

Run server code in isolated process

Somehow replace eval with a process. Then we just kill previous process and then spawn a new process.

If new process fails, then respawn previous working process.

We have only source codes of new and previous server bundles available.

This should solve edge cases e.g. when you use mongoose somehow it is keeping same instance of server bundle running no matter how many times you compile server bundle with updates.

I think that it'll slow down server spawning/swapping. But it is better to have consistency than speed.

Add serve command

This will be only for a production build serving.

  1. it checks if application is built (checking bundle/server/server.js
  • it runs build if application is not compiled for a production
  1. it runs node bundle/server/server.js

Command should warn a user that he should protect application from failing using supervisor, forever, etc

Document .env files support

Spust already supports .env and .env.local files. Each of the files is optional. They has to be in a root directory of a project.

If user wants to use them they work as following:

  1. file .env is loaded and parsed to variable (it is not assigned to process.env.* so it is not available in a configuration for example, see the last point)
  2. file .env.local is loaded and parsed to a variable, override previous values for intersected keys from .env file.
  3. all variables are available in your build as process.env.{name of variable} but they aren't available outside of the build. For example, you can't access them in spust.config.js. They are just interpolated using webpack.DefinePlugin()

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.