Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

Commit ef84d56

Browse files
committed
Initial version
0 parents  commit ef84d56

Some content is hidden

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

60 files changed

+17326
-0
lines changed

.babelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": [
3+
["topcoder-react-utils/config/babel/node-ssr"]
4+
]
5+
}

.browserslistrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
> 1%

.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__coverage__
2+
build
3+
node_modules

.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/topcoder-react-utils/config/eslint/default.json"
3+
}

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
11+
# Directory for instrumented libs generated by jscoverage/JSCover
12+
lib-cov
13+
14+
# Coverage directory used by tools like istanbul
15+
__coverage__
16+
coverage
17+
18+
# nyc test coverage
19+
.nyc_output
20+
21+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
22+
.grunt
23+
24+
# node-waf configuration
25+
.lock-wscript
26+
27+
# Compiled binary addons (http://nodejs.org/api/addons.html)
28+
build
29+
30+
# Dependency directories
31+
node_modules
32+
jspm_packages
33+
34+
# Optional npm cache directory
35+
.npm
36+
37+
# Optional REPL history
38+
.node_repl_history
39+
40+
# Elastic Beanstalk Files
41+
.elasticbeanstalk/*
42+
!.elasticbeanstalk/*.cfg.yml
43+
!.elasticbeanstalk/*.global.yml
44+
45+
# macOS system files
46+
*.DS_Store
47+
48+
# Misc files
49+
.build-info
50+
.vscode

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v8.11.1

.stylelintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "./node_modules/topcoder-react-utils/config/stylelint/default.json",
3+
}

AUTHORS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Topcoder ReactJS Starting Pack
2+
3+
### Topcoder Community Members
4+
Dr. Sergey Pogodin aka *birdofpreyru*, <[email protected]>

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Topcoder ReactJS Starting Pack Changelog
2+
3+
### v0.0.x
4+
Pre-realease drafts of the initial package version. A big journey starts here.

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Topcoder ReactJS Starting Pack
2+
3+
*TO BE WRITTEN.*

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# MIT License
2+
Copyright (c) 2018, Topcoder
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5+
this software and associated documentation files (the "Software"), to deal in
6+
the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8+
of the Software, and to permit persons to whom the Software is furnished to do
9+
so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Topcoder React Starting Pack
2+
3+
*Some shields will be added here.*
4+
5+
The easiest way to start a complex ReactJS project based on
6+
[`topcoder-react-utils`](https://www.npmjs.com/package/topcoder-react-utils).
7+
8+
*Some boilerplate deployment instructions should go here.*

__tests__/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../node_modules/topcoder-react-utils/config/eslint/jest.json"
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Passes basic testing 1`] = `
4+
Array [
5+
Object {
6+
"applicationModulePath": "/home/birdofprey/Documents/topcoder/Topcoder/topcoder-react-starter/src/shared/index.jsx",
7+
"getApplication": [Function],
8+
"moduleHot": undefined,
9+
"storeFactory": [Function],
10+
},
11+
]
12+
`;

__tests__/client/index.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
jest.mock('shared', () => ({
2+
default: 'APPLICATION',
3+
}));
4+
5+
jest.mock('reducers', () => ({
6+
factory: () => () => ({}),
7+
}));
8+
9+
jest.mock('topcoder-react-utils', () => {
10+
const TRU = require.requireActual('topcoder-react-utils');
11+
return {
12+
...TRU,
13+
client: jest.fn(),
14+
};
15+
});
16+
17+
test('Passes basic testing', () => {
18+
require('client');
19+
const { client } = require('topcoder-react-utils');
20+
21+
const args = client.mock.calls[0];
22+
expect(args).toMatchSnapshot();
23+
24+
expect(args[0].getApplication()).toBe('APPLICATION');
25+
26+
expect(args[0].storeFactory()).toBeInstanceOf(Promise);
27+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Passes basic tests 1`] = `
4+
Array [
5+
Object {},
6+
Object {
7+
"Application": "APPLICATION",
8+
"beforeRender": [Function],
9+
"devMode": false,
10+
},
11+
]
12+
`;

__tests__/server/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
jest.mock('shared', () => 'APPLICATION');
2+
jest.mock('reducers', () => ({ factory: jest.fn(() => () => ({})) }));
3+
jest.mock('../../webpack.config', () => () => ({}));
4+
5+
jest.mock('topcoder-react-utils', () => {
6+
const TRU = require.requireActual('topcoder-react-utils');
7+
return {
8+
...TRU,
9+
server: jest.fn(),
10+
};
11+
});
12+
13+
test('Passes basic tests', () => {
14+
require('server');
15+
const { server } = require('topcoder-react-utils');
16+
expect(server.mock.calls).toHaveLength(1);
17+
expect(server.mock.calls[0]).toMatchSnapshot();
18+
const { beforeRender } = server.mock.calls[0][1];
19+
expect(() => beforeRender()).not.toThrow();
20+
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Matches shallow snapshot 1`] = `
4+
<div>
5+
<Connect(MetaTags)
6+
description="Yet another webapp based on Topcoder React Starter Kit"
7+
title="Topcoder React Starter"
8+
/>
9+
<Routes />
10+
</div>
11+
`;
12+
13+
exports[`Matches shallow snapshot in dev mode 1`] = `
14+
<div>
15+
<Connect(MetaTags)
16+
description="Yet another webapp based on Topcoder React Starter Kit"
17+
title="Topcoder React Starter"
18+
/>
19+
<Routes />
20+
<DevTools />
21+
</div>
22+
`;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import Error404Page from 'components/Error404Page';
2+
import React from 'react';
3+
import { JU } from 'topcoder-react-utils';
4+
5+
test('Matches shallow snapshot', () => {
6+
JU.shallowSnapshot(<Error404Page />);
7+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import HelloWorld from 'components/HelloWorld';
2+
import React from 'react';
3+
import { JU } from 'topcoder-react-utils';
4+
5+
test('Matches shallow snapshot', () => {
6+
JU.shallowSnapshot(<HelloWorld />);
7+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Matches shallow snapshot 1`] = `
4+
<h1>
5+
Error 404: Requested resource is not found.
6+
</h1>
7+
`;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Matches shallow snapshot 1`] = `
4+
<div>
5+
<h1
6+
className="src-shared-components-HelloWorld-___style__title___UXPoT"
7+
>
8+
Hello World!
9+
</h1>
10+
<p>
11+
Topcoder React Starter is up!
12+
</p>
13+
</div>
14+
`;

__tests__/shared/index.jsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import Application from 'shared';
2+
import React from 'react';
3+
4+
const { JU } = require.requireActual('topcoder-react-utils');
5+
6+
let mockDevFrontendMode = false;
7+
8+
jest.mock('topcoder-react-utils', () => {
9+
const TRU = require.requireActual('topcoder-react-utils');
10+
return {
11+
...TRU,
12+
isomorphy: {
13+
...TRU.isomorphy,
14+
isDevBuild: () => mockDevFrontendMode,
15+
},
16+
};
17+
});
18+
19+
test('Matches shallow snapshot', () => {
20+
JU.shallowSnapshot(<Application />);
21+
});
22+
23+
test('Matches shallow snapshot in dev mode', () => {
24+
mockDevFrontendMode = true;
25+
JU.shallowSnapshot(<Application />);
26+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Reducer created with HTTP request Creates expected initial state 1`] = `
4+
Object {
5+
"domain": "http://test-website.com",
6+
}
7+
`;
8+
9+
exports[`Reducer created without HTTP request Creates expected initial state 1`] = `Object {}`;

__tests__/shared/reducers/index.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { factory } from 'reducers';
2+
3+
describe('Reducer created without HTTP request', () => {
4+
let reducer;
5+
6+
beforeAll(async () => {
7+
reducer = await factory();
8+
});
9+
10+
test('Creates expected initial state', () => {
11+
expect(reducer()).toMatchSnapshot();
12+
});
13+
});
14+
15+
16+
describe('Reducer created with HTTP request', async () => {
17+
let reducer;
18+
19+
beforeAll(async () => {
20+
reducer = await factory({
21+
headers: {
22+
23+
},
24+
hostname: 'test-website.com',
25+
protocol: 'http',
26+
});
27+
});
28+
29+
test('Creates expected initial state', () => {
30+
expect(reducer()).toMatchSnapshot();
31+
});
32+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Matches shallow snapshot 1`] = `
4+
<Switch>
5+
<Route
6+
component={[Function]}
7+
exact={true}
8+
path="/"
9+
/>
10+
<Error404Page />
11+
</Switch>
12+
`;

__tests__/shared/routes/index.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import Routes from 'routes';
3+
import { JU } from 'topcoder-react-utils';
4+
5+
test('Matches shallow snapshot', () => {
6+
JU.shallowSnapshot(<Routes />);
7+
});

bin/www

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
require('babel-register');
4+
require('../src/server');
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/**
2+
* Configure here, which config parameters should be overriden by values from
3+
* specified environment variables, if they are set.
4+
*/
5+
6+
module.exports = {};

config/default.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/**
2+
* Common configuration.
3+
*/
4+
5+
module.exports = {
6+
placeholderKey: 'PLACEHOLDER VALUE',
7+
};

config/development.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Development-specific configuration.
3+
*/
4+
5+
module.exports = {};

config/jest/default.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const config = require('topcoder-react-utils/config/jest/default');
2+
3+
module.exports = config;

config/jest/setup.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import 'topcoder-react-utils/config/jest/setup';

config/production.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Production-specific configuration.
3+
*/
4+
5+
module.exports = {};

config/test.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/**
2+
* Test-specific configuration.
3+
*/
4+
5+
module.exports = {};

0 commit comments

Comments
 (0)