{"id":15296070,"url":"https://github.com/michalkvasnicak/spust","last_synced_at":"2025-06-30T22:34:39.861Z","repository":{"id":57189029,"uuid":"93333366","full_name":"michalkvasnicak/spust","owner":"michalkvasnicak","description":"Quickly bootstrap universal javascript application. No configuration needed.","archived":false,"fork":false,"pushed_at":"2017-10-02T12:10:48.000Z","size":635,"stargazers_count":11,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-14T14:34:32.760Z","etag":null,"topics":["bundler","create-react-app","javascript","nextjs","universal-javascript","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michalkvasnicak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-04T18:28:06.000Z","updated_at":"2024-04-12T19:01:33.000Z","dependencies_parsed_at":"2022-09-15T03:53:30.101Z","dependency_job_id":null,"html_url":"https://github.com/michalkvasnicak/spust","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/michalkvasnicak/spust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fspust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fspust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fspust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fspust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michalkvasnicak","download_url":"https://codeload.github.com/michalkvasnicak/spust/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michalkvasnicak%2Fspust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259843215,"owners_count":22920298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundler","create-react-app","javascript","nextjs","universal-javascript","webpack"],"created_at":"2024-09-30T18:09:12.495Z","updated_at":"2025-06-30T22:34:39.824Z","avatar_url":"https://github.com/michalkvasnicak.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spust\n\n[![npm](https://img.shields.io/npm/v/spust.svg)](https://www.npmjs.com/package/spust)\n[![CircleCI](https://circleci.com/gh/michalkvasnicak/spust.svg?style=svg\u0026circle-token=39f82c45c86ac3cd0b5a94f62a1c41919edd86ec)](https://circleci.com/gh/michalkvasnicak/spust)\n\n\u003e 🚀 Quickly bootstrap universal javascript application.\n\n**⚠️ Feel free to report bugs, open PRs, etc...**\n\n* [Installation](#installation)\n* [Requirements](#requirements)\n* [Usage](#usage)\n* [Build](#build)\n* [Local development](#local-development)\n* [Test](#test)\n* [Customizing configuration](#customizing-configuration)\n* [Service worker and offline support](#service-worker-and-offline-support)\n* [Use babili for the client side minification](#use-babili-for-the-client-side-minification)\n* [react-loadable v4 support](#react-loadable-v4-support)\n* [styled-components v2 support](#styled-components-v2-support)\n* [Examples](#examples)\n\n## Installation\n\n```sh\nyarn add spust\n```\n\n## Requirements\n\nYou have to set up directory structure like this:\n\n```\nsrc/\n  client/\n    index.js\n  server/\n    index.js\n```\n\nYour `src/server/index.js` has to export server listener so `spust` can manage it during the development process.\n\n### Example of `server/index.js`\n\n```js\nimport { createServer } from 'http';\n\nconst server = createServer((res) =\u003e {\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('OK');\n});\n\n// process.env.PORT is provided using webpack.DefinePlugin()\nserver.listen(process.env.PORT);\n\nexport default server;\n```\n\n## Usage\n\n```sh\n# builds bundle for production environment\nyarn spust build\n# or if you want stats for your bundles so you can analyze them using webpack analyse\nyarn spust build -- --stats\n```\n\n```sh\n# starts webpack dev server and your backend server and opens browser automatically\nyarn spust start\n```\n\n```sh\n# starts jest in watch mode unless is called with --coverage or process.env.CI is set\nyarn spust test\n```\n\n## Build\n\nBuild an application for production.\n\n```sh\nyarn spust build\n```\n\nWill build project with `src` directory. Make sure you have `src/server/index.js` and `src/client/index.js` files.\n\n```sh\nyarn spust build -- --stats\n```\n\nWill output `client.stats.json` and `server.stats.json` to your current working directory. You can analyze them using [webpack's analyse tool](https://webpack.github.io/analyse/).\n\n## Local development\n\nStarts the development server and automatically opens browser so you can develop right away.\n\n```sh\nyarn spust start\n```\n\nWill start the webpack dev server and your backend server.\n\n## Test\n\n```sh\nyarn spust test\n```\n\nRuns tests in interactive mode. See [create-react-app documentation](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#running-tests) for this as this is the same.\n\n## Customizing configuration\n\nYou can provide your own `spust.config.js` which exports a function receiving webpack configuration and settings.\n\n```js\n// example, add node_modules to vendor entry\nconst webpack = require('webpack');\n\ntype Settings = {\n  env: 'production' | 'development',\n  // server manager field is available only in local dev mode\n  // and can be null or instance of ServerManager\n  // see src/ServerManager for a whole type\n  serverManager?: ?ServerManager,\n  srcDir: string,\n  workDir: string,\n  useBabili: boolean,\n}\n\ntype Configuration = {\n  client: WebpackConfig,\n  server: WebpackConfig,\n}\n\nmodule.exports = (configuration: Configuration, settings: Settings): Configuration =\u003e {\n  configuration.client.loaders.push(\n    new webpack.optimize.CommonsChunkPlugin({\n      name: 'vendor',\n      minChunks: module =\u003e\n        module.resource \u0026\u0026\n        module.resource.indexOf('node_modules') !== -1,\n    })\n  );\n\n  return configuration;\n}\n```\n\n# Service worker and offline support\n\nSpust supports service workers using [offline-plugin for webpack](https://github.com/NekR/offline-plugin).\n\nIt is preconfigured just install it because it is `peerDependency`. In order to use it please install `offline-plugin` package in your project and then add the line `require('offline-plugin/runtime').install();` to the beginning of your `src/client/index.js` file.\n\nFor more information see [offline-plugin's setup section](https://github.com/NekR/offline-plugin#setup).\n\n# Use babili for the client side minification\n\nIf you want to minify client side bundle using [babili](https://github.com/babel/babili) instead of [uglifyjs](https://github.com/mishoo/UglifyJS) *(because uglifyjs doesn't support es6 features)* you can enable it using `SPUST_USE_BABILI=1` env variable, for instance `SPUST_USE_BABILI=1 yarn spust build`.\n\nThis will change settings of `babel-preset-env` to support all [browsers with coverage \u003e 2%](http://browserl.ist/?q=%3E+2%25).\n\n# react-loadable v4 support\n\nIn order to use [react-loadable](https://github.com/thejameskyle/react-loadable) you have to install `react-loadable, import-inspector and babel-plugin-import-inspector`. Babel plugin will be used automatically.\n\n# styled-components v2 support\n\nIn order to use [styled-components v2](https://www.styled-components.com/docs) you have to install `styled-components` and `babel-plugin-styled-components`. Babel plugin will be used automatically. Then just follow documentation on [styled-components server side rendering](https://www.styled-components.com/docs/advanced#server-side-rendering).\n\n# Examples\n\n* [See all examples in separate repository](https://github.com/michalkvasnicak/spust-examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalkvasnicak%2Fspust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichalkvasnicak%2Fspust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichalkvasnicak%2Fspust/lists"}