Skip to content

MS-DG/create-dg-react

 
 

Repository files navigation

Create DG React apps with no build configuration.

Create DG React App works on macOS, Windows, and Linux.

Quick Overview

npm create dg-react dg-app
cd dg-app
npm start

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

(npx comes with npm 5.2+ and higher, see instructions for older npm versions)

Then open http://localhost:3000/ to see your app.
When you’re ready to deploy to production, create a minified bundle with npm run build.

Get Started Immediately

You don’t need to install or configure tools like webpack or Babel.
They are preconfigured and hidden so that you can focus on the code.

Create a project, and you’re good to go.

Creating an App

You’ll need to have Node 10.16.0 or later version on your local development machine (but it’s not required on the server). You can use nvm (macOS/Linux) or nvm-windows to switch Node versions between different projects.

To create a new app, you may choose one of the following methods:

npm

npm create dg-react dg-app

npm create <initializer> is available in npm 6+

(or npx create-dg-react dg-app with npx is a package runner tool that comes with npm 5.2+ and higher, see instructions for older npm versions)

Yarn

yarn create dg-react dg-app

yarn create <starter-kit-package> is available in Yarn 0.25+

Default template files

It will create a directory called dg-app inside the current folder.
Inside that directory, it will generate the initial project structure and install the transitive dependencies:

dg-app
├── azure-pipelines.yml # Azure piplines CI/CD entry point
├── README.md
├── package.json
├── .gitignore
├── .azure-devops/ # azure piplines config and templates
|
├── public/ # static resources
│   ├── favicon.ico
│   ├── index.html
│   └── manifest.json
│
└── src/ # source code
    ├── App.scss
    ├── App.tsx
    ├── App.test.tsx
    ├── index.scss
    ├── index.tsx
    ├── logo.svg
    └── serviceWorker.ts

No configuration or complicated folder structures, only the files you need to build your app.
Once the installation is done, you can open your project folder:

cd dg-app

Inside the newly created project, you can run some built-in commands:

npm start or yarn start

Runs the app in development mode.

Open http://localhost:3000 to view it in the browser.

The page will automatically reload if you make changes to the code.

You will see the build errors and lint warnings in the console.

Build errors

npm test or yarn test

Runs the test watcher in an interactive mode. By default, runs tests related to files changed since the last commit.

Read more about testing.

npm run build or yarn build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.

Your app is ready to be deployed.

User Guide

You can find detailed instructions on using Create DG App and many tips in Create React App documentation (almost the same behaviors).

How to Update to New Versions?

if you want to update current project (already exists)

update the dependency @dragongate/react-scripts to lasted in your app project.

if you want to create a new project

create a app without global install.

Multi Entities

Add APP_INDEX=src/Entry1,src/Entry2 in your configuration (.env)

Philosophy

  • One Dependency: There is only one build dependency. It uses webpack, Babel, ESLint, and other amazing projects, but provides a cohesive curated experience on top of them.

  • No Configuration: You don't need to configure anything. A reasonably good configuration of both development and production builds is handled for you so you can focus on writing code.

What’s Included?

Your environment will have everything you need to build a modern single-page React app with git:

  • Integrated with Azure pipelines (build/test/env).
  • Shared vscode (IDE) config and plugins.
  • Force lint rules on build and staged check.
    • stylelint for css style
    • eslint for js/ts/jsx
  • prettier integration.
  • Git hook support for commit and push.
  • Cross-Platform VSTS auth
  • React, JSX, ES6, TypeScript syntax support.
  • Language extras beyond ES6 like the object spread operator.
  • Autoprefixed CSS, so you don’t need -webkit- or other prefixes.
  • A fast interactive unit test runner with built-in support for coverage reporting.
  • A live development server that warns about common mistakes.
  • A build script to bundle JS, CSS, and images for production, with hashes and sourcemaps.
  • An offline-first service worker and a web app manifest, meeting all the Progressive Web App criteria.
  • Hassle-free updates for the above tools with a single dependency.

The tradeoff is that these tools are preconfigured to work in a specific way. If your project needs more customization, you can "eject" and customize it, but then you will need to maintain this configuration.

License

MIT

About

Set up a modern web app by running one command.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 70.6%
  • Shell 21.2%
  • TypeScript 4.4%
  • SCSS 1.4%
  • HTML 1.3%
  • CSS 1.0%
  • Sass 0.1%