Giter VIP home page Giter VIP logo

albericod / overwolf-modern-react-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
55.0 3.0 15.0 10.38 MB

OMRB is a free and open source opinionated boilerplate based on React that helps developers create fast, modular and modern overwolf app.

Home Page: https://www.npmjs.com/package/cra-template-overwolf-typescript-redux

License: MIT License

HTML 1.94% JavaScript 2.62% CSS 9.99% TypeScript 85.46%
overwolf redux-devtools overwolf-store react custom-hooks reactjs modularity games overlay overlays

overwolf-modern-react-boilerplate's Introduction

Overwolf Modern React Boilerplate

OMRB is released under the MIT license. PRs welcome! Publish NPM Package

This is the official Overwolf Modern React Boilerplate template for Create React App.

OMRB is a free and open source opinionated boilerplate based on React that helps developers create fast, modular and modern overwolf app.

Technology

  • Use a Modern Stack for Every App. Create a uniform workflow for you and your team without ejecting the Create React App code.

  • Internationalization. Support for multiple languages without having to change code.

  • Performance Is Baked In. Custom hooks with functions and variables memoized for common uses in overwolf development.

  • Build. Folders and structure ready for use in the overwolf store.

  • CI/CD continuous development, continuous testing, continuous integration, continuous deployment


🚀 Quick Start

Prerequisites

To use this template, add --template overwolf-typescript-redux when creating a new app.

For example:

npx create-react-app my-app --template overwolf-typescript-redux

# or

yarn create react-app my-app --template overwolf-typescript-redux

For more information, please refer to:

📸 Screenshot

this version the project is configured and ready to test with the Hearthstone game, you can use the template, compile and test without modifying anything to understand the development flow.

Desktop Window

Desktop Window

InGame Window - 1

Ingame Window 1

InGame Window - 2

Ingame Window 2

💼 Project structure - Feature Folder.

Folder-by-type only works on small-scale projects. Folder-by-feature is superior in the majority of cases, is better due to its scalability, stands out in high modularity and cohesion. It allows us to play with the components' scope.

.
|--- public
|---- # essencial files for overwolf store
|--- src
|    |--- app/
|    |----# global and shared components
|    |----lib/
|    |----# global and shared functions
|    |--- components/
|    |----# components that are not part of the application's business rule and can be reused in other features
|    |--- features/
|    |----# features that are part of the application's business rule and can be reused in other features
|    |--- screens/
|    |----# screens that are part of each entry point of the application from the ovewolf manifest
|    |--- locales/
|    |-----------de/**/*.json
|    |-----------de/index.ts
|    |-----------en/**/*.json
|    |-----------en/index.ts
|    |-----------es/**/*.json
|    |-----------es/index.ts
|    |-----------fr/**/*.json
|    |-----------fr/index.ts
|    |-----------it/**/*.json
|    |-----------it/index.ts
|    |-----------ko/**/*.json
|    |-----------ko/index.ts
|    |-----------pl/**/*.json
|    |-----------pl/index.ts
|    |-----------pt/**/*.json
|    |-----------pt/index.ts
|    |-----------ru/**/*.json
|    |-----------ru/index.ts
|    |-----------tr/**/*.json
|    |-----------tr/index.ts
|    |-----------index.ts
|    |--- index.tsx
|    |--- overwolf.dev.mock.ts
|    |--- react-app-env.d.ts
|    |--- setupTests.ts
|--- .gitignore
|--- LICENSE
|--- README.md
|--- package-lock.json
|--- package.json
|--- tsconfig.json
.

🐛 Remote Redux Debug.

In overwolf it is not possible to install plugins to debug the code, so the alternative is to use something remote to debug an injected code.

  1. Install tool.
  1. Configure
  • if the installation is correct, a redux dev tools icon should appear in your browser's toolbar.
  • click into icon then choose "Open remote devTools"
  • click into settings option and let hostname called to "localhost" and port 8081.
  1. Run Server Bridge
  • run the server that bridges the remote redux and the overwolf application.
    cd overwolf-modern-react-boilerplate
    npm run start-remote-server
  1. Start debugging

    whenever you want to debug your app store, just remember to use the remote redux dev tools + the bridge server

📦 Build/Create package for overwolf store.

you need to create an optimized version of your code and the correct structure before sending it to the overwolf store. Overwolf Doc: How to submit an app

  1. Compile

    #Change into directory
    cd overwolf-modern-react-boilerplate
    npm run build:overwolf
  2. Edit Changelog

    To make it easier for users, contributors and overwolf team to see precisely what notable changes have been made between each release (or version) of the project.

  3. Send .zip (if it is the first time you are sending the app, you need to send the .zip file to the overwolf team, so that they can create the app in the store)

  • the generated code is located in |--- build/**/.**
  • Package all build/ folders to .zip (the command above already does this for you)
  • just send your .zip code to the overwolf test team. (package.vx.x.x.zip)
$ vi project-root/CHANGELOG.md

📦 🔃 🛎️ CI/CD

throughout the development cycle testing or releasing small updates can become a bit tedious, so there is also a github action setting when you generate a new project, you don't actually need to do any extra steps if you use github, this means that whenever you add valid code to the main branch, then an automatic github action will do all the compiling and packaging steps automatically.

About CI/CD File.yml

Configure Github Actions with secrets and environment variables

variables

Name Description type
PRE_RELEASE_CHANNEL overwolf channel id number

Note: Test Channel IDs from overwolf-cli Several commands work with test channels. While we plan to accept the channel's name, for now, we expect to receive the channel ID as the argument. You can find the channel's ID in the page URL of the channel in the Dev Console.

secrets

Name Description type
OW_CLI_EMAIL overwolf dev email string
OW_CLI_API_KEY overwolf dev api key string

Check out some screenshots of what github actions looks like:

label

label

label

Commands

The following commands are available in your project:

Command Description
npm run start Starts the development server.
npm run build Bundles the app into static files for production.
npm run test Starts the test runner.
npm run start-remote-server Starts the server that bridges the remote redux and the overwolf application.
npm run build:overwolf Bundles the app into static files for production.
npm run lint Runs the linter.
npm run format Runs the code formatter.
npm run pre-build Runs the pre-build script.
npm run post-build Runs the post-build script.
npm run package-overwolf Runs the package-overwolf script.

🤝 Contributing

Contributions, issues and feature requests are welcome!

Projects using OMRB

If you are using OMRB in your project, please let me know! I'll be happy to list it here.

  • Fortmapp

    A map for Fortnite Battle Royale. ForFortmapptm preview

  • Economy Tool

    A tool to help you manage economy in the cs2. Economy Tool preview

overwolf-modern-react-boilerplate's People

Contributors

akash1520 avatar albericod avatar cailir avatar froggypanda avatar giggiux avatar odeditkinow avatar semantic-release-bot avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

overwolf-modern-react-boilerplate's Issues

Create Automatic Zip and OPK with GitHub Actions when new commit comming to main branch

Is your feature request related to a problem? Please describe.

It's possible to automatize the process of generating a new OPK in every new feature instead to run the command manually local, this offers a continuous integration of each new commit.

Describe the solution you'd like

Currently exist some scripts to generate a new OPK and ZIP, so the general idea is to create a GitHub Actions to call these scripts when a new commit/PR/merge is submitted.

In the perfect scenario, the newly generated OPK should be disposed of in the overwolf app store automatically by the API, but the API does not exist yet, it's in planning by overwolf team.

Describe alternatives you've considered

There are other alternatives to Github Actions

  • Circle CI
  • Jenkins
  • Azure Pipelines
  • GitLab CI

Overwolf ADS SDK Integration

Is your feature request related to a problem? Please describe.

this feature will simplify the implementation of overwolf AD SDK

Describe the solution you'd like

this solution should be simple and modern using the new React hook API.
e.g

const container = useOWAd({width: 400, height: 300 });

<div ref={container} />

Describe alternatives you've considered

an alternative for implementing the ads would be to update the overwolf hooks package.

https://www.npmjs.com/package/overwolf-hooks

e.g

import { useOWAd } from 'overwolf-hooks';

const [containerRef, owAdMethods ] = useOWAd({width: 400, height: 300 });
//owAdMethods.refreshAd()
//owAdMethods.stopAd()

<div ref={containerRef} />

Additional context
references for overwolf ads sdk https://overwolf.github.io/docs/start/ads-sdk-overview

[Question] Starting app

I'm having trouble with starting app generated using this template in Overwolf.

I don't understand which command should I use to create (unpacked) extension. Could you provide short instruction how to do it?

change overwolf language api

Is your feature request related to a problem? Please describe.
the overwolf language api has been updated, the boilerplate needs to be updated to the new way of identifying the current overwolf language.

Describe the solution you'd like
change old way to new way

//old version 
overwolf.settings.getCurrentOverwolfLanguage(result => {
  i18n.use(initReactI18next).init({
      resources,
      lng: result.language,
      ...
})
______________________________________
//new version
overwolf.settings.language.get((result: IInitI18N) => {
  i18n.use(initReactI18next).init({
      resources,
      lng: result.language,
      ...
})

Describe alternatives you've considered
N/A

Additional context
overwolf language reference: https://overwolf.github.io/docs/api/overwolf-settings-language

Support debug_url in the manifest

Is your feature request related to a problem? Please describe.
Currently, the focus of the project seems to be, develop in the browser and build for overwolf later.

Describe the solution you'd like
We should support the debug_url property in the manifest to allow for react hot reloading as well is reactive development within the overwolf client.

Describe alternatives you've considered
N/A

Additional context
tl;dr this is great for web browser base development but we should instead shift to allowing for development while in-game using the overwolf client.

observe changes when overwolf language setting changes for the i18n use current language

Is your feature request related to a problem? Please describe.
the boilerplate does not detect a new language when it is already loaded, the ideal is that the language is always to propagate when the user switches to a new language in the settings of the overwolf application.

Describe the solution you'd like
using the current overwolf documentation the implementation would be something like this:

function changeLanguage({ language }: { language: string }) {
  i18n.changeLanguage(language);
}

overwolf.settings.language.onLanguageChanged.removeListener(changeLanguage);
overwolf.settings.language.onLanguageChanged.addListener(changeLanguage);

Describe alternatives you've considered
N/A

Additional context
overwolf language api reference: https://overwolf.github.io/docs/api/overwolf-settings-language
i18n reference: https://www.i18next.com

npm run pack-overwolf failed to create a Files folder.

Describe the bug
create-production-overwolf-build.sh failed to create a Files folder in app folder. Which fails to correctly package the app bundle to zip and install opk package to overwolf client.

Before:
cd app mv ../index.html Files mv ../static Files echo 'Compiled successfully!'

After
cd app mkdir Files mv ../index.html Files mv ../static Files echo 'Compiled successfully!'

Alternatively, you can add Files folder to the public/app and will be built with npm run build.

changelog model for overwolf review (QA)

Is your feature request related to a problem? Please describe.
Whenever a new version is generated, we must maintain a changelog so that overwolf's review team can efficiently test the new version.

Describe the solution you'd like
changelog file must follow the semantic versioning and keep a changelog convetion.

Additional context
refrence for submit your OPK for review by the Overwolf team: https://overwolf.github.io/docs/topics/submit-for-review#2-submit-for-review

[CRA] Create automatic publish to NPM with GitHub Actions

Is your feature request related to a problem? Please describe.

There is a better way with GitHub Actions to release and publish a new version in every new commit automatic.

Describe the solution you'd like.

Create a Github Action to release and publish a new package.

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.