Skip to content

Commit 19e1481

Browse files
committed
Adding common files. [pending rebase]
1 parent d65db66 commit 19e1481

File tree

8 files changed

+5863
-3110
lines changed

8 files changed

+5863
-3110
lines changed

copyStaticAssets.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as shell from "shelljs";
22

3-
shell.cp("-R", "src/public/js/lib", "dist/public/js/");
43
shell.cp("-R", "src/public/fonts", "dist/public/");
54
shell.cp("-R", "src/public/images", "dist/public/");

package-lock.json

Lines changed: 5751 additions & 3103 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"watch-test": "npm run test -- --watchAll",
1919
"build-ts": "tsc",
2020
"watch-ts": "tsc -w",
21+
"build-bundle": "browserify dist/public/js/Site.js -o dist/public/js/Site.bundle.js",
22+
"watch-bundle": "watchify dist/public/js/Site.js -o dist/public/js/Site.bundle.js",
2123
"lint": "tsc --noEmit && eslint \"**/*.{js,ts}\" --quiet --fix",
2224
"copy-static-assets": "ts-node copyStaticAssets.ts",
2325
"debug": "npm run build && npm run watch-debug",
@@ -82,14 +84,14 @@
8284
"@typescript-eslint/eslint-plugin": "^2.3.1",
8385
"@typescript-eslint/parser": "^2.3.1",
8486
"chai": "^4.2.0",
85-
"concurrently": "^5.0.0",
87+
"concurrently": "^5.2.0",
8688
"eslint": "^6.4.0",
87-
"jest": "^24.9.0",
88-
"node-sass": "^4.13.0",
89-
"nodemon": "^1.19.2",
89+
"jest": "^26.0.1",
90+
"node-sass": "^4.14.1",
91+
"nodemon": "^2.0.4",
9092
"shelljs": "^0.8.3",
9193
"supertest": "^4.0.2",
92-
"ts-jest": "^24.1.0",
94+
"ts-jest": "^26.1.0",
9395
"ts-node": "^8.4.1",
9496
"typescript": "^3.6.3"
9597
}

src/public/js/components/Base.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Auto[Generating:V1]--->
2+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.
3+
4+
import {CodeHelper} from '../helpers/CodeHelper';
5+
import {Project, DeclarationHelper} from '../helpers/DeclarationHelper';
6+
7+
declare let React: any;
8+
declare let ReactDOM: any;
9+
10+
interface IBaseProps {
11+
}
12+
13+
interface IBaseState {
14+
}
15+
16+
let DefaultBaseProps: any = {
17+
};
18+
let DefaultBaseState: any = {
19+
};
20+
21+
class Base extends React.Component {
22+
protected state: IBaseState = {};
23+
protected static defaultProps: IBaseProps = DefaultBaseProps;
24+
25+
constructor(props) {
26+
super(props);
27+
Object.assign(this.state, CodeHelper.clone(DefaultBaseState));
28+
}
29+
30+
protected render() { }
31+
}
32+
33+
DeclarationHelper.declare('Site', 'Components.Base', Base);
34+
35+
export {IBaseProps, IBaseState, DefaultBaseProps, DefaultBaseState, Base};
36+
37+
// <--- Auto[Generating:V1]
38+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.

src/public/js/helpers/CodeHelper.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Auto[Generating:V1]--->
2+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.
3+
4+
var CodeHelper = {
5+
clone: (obj: any) => {
6+
return JSON.parse(JSON.stringify(obj));
7+
}
8+
};
9+
10+
export {CodeHelper};
11+
12+
// <--- Auto[Generating:V1]
13+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Auto[Generating:V1]--->
2+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.
3+
4+
var Project = {};
5+
6+
var DeclarationHelper = {
7+
declareNamespace: (path: string) => {
8+
let splited = path.split('.');
9+
let current: any = Project;
10+
11+
splited.forEach((name) => {
12+
if (current[name] === undefined) {
13+
current[name] = {};
14+
}
15+
current = current[name];
16+
});
17+
18+
return current;
19+
},
20+
21+
'declare': (level: string, path: string, klass: any) => {
22+
let splited = path.split('.');
23+
let name = splited.pop();
24+
let namespacePath = splited.join('.');
25+
26+
let namespace = DeclarationHelper.declareNamespace(namespacePath);
27+
namespace[name] = klass;
28+
29+
return namespace[name];
30+
}
31+
};
32+
33+
export {Project, DeclarationHelper};
34+
35+
// <--- Auto[Generating:V1]
36+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.

src/public/js/helpers/EventHelper.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Auto[Generating:V1]--->
2+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.
3+
4+
var EventHelper = {
5+
cancel: (event: Event) => {
6+
event.preventDefault();
7+
event.stopPropagation();
8+
9+
return false;
10+
}
11+
};
12+
13+
export {EventHelper};
14+
15+
// <--- Auto[Generating:V1]
16+
// PLEASE DO NOT MODIFY BECUASE YOUR CHANGES MAY BE LOST.

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"esModuleInterop": true,
55
"allowSyntheticDefaultImports": true,
66
"target": "es6",
7-
"noImplicitAny": true,
7+
"jsx": "react",
8+
"noImplicitAny": false,
89
"moduleResolution": "node",
910
"sourceMap": true,
1011
"outDir": "dist",

0 commit comments

Comments
 (0)