[core] add core package
This commit is contained in:
parent
164fb016f1
commit
0b35ded046
@ -1,14 +1,28 @@
|
|||||||
## How To Start
|
# Mancala Backend
|
||||||
|
|
||||||
Development
|
This is the backend code for the Mancala project, written in Express.js.
|
||||||
|
|
||||||
```bash
|
## Getting Started
|
||||||
npm run dev
|
|
||||||
|
### Install Packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
Release
|
### Start in Development Mode
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build
|
yarn dev
|
||||||
npm start
|
```
|
||||||
```
|
|
||||||
|
### Start in Release Mode
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn build
|
||||||
|
yarn start
|
||||||
|
```
|
||||||
|
|
||||||
|
### Development Dependencies
|
||||||
|
|
||||||
|
This package depends on the local packages `@mancala/core` and `mancala.js`. Refer to their documentation for further instructions.
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "mancala-backend",
|
"name": "@mancala/backend",
|
||||||
"version": "0.4.3",
|
"version": "0.4.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
@ -14,6 +14,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@mancala/core": "0.0.1",
|
||||||
"@types/cors": "^2.8.10",
|
"@types/cors": "^2.8.10",
|
||||||
"@types/morgan": "^1.9.3",
|
"@types/morgan": "^1.9.3",
|
||||||
"@types/uuid": "^8.3.0",
|
"@types/uuid": "^8.3.0",
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import {
|
|||||||
channel_on_game_user_leave,
|
channel_on_game_user_leave,
|
||||||
channel_on_user_connection_change,
|
channel_on_user_connection_change,
|
||||||
channel_unlisten_game_events
|
channel_unlisten_game_events
|
||||||
} from "../consts/channel_names";
|
} from "@mancala/core";
|
||||||
import { GameMove } from "../models/GameMove";
|
import { GameMove } from "../models/GameMove";
|
||||||
import { GameCrashManager } from "./GameCrashManager";
|
import { GameCrashManager } from "./GameCrashManager";
|
||||||
import { MatchMaker } from "../matchmaker/MatchMaker";
|
import { MatchMaker } from "../matchmaker/MatchMaker";
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { Bytes, OnClientConnectionChange, OnMessage, RTMT } from "./rtmt"
|
|||||||
|
|
||||||
import WebSocket from "ws"
|
import WebSocket from "ws"
|
||||||
import * as http from 'http';
|
import * as http from 'http';
|
||||||
import { channel_ping, channel_pong } from "../consts/channel_names";
|
import { channel_ping, channel_pong } from "@mancala/core";
|
||||||
import { RTMT_WS_PING_INTERVAL } from "../consts/config";
|
import { RTMT_WS_PING_INTERVAL } from "../consts/config";
|
||||||
|
|
||||||
export class RTMTWS implements RTMT {
|
export class RTMTWS implements RTMT {
|
||||||
|
|||||||
@ -525,6 +525,11 @@
|
|||||||
"@jridgewell/resolve-uri" "^3.0.3"
|
"@jridgewell/resolve-uri" "^3.0.3"
|
||||||
"@jridgewell/sourcemap-codec" "^1.4.10"
|
"@jridgewell/sourcemap-codec" "^1.4.10"
|
||||||
|
|
||||||
|
"@mancala/core@0.0.1":
|
||||||
|
version "0.0.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@mancala/core/-/core-0.0.1.tgz#be80c1de07f6e7c4e30f5ad099a9f8d027d2a082"
|
||||||
|
integrity sha512-Mn2A9QVxEmQWKgeWJoxVFQ1WgauFZTAOfJXW7y0iifjtQMGb69wrm0kA14mIY5yJwZsPIEBjQkWf/Thg4H88sw==
|
||||||
|
|
||||||
"@sindresorhus/is@^0.14.0":
|
"@sindresorhus/is@^0.14.0":
|
||||||
version "0.14.0"
|
version "0.14.0"
|
||||||
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.14.0.tgz#9fb3a3cf3132328151f353de4632e01e52102bea"
|
||||||
|
|||||||
2
core/.eslintignore
Normal file
2
core/.eslintignore
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
12
core/.eslintrc
Normal file
12
core/.eslintrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"plugins": [
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
"extends": [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
|
"plugin:@typescript-eslint/recommended"
|
||||||
|
]
|
||||||
|
}
|
||||||
2
core/.gitignore
vendored
Normal file
2
core/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
node_modules
|
||||||
|
dist
|
||||||
6
core/.prettierrc
Normal file
6
core/.prettierrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"semi": true,
|
||||||
|
"trailingComma": "none",
|
||||||
|
"singleQuote": true,
|
||||||
|
"printWidth": 80
|
||||||
|
}
|
||||||
33
core/README.md
Normal file
33
core/README.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Mancala Core
|
||||||
|
|
||||||
|
This module contains common functionalities for the Mancala project.
|
||||||
|
|
||||||
|
## Build
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn build
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Link this local package to other packages (backend, frontend, mobile).
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn link
|
||||||
|
```
|
||||||
|
|
||||||
|
In the target package folder, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ../backend
|
||||||
|
yarn link @mancala/core
|
||||||
|
```
|
||||||
|
|
||||||
|
## NPM Publish Instructions
|
||||||
|
|
||||||
|
Run the following commands:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm login
|
||||||
|
npm publish --access public
|
||||||
|
```
|
||||||
6
core/jest.config.js
Normal file
6
core/jest.config.js
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
transform: {'^.+\\.ts?$': 'ts-jest'},
|
||||||
|
testEnvironment: 'node',
|
||||||
|
testRegex: '/tests/.*\\.(test|spec)?\\.(ts|tsx)$',
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node']
|
||||||
|
};
|
||||||
9294
core/package-lock.json
generated
Normal file
9294
core/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
42
core/package.json
Normal file
42
core/package.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"name": "@mancala/core",
|
||||||
|
"description": "Mancala Core Library",
|
||||||
|
"main": "dist/index.js",
|
||||||
|
"types": "dist/index.d.ts",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "yarn tsc -w",
|
||||||
|
"test": "yarn jest",
|
||||||
|
"lint": "eslint . --ext .ts",
|
||||||
|
"prettier-format": "prettier --config .prettierrc 'src/**/*.ts' --write",
|
||||||
|
"build": "tsc",
|
||||||
|
"prepublish": "tsc"
|
||||||
|
},
|
||||||
|
"author": "Halit Aksoy",
|
||||||
|
"license": "MIT",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/jest": "^27.4.1",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
||||||
|
"@typescript-eslint/parser": "^5.21.0",
|
||||||
|
"eslint": "^8.14.0",
|
||||||
|
"jest": "^27.5.1",
|
||||||
|
"prettier": "^2.6.2",
|
||||||
|
"ts-jest": "^27.1.4",
|
||||||
|
"typescript": "^4.6.3"
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"test": "tests"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/jhalitaksoy/mancala.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"mancala",
|
||||||
|
"game"
|
||||||
|
],
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/jhalitaksoy/mancala/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/jhalitaksoy/mancala#readme"
|
||||||
|
}
|
||||||
1
core/src/index.ts
Normal file
1
core/src/index.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
export * from './rtmt/channel_names'
|
||||||
0
core/src/types.ts
Normal file
0
core/src/types.ts
Normal file
110
core/tsconfig.json
Normal file
110
core/tsconfig.json
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
||||||
|
|
||||||
|
/* Projects */
|
||||||
|
// "incremental": true, /* Enable incremental compilation */
|
||||||
|
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
||||||
|
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
||||||
|
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
||||||
|
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
||||||
|
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
||||||
|
|
||||||
|
/* Language and Environment */
|
||||||
|
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
||||||
|
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
||||||
|
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
||||||
|
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
||||||
|
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
||||||
|
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
||||||
|
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
||||||
|
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
||||||
|
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
||||||
|
|
||||||
|
/* Modules */
|
||||||
|
"module": "commonjs", /* Specify what module code is generated. */
|
||||||
|
// "rootDir": "./", /* Specify the root folder within your source files. */
|
||||||
|
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
||||||
|
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
||||||
|
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
||||||
|
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
||||||
|
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
||||||
|
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
||||||
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
// "resolveJsonModule": true, /* Enable importing .json files */
|
||||||
|
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
||||||
|
|
||||||
|
/* JavaScript Support */
|
||||||
|
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
||||||
|
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
||||||
|
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
||||||
|
|
||||||
|
/* Emit */
|
||||||
|
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
||||||
|
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
||||||
|
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
||||||
|
"sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
||||||
|
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
||||||
|
"outDir": "dist", /* Specify an output folder for all emitted files. */
|
||||||
|
// "removeComments": true, /* Disable emitting comments. */
|
||||||
|
// "noEmit": true, /* Disable emitting files from a compilation. */
|
||||||
|
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
||||||
|
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
||||||
|
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
||||||
|
//"sourceRoot": "src", /* Specify the root path for debuggers to find the reference source code. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
||||||
|
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
||||||
|
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
||||||
|
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
||||||
|
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
||||||
|
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
||||||
|
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
||||||
|
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
||||||
|
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
||||||
|
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
||||||
|
|
||||||
|
/* Interop Constraints */
|
||||||
|
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
||||||
|
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
|
||||||
|
/* Type Checking */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
||||||
|
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
||||||
|
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
||||||
|
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
||||||
|
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
||||||
|
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
||||||
|
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
||||||
|
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
||||||
|
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
||||||
|
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
||||||
|
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
||||||
|
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
||||||
|
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
||||||
|
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
||||||
|
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
||||||
|
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
||||||
|
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
||||||
|
|
||||||
|
/* Completeness */
|
||||||
|
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
||||||
|
"skipLibCheck": true, /* Skip type checking all .d.ts files. */
|
||||||
|
"declaration": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"src"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"**/__tests__/*",
|
||||||
|
"dist"
|
||||||
|
]
|
||||||
|
}
|
||||||
3095
core/yarn.lock
Normal file
3095
core/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,21 @@
|
|||||||
### Mancala Frontend
|
# Mancala Frontend
|
||||||
|
|
||||||
#### How to build
|
The web user interface for the Mancala project, written in React.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
### Install Packages
|
||||||
|
|
||||||
|
```bash
|
||||||
|
yarn install
|
||||||
|
```
|
||||||
|
|
||||||
|
### Start in Development Mode
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
yarn
|
|
||||||
yarn dev
|
yarn dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Development Dependencies
|
||||||
|
|
||||||
|
This package depends on the local packages `@mancala/core` and `mancala.js`. Refer to their documentation for further instructions.
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "mancala-frontend",
|
"name": "@mancala/frontend",
|
||||||
"version": "0.4.3",
|
"version": "0.4.3",
|
||||||
"description": "Mancala Game Frontend",
|
"description": "Mancala Game Frontend",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -13,6 +13,7 @@
|
|||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@mancala/core": "0.0.1",
|
||||||
"@szhsin/react-menu": "^3.1.2",
|
"@szhsin/react-menu": "^3.1.2",
|
||||||
"@types/": "szhsin/react-menu",
|
"@types/": "szhsin/react-menu",
|
||||||
"@types/eventemitter2": "^4.1.0",
|
"@types/eventemitter2": "^4.1.0",
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
export const channel_new_game = "new_game"
|
|
||||||
export const channel_cancel_new_game = "cancel_new_game"
|
|
||||||
export const channel_on_game_start = "on_game_start"
|
|
||||||
export const channel_game_move = "game_move"
|
|
||||||
export const channel_on_game_update = "on_game_update"
|
|
||||||
export const channel_leave_game = "leave_game"
|
|
||||||
export const channel_on_game_end = "on_game_end"
|
|
||||||
export const channel_on_game_crashed = "on_game_crashed"
|
|
||||||
export const channel_on_game_user_leave = "on_game_user_leave"
|
|
||||||
export const channel_ping = "ping"
|
|
||||||
export const channel_pong = "pong"
|
|
||||||
export const channel_on_user_connection_change = "channel_on_user_connection_change"
|
|
||||||
export const channel_listen_game_events = "channel_listen_game_events"
|
|
||||||
export const channel_unlisten_game_events = "channel_unlisten_game_events"
|
|
||||||
BIN
frontend/src/mancala.png
Normal file
BIN
frontend/src/mancala.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@ -17,7 +17,7 @@ import LoadingComponent from '../components/LoadingComponent';
|
|||||||
import PageContainer from '../components/PageContainer';
|
import PageContainer from '../components/PageContainer';
|
||||||
import Row from '../components/Row';
|
import Row from '../components/Row';
|
||||||
import UserStatus from '../components/UserStatus';
|
import UserStatus from '../components/UserStatus';
|
||||||
import { channel_on_game_update, channel_on_game_crashed, channel_on_game_user_leave, channel_on_user_connection_change, channel_leave_game, channel_game_move, channel_listen_game_events, channel_unlisten_game_events } from '../const/channel_names';
|
import { channel_on_game_update, channel_on_game_crashed, channel_on_game_user_leave, channel_on_user_connection_change, channel_leave_game, channel_game_move, channel_listen_game_events, channel_unlisten_game_events } from '@mancala/core';
|
||||||
import { Context } from '../context/context';
|
import { Context } from '../context/context';
|
||||||
import useWindowDimensions from '../hooks/useWindowDimensions';
|
import useWindowDimensions from '../hooks/useWindowDimensions';
|
||||||
import { GameMove } from '../models/GameMove';
|
import { GameMove } from '../models/GameMove';
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import HeaderbarTitle from '../components/headerbar/HeaderbarTitle';
|
|||||||
import ThemeSwitchMenu from '../components/headerbar/ThemeSwitchMenu';
|
import ThemeSwitchMenu from '../components/headerbar/ThemeSwitchMenu';
|
||||||
import PageContainer from '../components/PageContainer';
|
import PageContainer from '../components/PageContainer';
|
||||||
import Row from '../components/Row';
|
import Row from '../components/Row';
|
||||||
import { channel_cancel_new_game, channel_on_game_start } from '../const/channel_names';
|
import { channel_cancel_new_game, channel_on_game_start } from '@mancala/core';
|
||||||
import { Context } from '../context/context';
|
import { Context } from '../context/context';
|
||||||
import { Theme } from '../theme/Theme';
|
import { Theme } from '../theme/Theme';
|
||||||
import { getColorByBrightness } from '../util/ColorUtil';
|
import { getColorByBrightness } from '../util/ColorUtil';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { decode, encode } from "./encode_decode_message";
|
import { decode, encode } from "./encode_decode_message";
|
||||||
import { channel_ping, channel_pong } from "../const/channel_names";
|
import { channel_ping, channel_pong } from "@mancala/core";
|
||||||
import { RTMT_WS_PING_INTERVAL, RTMT_WS_PING_INTERVAL_BUFFER_TIME, server } from "../const/config";
|
import { RTMT_WS_PING_INTERVAL, RTMT_WS_PING_INTERVAL_BUFFER_TIME, server } from "../const/config";
|
||||||
import EventEmitter2, { Listener } from "eventemitter2";
|
import EventEmitter2, { Listener } from "eventemitter2";
|
||||||
import { Bytes, ConnectionState, RTMT, RtmtEventTypes } from "./rtmt";
|
import { Bytes, ConnectionState, RTMT, RtmtEventTypes } from "./rtmt";
|
||||||
|
|||||||
@ -306,6 +306,9 @@
|
|||||||
resolved "https://registry.yarnpkg.com/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.5.2.tgz#28f643fbc0bec30b07fbe95b137879b6b4d1c9c5"
|
resolved "https://registry.yarnpkg.com/@lmdb/lmdb-win32-x64/-/lmdb-win32-x64-2.5.2.tgz#28f643fbc0bec30b07fbe95b137879b6b4d1c9c5"
|
||||||
integrity sha512-zrBczSbXKxEyK2ijtbRdICDygRqWSRPpZMN5dD1T8VMEW5RIhIbwFWw2phDRXuBQdVDpSjalCIUMWMV2h3JaZA==
|
integrity sha512-zrBczSbXKxEyK2ijtbRdICDygRqWSRPpZMN5dD1T8VMEW5RIhIbwFWw2phDRXuBQdVDpSjalCIUMWMV2h3JaZA==
|
||||||
|
|
||||||
|
"@mancala/core@file:./../core":
|
||||||
|
version "0.0.1"
|
||||||
|
|
||||||
"@mischnic/json-sourcemap@^0.1.0":
|
"@mischnic/json-sourcemap@^0.1.0":
|
||||||
version "0.1.0"
|
version "0.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/@mischnic/json-sourcemap/-/json-sourcemap-0.1.0.tgz#38af657be4108140a548638267d02a2ea3336507"
|
resolved "https://registry.yarnpkg.com/@mischnic/json-sourcemap/-/json-sourcemap-0.1.0.tgz#38af657be4108140a548638267d02a2ea3336507"
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
|
# Mancala Mobile
|
||||||
|
|
||||||
|
The mobile user interface for the Mancala project, written in React Native.
|
||||||
|
|
||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
@ -46,34 +48,6 @@ If everything is set up _correctly_, you should see your new app running in your
|
|||||||
|
|
||||||
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
|
This is one way to run your app — you can also run it directly from within Android Studio and Xcode respectively.
|
||||||
|
|
||||||
## Step 3: Modifying your App
|
### Development Dependencies
|
||||||
|
|
||||||
Now that you have successfully run the app, let's modify it.
|
This package depends on the local packages `@mancala/core` and `mancala.js`. Refer to their documentation for further instructions.
|
||||||
|
|
||||||
1. Open `App.tsx` in your text editor of choice and edit some lines.
|
|
||||||
2. For **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Developer Menu** (<kbd>Ctrl</kbd> + <kbd>M</kbd> (on Window and Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (on macOS)) to see your changes!
|
|
||||||
|
|
||||||
For **iOS**: Hit <kbd>Cmd ⌘</kbd> + <kbd>R</kbd> in your iOS Simulator to reload the app and see your changes!
|
|
||||||
|
|
||||||
## Congratulations! :tada:
|
|
||||||
|
|
||||||
You've successfully run and modified your React Native App. :partying_face:
|
|
||||||
|
|
||||||
### Now what?
|
|
||||||
|
|
||||||
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
|
|
||||||
- If you're curious to learn more about React Native, check out the [Introduction to React Native](https://reactnative.dev/docs/getting-started).
|
|
||||||
|
|
||||||
# Troubleshooting
|
|
||||||
|
|
||||||
If you can't get this to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
|
|
||||||
|
|
||||||
# Learn More
|
|
||||||
|
|
||||||
To learn more about React Native, take a look at the following resources:
|
|
||||||
|
|
||||||
- [React Native Website](https://reactnative.dev) - learn more about React Native.
|
|
||||||
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
|
|
||||||
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
|
|
||||||
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
|
|
||||||
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "mancala_mobile",
|
"name": "@mancala/mobile",
|
||||||
"version": "0.4.3",
|
"version": "0.4.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -10,6 +10,7 @@
|
|||||||
"test": "jest"
|
"test": "jest"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@mancala/core": "0.0.1",
|
||||||
"@react-navigation/native": "^6.1.17",
|
"@react-navigation/native": "^6.1.17",
|
||||||
"@react-navigation/native-stack": "^6.9.26",
|
"@react-navigation/native-stack": "^6.9.26",
|
||||||
"@types/uuid": "^9.0.8",
|
"@types/uuid": "^9.0.8",
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
export const channel_new_game = "new_game"
|
|
||||||
export const channel_cancel_new_game = "cancel_new_game"
|
|
||||||
export const channel_on_game_start = "on_game_start"
|
|
||||||
export const channel_game_move = "game_move"
|
|
||||||
export const channel_on_game_update = "on_game_update"
|
|
||||||
export const channel_leave_game = "leave_game"
|
|
||||||
export const channel_on_game_end = "on_game_end"
|
|
||||||
export const channel_on_game_crashed = "on_game_crashed"
|
|
||||||
export const channel_on_game_user_leave = "on_game_user_leave"
|
|
||||||
export const channel_ping = "ping"
|
|
||||||
export const channel_pong = "pong"
|
|
||||||
export const channel_on_user_connection_change = "channel_on_user_connection_change"
|
|
||||||
export const channel_listen_game_events = "channel_listen_game_events"
|
|
||||||
export const channel_unlisten_game_events = "channel_unlisten_game_events"
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { decode, encode } from "./encode_decode_message";
|
import { decode, encode } from "./encode_decode_message";
|
||||||
import { RTMT_WS_PING_INTERVAL, RTMT_WS_PING_INTERVAL_BUFFER_TIME, server } from "../const/config";
|
import { RTMT_WS_PING_INTERVAL, RTMT_WS_PING_INTERVAL_BUFFER_TIME, server } from "../const/config";
|
||||||
import { Bytes, ConnectionState, RTMT, RtmtEventTypes } from "./rtmt";
|
import { Bytes, ConnectionState, RTMT, RtmtEventTypes } from "./rtmt";
|
||||||
import { channel_ping, channel_pong } from "../const/channel_names";
|
import { channel_ping, channel_pong } from "@mancala/core";
|
||||||
import { TinyEmitter } from "tiny-emitter";
|
import { TinyEmitter } from "tiny-emitter";
|
||||||
|
|
||||||
const MESSAGE_CHANNEL_PREFIX = "message_channel";
|
const MESSAGE_CHANNEL_PREFIX = "message_channel";
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import BoardViewModel from '../viewmodel/BoardViewModel';
|
|||||||
import { MancalaGame, Pit } from 'mancala.js';
|
import { MancalaGame, Pit } from 'mancala.js';
|
||||||
import { v4 } from 'uuid';
|
import { v4 } from 'uuid';
|
||||||
import PitAnimator from '../animation/PitAnimator';
|
import PitAnimator from '../animation/PitAnimator';
|
||||||
import { channel_on_game_update, channel_on_game_crashed, channel_on_game_user_leave, channel_on_user_connection_change, channel_listen_game_events, channel_unlisten_game_events, channel_leave_game, channel_game_move } from '../const/channel_names';
|
import { channel_on_game_update, channel_on_game_crashed, channel_on_game_user_leave, channel_on_user_connection_change, channel_listen_game_events, channel_unlisten_game_events, channel_leave_game, channel_game_move } from '@mancala/core';
|
||||||
import { GameMove } from '../models/GameMove';
|
import { GameMove } from '../models/GameMove';
|
||||||
import { LoadingState } from '../models/LoadingState';
|
import { LoadingState } from '../models/LoadingState';
|
||||||
import { getColorByBrightness } from '../util/ColorUtil';
|
import { getColorByBrightness } from '../util/ColorUtil';
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { LobyScreenProps } from '../types';
|
import { LobyScreenProps } from '../types';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { CommonMancalaGame } from 'mancala.js';
|
import { CommonMancalaGame } from 'mancala.js';
|
||||||
import { channel_cancel_new_game, channel_on_game_start } from '../const/channel_names';
|
import { channel_cancel_new_game, channel_on_game_start } from '@mancala/core';
|
||||||
import CircularPanel from '../components/CircularPanel';
|
import CircularPanel from '../components/CircularPanel';
|
||||||
import { getColorByBrightness } from '../util/ColorUtil';
|
import { getColorByBrightness } from '../util/ColorUtil';
|
||||||
import { SvgXml } from 'react-native-svg';
|
import { SvgXml } from 'react-native-svg';
|
||||||
|
|||||||
@ -1493,6 +1493,9 @@
|
|||||||
"@jridgewell/resolve-uri" "^3.1.0"
|
"@jridgewell/resolve-uri" "^3.1.0"
|
||||||
"@jridgewell/sourcemap-codec" "^1.4.14"
|
"@jridgewell/sourcemap-codec" "^1.4.14"
|
||||||
|
|
||||||
|
"@mancala/core@file:./../core":
|
||||||
|
version "0.0.1"
|
||||||
|
|
||||||
"@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1":
|
"@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1":
|
||||||
version "5.1.1-v1"
|
version "5.1.1-v1"
|
||||||
resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129"
|
resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz#dbf733a965ca47b1973177dc0bb6c889edcfb129"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user