[go: up one dir, main page]

Skip to content

Yoshikawa123/weko-react

 
 

Repository files navigation

WEKO Create React App

Logo

Create React apps with no build configuration.

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

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 new WEKO app module, 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). We recommend using the latest LTS version. 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:

npx

npx create-react-app app-module-name

(npx is a package runner tool that comes with npm 5.2+ and higher, see instructions for older npm versions)

npm

npm init react-app app-module-name

npm init <initializer> is available in npm 6+

Yarn

yarn create react-app app-module-name

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

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

app-module-name
├── README.md
├── node_modules
├── package.json
├── public
│   ├── index.html
│   ├── favicon.ico
│   └── manifest.json
└── src
    ├── ModuleName.css
    ├── ModuleName.js
    ├── ModuleName.test.js
    ├── index.css
    ├── index.js
    ├── logo.svg
    └── serviceWorker.js
    └── setupTests.js

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 app-module-name

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.

Building an App

npm install or yarn install

Install is used to install all dependencies for an app module. This is most commonly used when you have just checked out code for a module, or when another developer on the module has added a new dependency that you need to pick up.

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.

Injecting into WEKO3 module

Change file name

After process build, you can't found build results in app-module-name/build/static/ contained css and js folders.

Change that file's name following these rule:

  • In folder css:

      *.chunk.css         --> app-module-name.chunk.css
  • In folder js:

      *.chunk.js          --> app-module-name.chunk.js
      main.*.chunk.js     --> app-module-name.main.chunk.js
      runtime-main.*.js   --> app-module-name.runtime-main.js

Move built file into WEKO3 module

Copy files above into corresponding folder in WEKO3's source:

module
├── weko-app-module
│   └── weko_app_module
|       └── static
|           ├── css
|           |   └── weko_app_module
|           |       └── *PUT CSS FILE HERE*
|           └── js
|               └── weko_app_module
|                   └── *PUT JS FILE HERE*

Further help

If something doesn’t work, please file an issue.
If you have questions or need help, please ask in GitHub Discussions.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 87.7%
  • HTML 7.9%
  • CSS 2.6%
  • Shell 1.8%