{"id":19453272,"url":"https://github.com/gozenc/zen-react-scripts","last_synced_at":"2025-02-25T10:19:40.347Z","repository":{"id":63721929,"uuid":"480499765","full_name":"gozenc/zen-react-scripts","owner":"gozenc","description":"Webpack React builder and dev scripts constantly updated for package warnings, supports Typescript.","archived":false,"fork":false,"pushed_at":"2023-12-22T15:37:32.000Z","size":1543,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-24T19:09:16.184Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/gozenc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-11T18:18:39.000Z","updated_at":"2022-04-11T18:20:44.000Z","dependencies_parsed_at":"2023-11-15T22:43:19.487Z","dependency_job_id":"cfc96c35-0ada-4504-ac4c-814a43975ac2","html_url":"https://github.com/gozenc/zen-react-scripts","commit_stats":null,"previous_names":["gozenc/zen-react-scripts","fatihgozenc/zen-react-scripts"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozenc%2Fzen-react-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozenc%2Fzen-react-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozenc%2Fzen-react-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gozenc%2Fzen-react-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gozenc","download_url":"https://codeload.github.com/gozenc/zen-react-scripts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240645355,"owners_count":19834403,"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":[],"created_at":"2024-11-10T17:03:20.228Z","updated_at":"2025-02-25T10:19:40.274Z","avatar_url":"https://github.com/gozenc.png","language":"JavaScript","readme":"# Zen React Scripts\n\n[webpack@5](https://github.com/webpack/webpack) scripts for building and developing React SPA's. Works great with [create-zen-app](https://github.com/fatihgozenc/create-zen-app) which is based on this repo for webpack scripts and configuration. Inspired from [react-scripts](https://github.com/facebook/create-react-app/tree/main/packages/react-scripts).\n\nThis project aims to contain have latest updates from all dependencies to be secure and prevent any warning on actions or npm/yarn log messages.\n\nAlso you're able to use Web Workers with TypeScript with this.\n\n## Install\n\nFinal build will be compiled into [preact](https://preactjs.com/) and [@babel/runtime](https://babeljs.io/docs/en/babel-runtime) will optimize re-use of classes in runtime. So:\n\n```\nyarn add preact @babel/runtime\n```\n\n```\nnpm i preact @babel/runtime\n```\n\nthen you're ready to go:\n\n```\nyarn add -D zen-react-scripts\n```\n\n```\nnpm i -D zen-react-scripts\n```\n\n\u003cbr/\u003e\n\n### Folder Structure\n\n```\nmy-app\n├── README.md\n├── node_modules\n├── package.json\n├── .gitignore\n├── .eslintrc.json\n├── .env\n├── public\n│   ├── manifest.json\n│   └── index.html\n└── src\n    ├── components/\n    ├── App.tsx\n    ├── preload.js\n    ├── index.js\n    └── logo.svg\n```\n\n\u003cbr/\u003e\n\n### Sample config for package.json\n\n```json\n    \"scripts\": {\n        \"dev\": \"zen-react-scripts dev\",\n        \"build\": \"zen-react-scripts build\",\n        \"local\": \"zen-react-scripts local\"\n    }\n    \"browserslist\": \"edge \u003e= 13, firefox \u003e= 50, and_ff \u003e= 50, chrome \u003e= 49, and_chr \u003e= 49, ios \u003e= 9.4, safari \u003e= 9.4, samsung \u003e= 5, and_uc \u003e= 11.8, opera \u003e= 40, op_mob \u003e= 40, baidu \u003e= 7\"\n```\n\n## Environment Files\n\nBy default `.env` file will be checked for environment variables. If you place `.env.production` or `.env.development`, these files will overwrite default `.env` file that you've placed before.\n\n## Commands\n\n### dev\n\nStarts project for development on `http://localhost:3000` and opens a tab in your default browser.\n\n#### --https\n\nStarts development server with https.\n\n#### --silent or -s\n\nStarts development server in the background, without creating a tab or opening the browser. Useful for testing.\n\n### build\n\nBuilds the react project for deployment. Will be placed in `./build/`\n\n### local\n\nBuilds the project and starts an instance on `http://localhost:3001` via a basic `express` static server. Useful for checking the build on production environment.\n\n### start\n\nStarts built project for production on `http://localhost:3001`.\n\n#### --hash\n\nBuilds your app with a unique random hash like `app.9dbf42.js` in all of your assets. If not specified it uses `[contenthash:6]` which only changes when you change the content of the file.\nvia NPM\n\n```\nnpm run build -- --hash\n```\n\nvia Yarn\n\n```\nyarn build --hash\n```\n\n\u003cbr/\u003e\n\n#### --analyze\n\nBuilds and creates a report on `http://localhost:3002`\n\nvia NPM\n\n```\nnpm run build -- --analyze\n```\n\nvia Yarn\n\n```\nyarn build --analyze\n```\n\n\u003cbr/\u003e\n\n## Custom Webpack Configuration\n\nYou can overwrite the custom configuration of your app via placing `webpack.config.js` in your project root. Webpack configurations can passed inside `production` and `development` keys in object.\n\n```js\nmodule.exports = {\n  production: {\n    output: {\n      publicPath: \"/yourDesiredPath/\",\n    },\n  },\n  development: {\n    devtool: \"source-map\",\n  },\n};\n```\n\n\u003cbr/\u003e\n\n## Web Workers with React\n\nNow you can start using Web Workers! Two things are important here: Files that contain a Web Worker must end with `*.worker.ts`, and they\nmust start with the following two lines of code in order to work nicely together with TypeScript:\n\n```ts\ndeclare const self: DedicatedWorkerGlobalScope;\nexport default {} as typeof Worker \u0026 { new (): Worker };\n\n// Your code ...\n```\n\nIn your application, you can import your Web Workers like a normal module, and instantiate them as a class. For example:\n\n```ts\nimport MyWorker from \"./MyWorker.worker\";\n\nconst myWorkerInstance: Worker = new MyWorker();\n```\n\n\u003cbr/\u003e\n\n## Loading Custom Font Files\n\nLoading custom files via URL relies on relative paths in your file tree. An example with file tree is here:\n\n```scss\n// src/styles/main.scss\n@font-face {\n  font-family: \"FFMark\";\n  src: url(\"./fonts/ffmark.woff2\");\n}\n```\n\n```\n\n└─ src\n  ├── components/\n  ├── styles/\n  │   ├── fonts/\n  │   │   └── ffmark.woff2\n  │   └── main.sscs\n  ├── App.tsx\n  └── index.js\n```\n\n\u003cbr/\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgozenc%2Fzen-react-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgozenc%2Fzen-react-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgozenc%2Fzen-react-scripts/lists"}