Skip to content

Commit d3a2629

Browse files
author
Shlomi Assaf (shlassaf)
committed
refactor: move to library style repo with multiple libs (monorepo style)
1 parent 1a67f7b commit d3a2629

File tree

178 files changed

+3055
-623
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+3055
-623
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@ dll/
7070
*.css.shim.ts
7171
*.ngsummary.json
7272
*.shim.ngstyle.ts
73+
74+
dist_package
75+
.tmp
76+
.tsconfig.*.json

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Angular 2 Chess
1+
# Angular Chess
22

3-
A plugin oriented chess component.
3+
**Runs on `[email protected]`**
44

5-
> Angular 2 Chess is in early stages - Still alpha.
6-
> I'v built it in 4 days as a learning experiment that gone wild :)
5+
A plugin oriented chess component.
76

87
## Architecture
98
The module is actually a shell with plugins.
109
The shell provides contracts and some building block for the plugins.
11-
The logic behind a plugin system is that there are different types of chess games. Also, there are already multiple chess implementation's out there, a plugin can wrap an implementation and save a lot of work.
10+
The logic behind a plugin system is that there are different types of chess games.
11+
Also, there are already multiple chess implementation's out there, a plugin can wrap an implementation and save a lot of work.
1212

1313
This approach enables endless game variants.
1414
It can be games with different rules (engines), or games with different UI (3D, native, different pieces, etc...)
@@ -63,15 +63,3 @@ A controller has 2 responsibilities:
6363
Currently controllers are not really plugins, they are intended as such.
6464

6565

66-
67-
## TODOs:
68-
69-
* Integration with FireBase (for P2P play, save, etc...)
70-
* Promotion popup (currently defaults to Queen)
71-
* More boards / engines?
72-
* Change DI, board will get controller when new game is set (controller will hold engine via DI)?
73-
* NPM Publish script + publish
74-
* ~~Next move hint~~
75-
* ~~Undo~~
76-
* ~~Move to **Web Worker**, classic web worker use case~~ (native, none angular)
77-
* ~~Lazy load the Chessjs-AI plugin~~ (done with webpack)

additional-documentation/summary.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"title": "TODO",
4+
"file": "todo.md"
5+
}
6+
]

additional-documentation/todo.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
2+
## TODOs:
3+
4+
* Integration with FireBase (for P2P play, save, etc...)
5+
* Promotion popup (currently defaults to Queen)
6+
* More boards / engines?
7+
* Change DI, board will get controller when new game is set (controller will hold engine via DI)?
8+
* NPM Publish script + publish
9+
* ~~Next move hint~~
10+
* ~~Undo~~
11+
* ~~Move to **Web Worker**, classic web worker use case~~ (native, none angular)
12+
* ~~Lazy load the Chessjs-AI plugin~~ (done with webpack)

build_hooks.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const globals = {
2+
'tslib': 'tslib',
3+
4+
'@angular/animations': 'ng.animations',
5+
'@angular/core': 'ng.core',
6+
'@angular/common': 'ng.common',
7+
'@angular/forms': 'ng.forms',
8+
'@angular/http': 'ng.http',
9+
'@angular/platform-browser': 'ng.platformBrowser',
10+
'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',
11+
'@angular/platform-browser/animations': 'ng.platformBrowser.animations',
12+
13+
'rxjs/BehaviorSubject': 'Rx',
14+
'rxjs/Observable': 'Rx',
15+
'rxjs/Subject': 'Rx',
16+
'rxjs/Subscription': 'Rx',
17+
'rxjs/operator/map': 'Rx.Observable.prototype',
18+
'rxjs/operator/filter': 'Rx.Observable.prototype',
19+
'rxjs/operator/first': 'Rx.Observable.prototype',
20+
'rxjs/operator/takeUntil': 'Rx.Observable.prototype',
21+
'rxjs/operator/mergeMap': 'Rx.Observable.prototype',
22+
'rxjs/observable/fromEvent': 'Rx.Observable',
23+
};
24+
25+
export function jestConfig(config): void {
26+
if (!config.moduleNameMapper) {
27+
config.moduleNameMapper = {};
28+
}
29+
30+
config.moduleNameMapper['(.*)'] = '<rootDir>/src/$1';
31+
}
32+
33+
export function tsconfig(config) {
34+
config.angularCompilerOptions.strictMetadataEmit = false;
35+
}
36+
37+
export function rollupFESM(config) {
38+
if (config.external) {
39+
config.external = config.external.concat(Object.keys(globals));
40+
} else {
41+
config.external = Object.keys(globals);
42+
}
43+
44+
config.globals = (Object as any).assign(config.globals || {}, globals);
45+
}
46+
47+
export const rollupUMD = rollupFESM;

config/karma.conf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ module.exports = function (config) {
3535
*/
3636
files: [
3737
{ pattern: './config/spec-bundle.js', watched: false },
38-
{ pattern: './src/assets/**/*', watched: false, included: false, served: true, nocache: false }
38+
{ pattern: './src/demo/assets/**/*', watched: false, included: false, served: true, nocache: false }
3939
],
4040

4141
/**
4242
* By default all assets are served at http://localhost:[PORT]/base/
4343
*/
4444
proxies: {
45-
"/assets/": "/base/src/assets/"
45+
"/assets/": "/base/src/demo/assets/"
4646
},
4747

4848
/**

config/protractor.conf.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ exports.config = {
3333
capabilities: {
3434
'browserName': 'chrome',
3535
'chromeOptions': {
36-
//'args': ["--headless", "--disable-gpu", "--window-size=1280x800", "--no-sandbox"]
3736
'args': ['show-fps-counter=true']
3837
}
3938
},

config/setup-jest.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'jest-preset-angular';
2+
3+
const mock = () => {
4+
let storage = {};
5+
return {
6+
getItem: key => key in storage ? storage[key] : null,
7+
setItem: (key, value) => storage[key] = value || '',
8+
removeItem: key => delete storage[key],
9+
clear: () => storage = {},
10+
};
11+
};
12+
13+
Object.defineProperty(window, 'localStorage', {value: mock()});
14+
Object.defineProperty(window, 'sessionStorage', {value: mock()});
15+
Object.defineProperty(window, 'getComputedStyle', {
16+
value: () => ['-webkit-appearance']
17+
});

config/spec-bundle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ testing.TestBed.initTestEnvironment(
4646
* any file that ends with spec.ts and get its path. By passing in true
4747
* we say do this recursively
4848
*/
49-
var testContext = require.context('../src', true, /\.spec\.ts/);
49+
var testContext = require.context('../src/demo', true, /\.spec\.ts/);
5050

5151
/**
5252
* Get all the files, for each file, call the context function

0 commit comments

Comments
 (0)