/node_modules/fbjs/.*
3 |
4 | [include]
5 |
6 | [libs]
7 |
8 | [options]
9 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/.template.dependencies.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "babel-register": "6.22.0",
4 | "babel-plugin-transform-es2015-modules-commonjs": "6.22.0",
5 | "babel-polyfill": "6.20.0",
6 | "chai": "3.5.0",
7 | "jsdom": "9.8.3",
8 | "mocha": "3.2.0",
9 | "normalize.css": "7.0.0",
10 | "prop-types": "15.5.6",
11 | "test-integrity": "1.0.0"
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/README.md:
--------------------------------------------------------------------------------
1 | # Contributing to Create React App's E2E tests
2 |
3 | This is an end to end kitchensink test suite, but has multiple usages in it.
4 |
5 | ## Running the test suite
6 |
7 | Tests are automatically run by the CI tools.
8 | In order to run them locally, without having to manually install and configure everything, the `yarn e2e:docker` CLI command can be used.
9 |
10 | This is a simple script that runs a **Docker** container, where the node version, git branch to clone, test suite, and whether to run it with `yarn` or `npm` can be chosen.
11 | Simply run `yarn e2e:docker -- --help` to get additional info.
12 |
13 | If you need guidance installing **Docker**, you should follow their [official docs](https://docs.docker.com/engine/installation/).
14 |
15 | ## Writing tests
16 |
17 | Each time a new feature is added, it is advised to add at least one test covering it.
18 |
19 | Features are categorized by their scope:
20 |
21 | - *env*, all those which deal with environment variables (e.g. `NODE_PATH`)
22 |
23 | - *syntax*, all those which showcase a single EcmaScript syntax feature that is expected to be transpiled by **Babel**
24 |
25 | - *webpack*, all those which make use of webpack settings, loaders or plugins
26 |
27 | ### Using it as Unit Tests
28 |
29 | In it's most basic for this serve as a collection of unit tests on a single functionality.
30 |
31 | Unit tests are written in a `src/features/**/*.test.js` file located in the same folder as the feature they test, and usually consist of a simple `ReactDOM.render` call.
32 |
33 | These tests are run by **jest** and the environment is `test`, so that it resembles how a **Create React App** application is tested.
34 |
35 | ### Using it as Integration Tests
36 |
37 | This suite tests how the single features as before behave while development and in production.
38 | A local HTTP server is started, then every single feature is loaded, one by one, to be tested.
39 |
40 | Test are written in `integration/{env|syntax|webpack}.test.js`, depending on their scope.
41 |
42 | For every test case added there is just a little chore to do:
43 |
44 | - a `case` statement must be added in `src/App.js`, which simply perform a dynamic `import()` of the feature
45 |
46 | - add a test case in the appropriate integration test file, which calls and awaits `initDOM` with the previous `SwitchCase` string
47 |
48 | An usual flow for the test itself is something similar to:
49 |
50 | - add an `id` attribute in a target HTML tag in the feature itself
51 |
52 | - since `initDOM` returns a `Document` element, the previous `id` attribute is used to target the feature's DOM and `expect` accordingly
53 |
54 | These tests are run by **mocha** (why not **jest**? See [this issue](https://github.com/facebook/jest/issues/2288)) and the environments used are both `development` and `production`.
55 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | node_modules
5 |
6 | # testing
7 | coverage
8 |
9 | # production
10 | build
11 |
12 | # misc
13 | .DS_Store
14 | .env
15 | npm-debug.log
16 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/integration/initDOM.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | const fs = require('fs');
9 | const http = require('http');
10 | const jsdom = require('jsdom');
11 | const path = require('path');
12 | const { expect } = require('chai');
13 |
14 | let getMarkup;
15 | let resourceLoader;
16 |
17 | if (process.env.E2E_FILE) {
18 | const file = path.isAbsolute(process.env.E2E_FILE)
19 | ? process.env.E2E_FILE
20 | : path.join(process.cwd(), process.env.E2E_FILE);
21 |
22 | const markup = fs.readFileSync(file, 'utf8');
23 | getMarkup = () => markup;
24 |
25 | const pathPrefix = process.env.PUBLIC_URL.replace(/^https?:\/\/[^/]+\/?/, '');
26 |
27 | resourceLoader = (resource, callback) =>
28 | callback(
29 | null,
30 | fs.readFileSync(
31 | path.join(
32 | path.dirname(file),
33 | resource.url.pathname.replace(pathPrefix, '')
34 | ),
35 | 'utf8'
36 | )
37 | );
38 | } else if (process.env.E2E_URL) {
39 | getMarkup = () =>
40 | new Promise(resolve => {
41 | http.get(process.env.E2E_URL, res => {
42 | let rawData = '';
43 | res.on('data', chunk => (rawData += chunk));
44 | res.on('end', () => resolve(rawData));
45 | });
46 | });
47 |
48 | resourceLoader = (resource, callback) => resource.defaultFetch(callback);
49 | } else {
50 | it.only(
51 | 'can run jsdom (at least one of "E2E_FILE" or "E2E_URL" environment variables must be provided)',
52 | () => {
53 | expect(
54 | new Error("This isn't the error you are looking for.")
55 | ).to.be.undefined();
56 | }
57 | );
58 | }
59 |
60 | export default feature =>
61 | new Promise(async resolve => {
62 | const markup = await getMarkup();
63 | const host = process.env.E2E_URL || 'http://www.example.org/spa:3000';
64 | const doc = jsdom.jsdom(markup, {
65 | features: {
66 | FetchExternalResources: ['script', 'css'],
67 | ProcessExternalResources: ['script'],
68 | },
69 | created: (_, win) =>
70 | win.addEventListener('ReactFeatureDidMount', () => resolve(doc), true),
71 | deferClose: true,
72 | resourceLoader,
73 | url: `${host}#${feature}`,
74 | virtualConsole: jsdom.createVirtualConsole().sendTo(console),
75 | });
76 |
77 | doc.close();
78 | });
79 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/integration/webpack.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import { expect } from 'chai';
9 | import initDOM from './initDOM';
10 |
11 | describe('Integration', () => {
12 | describe('Webpack plugins', () => {
13 | it('css inclusion', async () => {
14 | const doc = await initDOM('css-inclusion');
15 |
16 | expect(
17 | doc.getElementsByTagName('style')[0].textContent.replace(/\s/g, '')
18 | ).to.match(/html\{/);
19 | expect(
20 | doc.getElementsByTagName('style')[1].textContent.replace(/\s/g, '')
21 | ).to.match(/#feature-css-inclusion\{background:.+;color:.+}/);
22 | });
23 |
24 | it('image inclusion', async () => {
25 | const doc = await initDOM('image-inclusion');
26 |
27 | expect(doc.getElementById('feature-image-inclusion').src).to.match(
28 | /^data:image\/jpeg;base64.+==$/
29 | );
30 | });
31 |
32 | it('no ext inclusion', async () => {
33 | const doc = await initDOM('no-ext-inclusion');
34 |
35 | expect(doc.getElementById('feature-no-ext-inclusion').href).to.match(
36 | /\/static\/media\/aFileWithoutExt\.[a-f0-9]{8}\.bin$/
37 | );
38 | });
39 |
40 | it('json inclusion', async () => {
41 | const doc = await initDOM('json-inclusion');
42 |
43 | expect(doc.getElementById('feature-json-inclusion').textContent).to.equal(
44 | 'This is an abstract.'
45 | );
46 | });
47 |
48 | it('linked modules', async () => {
49 | const doc = await initDOM('linked-modules');
50 |
51 | expect(doc.getElementById('feature-linked-modules').textContent).to.equal(
52 | '2.0.0'
53 | );
54 | });
55 |
56 | it('svg inclusion', async () => {
57 | const doc = await initDOM('svg-inclusion');
58 |
59 | expect(doc.getElementById('feature-svg-inclusion').src).to.match(
60 | /\/static\/media\/logo\..+\.svg$/
61 | );
62 | });
63 |
64 | it('unknown ext inclusion', async () => {
65 | const doc = await initDOM('unknown-ext-inclusion');
66 |
67 | expect(doc.getElementById('feature-unknown-ext-inclusion').href).to.match(
68 | /\/static\/media\/aFileWithExt\.[a-f0-9]{8}\.unknown$/
69 | );
70 | });
71 | });
72 | });
73 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/netguru/create-react-app/a2f2ffa257f73b840f4024486f379c332d7ed36c/packages/react-scripts/fixtures/kitchensink/public/favicon.ico
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | React App
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/absoluteLoad.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | export default () => [
9 | { id: 1, name: '1' },
10 | { id: 2, name: '2' },
11 | { id: 3, name: '3' },
12 | { id: 4, name: '4' },
13 | ];
14 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/ExpandEnvVariables.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 |
10 | export default () => (
11 |
12 | {process.env.REACT_APP_BASIC}
13 | {process.env.REACT_APP_BASIC_EXPAND}
14 |
15 | {process.env.REACT_APP_BASIC_EXPAND_SIMPLE}
16 |
17 |
18 | {process.env.REACT_APP_EXPAND_EXISTING}
19 |
20 |
21 | );
22 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/ExpandEnvVariables.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ExpandEnvVariables from './ExpandEnvVariables';
11 |
12 | describe('expand .env variables', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/FileEnvVariables.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 |
10 | export default () => (
11 |
12 |
13 | {process.env.REACT_APP_ORIGINAL_1}
14 |
15 |
16 | {process.env.REACT_APP_ORIGINAL_2}
17 |
18 |
19 | {process.env.REACT_APP_DEVELOPMENT}
20 | {process.env.REACT_APP_PRODUCTION}
21 |
22 | {process.env.REACT_APP_X}
23 |
24 | );
25 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/FileEnvVariables.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import FileEnvVariables from './FileEnvVariables';
11 |
12 | describe('.env variables', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/NodePath.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 | import load from 'absoluteLoad';
11 |
12 | export default class extends Component {
13 | static propTypes = {
14 | onReady: PropTypes.func.isRequired,
15 | };
16 |
17 | constructor(props) {
18 | super(props);
19 | this.state = { users: [] };
20 | }
21 |
22 | async componentDidMount() {
23 | const users = load();
24 | this.setState({ users });
25 | }
26 |
27 | componentDidUpdate() {
28 | this.props.onReady();
29 | }
30 |
31 | render() {
32 | return (
33 |
34 | {this.state.users.map(user =>
{user.name}
)}
35 |
36 | );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/NodePath.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import NodePath from './NodePath';
11 |
12 | describe('NODE_PATH', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/PublicUrl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 |
10 | export default () => (
11 | {process.env.PUBLIC_URL}.
12 | );
13 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/PublicUrl.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import PublicUrl from './PublicUrl';
11 |
12 | describe('PUBLIC_URL', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/ShellEnvVariables.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 |
10 | export default () => (
11 |
12 | {process.env.REACT_APP_SHELL_ENV_MESSAGE}.
13 |
14 | );
15 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/env/ShellEnvVariables.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ShellEnvVariables from './ShellEnvVariables';
11 |
12 | describe('shell env variables', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArrayDestructuring.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load() {
12 | return [[1, '1'], [2, '2'], [3, '3'], [4, '4']];
13 | }
14 |
15 | export default class extends Component {
16 | static propTypes = {
17 | onReady: PropTypes.func.isRequired,
18 | };
19 |
20 | constructor(props) {
21 | super(props);
22 | this.state = { users: [] };
23 | }
24 |
25 | async componentDidMount() {
26 | const users = load();
27 | this.setState({ users });
28 | }
29 |
30 | componentDidUpdate() {
31 | this.props.onReady();
32 | }
33 |
34 | render() {
35 | return (
36 |
37 | {this.state.users.map(user => {
38 | const [id, name] = user;
39 | return
{name}
;
40 | })}
41 |
42 | );
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArrayDestructuring.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ArrayDestructuring from './ArrayDestructuring';
11 |
12 | describe('array destructuring', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArraySpread.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load(users) {
12 | return [
13 | { id: 1, name: '1' },
14 | { id: 2, name: '2' },
15 | { id: 3, name: '3' },
16 | ...users,
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load([{ id: 42, name: '42' }]);
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user =>
{user.name}
)}
43 |
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ArraySpread.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ArraySpread from './ArraySpread';
11 |
12 | describe('array spread', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/AsyncAwait.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | async function load() {
12 | return [
13 | { id: 1, name: '1' },
14 | { id: 2, name: '2' },
15 | { id: 3, name: '3' },
16 | { id: 4, name: '4' },
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = await load();
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user =>
{user.name}
)}
43 |
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/AsyncAwait.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import AsyncAwait from './AsyncAwait';
11 |
12 | describe('async/await', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | export default class extends Component {
12 | static propTypes = {
13 | onReady: PropTypes.func.isRequired,
14 | };
15 |
16 | users = [
17 | { id: 1, name: '1' },
18 | { id: 2, name: '2' },
19 | { id: 3, name: '3' },
20 | { id: 4, name: '4' },
21 | ];
22 |
23 | componentDidMount() {
24 | this.props.onReady();
25 | }
26 |
27 | render() {
28 | return (
29 |
30 | {this.users.map(user =>
{user.name}
)}
31 |
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ClassProperties.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ClassProperties from './ClassProperties';
11 |
12 | describe('class properties', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ComputedProperties.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load(prefix) {
12 | return [
13 | { id: 1, [`${prefix} name`]: '1' },
14 | { id: 2, [`${prefix} name`]: '2' },
15 | { id: 3, [`${prefix} name`]: '3' },
16 | { id: 4, [`${prefix} name`]: '4' },
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load('user_');
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user => (
43 |
{user.user_name}
44 | ))}
45 |
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ComputedProperties.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ComputedProperties from './ComputedProperties';
11 |
12 | describe('computed properties', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/CustomInterpolation.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | const styled = ([style]) =>
12 | style
13 | .trim()
14 | .split(/\s*;\s*/)
15 | .map(rule => rule.split(/\s*:\s*/))
16 | .reduce((rules, rule) => ({ ...rules, [rule[0]]: rule[1] }), {});
17 |
18 | function load() {
19 | return [
20 | { id: 1, name: '1' },
21 | { id: 2, name: '2' },
22 | { id: 3, name: '3' },
23 | { id: 4, name: '4' },
24 | ];
25 | }
26 |
27 | export default class extends Component {
28 | static propTypes = {
29 | onReady: PropTypes.func.isRequired,
30 | };
31 |
32 | constructor(props) {
33 | super(props);
34 | this.state = { users: [] };
35 | }
36 |
37 | async componentDidMount() {
38 | const users = load();
39 | this.setState({ users });
40 | }
41 |
42 | componentDidUpdate() {
43 | this.props.onReady();
44 | }
45 |
46 | render() {
47 | const veryInlineStyle = styled`
48 | background: palevioletred;
49 | color: papayawhip;
50 | `;
51 |
52 | return (
53 |
54 | {this.state.users.map(user => (
55 |
56 | {user.name}
57 |
58 | ))}
59 |
60 | );
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/CustomInterpolation.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import CustomInterpolation from './CustomInterpolation';
11 |
12 | describe('custom interpolation', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/DefaultParameters.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load(id = 0) {
12 | return [
13 | { id: id + 1, name: '1' },
14 | { id: id + 2, name: '2' },
15 | { id: id + 3, name: '3' },
16 | { id: id + 4, name: '4' },
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load();
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user =>
{user.name}
)}
43 |
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/DefaultParameters.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import DefaultParameters from './DefaultParameters';
11 |
12 | describe('default parameters', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/DestructuringAndAwait.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | async function load() {
12 | return {
13 | users: [
14 | { id: 1, name: '1' },
15 | { id: 2, name: '2' },
16 | { id: 3, name: '3' },
17 | { id: 4, name: '4' },
18 | ],
19 | };
20 | }
21 |
22 | export default class extends Component {
23 | static propTypes = {
24 | onReady: PropTypes.func.isRequired,
25 | };
26 |
27 | constructor(props) {
28 | super(props);
29 | this.state = { users: [] };
30 | }
31 |
32 | async componentDidMount() {
33 | const { users } = await load();
34 | this.setState({ users });
35 | }
36 |
37 | componentDidUpdate() {
38 | this.props.onReady();
39 | }
40 |
41 | render() {
42 | return (
43 |
44 | {this.state.users.map(user =>
{user.name}
)}
45 |
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/DestructuringAndAwait.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import DestructuringAndAwait from './DestructuringAndAwait';
11 |
12 | describe('destructuring and await', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/Generators.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function* load(limit) {
12 | let i = 1;
13 | while (i <= limit) {
14 | yield { id: i, name: i };
15 | i++;
16 | }
17 | }
18 |
19 | export default class extends Component {
20 | static propTypes = {
21 | onReady: PropTypes.func.isRequired,
22 | };
23 |
24 | constructor(props) {
25 | super(props);
26 | this.state = { users: [] };
27 | }
28 |
29 | componentDidMount() {
30 | const users = [];
31 | for (let user of load(4)) {
32 | users.push(user);
33 | }
34 | this.setState({ users });
35 | }
36 |
37 | componentDidUpdate() {
38 | this.props.onReady();
39 | }
40 |
41 | render() {
42 | return (
43 |
44 | {this.state.users.map(user =>
{user.name}
)}
45 |
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/Generators.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import Generators from './Generators';
11 |
12 | describe('generators', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load() {
12 | return [
13 | { id: 1, name: '1' },
14 | { id: 2, name: '2' },
15 | { id: 3, name: '3' },
16 | { id: 4, name: '4' },
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load();
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user => {
43 | const { id, ...rest } = user;
44 | // eslint-disable-next-line no-unused-vars
45 | const [{ name, ...innerRest }] = [{ ...rest }];
46 | return
{name}
;
47 | })}
48 |
49 | );
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectDestructuring.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ObjectDestructuring from './ObjectDestructuring';
11 |
12 | describe('object destructuring', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load(baseUser) {
12 | return [
13 | { id: 1, name: '1', ...baseUser },
14 | { id: 2, name: '2', ...baseUser },
15 | { id: 3, name: '3', ...baseUser },
16 | { id: 4, name: '4', ...baseUser },
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load({ age: 42 });
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user => (
43 |
44 | {user.name}: {user.age}
45 |
46 | ))}
47 |
48 | );
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/ObjectSpread.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ObjectSpread from './ObjectSpread';
11 |
12 | describe('object spread', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/Promises.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load() {
12 | return Promise.resolve([
13 | { id: 1, name: '1' },
14 | { id: 2, name: '2' },
15 | { id: 3, name: '3' },
16 | { id: 4, name: '4' },
17 | ]);
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | componentDidMount() {
31 | load().then(users => {
32 | this.setState({ users });
33 | });
34 | }
35 |
36 | componentDidUpdate() {
37 | this.props.onReady();
38 | }
39 |
40 | render() {
41 | return (
42 |
43 | {this.state.users.map(user =>
{user.name}
)}
44 |
45 | );
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/Promises.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 |
11 | describe('promises', () => {
12 | it('renders without crashing', () => {
13 | const div = document.createElement('div');
14 | return import('./Promises').then(({ default: Promises }) => {
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 | });
21 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestAndDefault.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load({ id, ...rest } = { id: 0, user: { id: 42, name: '42' } }) {
12 | return [
13 | { id: id + 1, name: '1' },
14 | { id: id + 2, name: '2' },
15 | { id: id + 3, name: '3' },
16 | rest.user,
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load();
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user =>
{user.name}
)}
43 |
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestAndDefault.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import RestAndDefault from './RestAndDefault';
11 |
12 | describe('rest + default', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestParameters.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load({ id = 0, ...rest }) {
12 | return [
13 | { id: id + 1, name: '1' },
14 | { id: id + 2, name: '2' },
15 | { id: id + 3, name: '3' },
16 | rest.user,
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load({ id: 0, user: { id: 42, name: '42' } });
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user =>
{user.name}
)}
43 |
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/RestParameters.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import RestParameters from './RestParameters';
11 |
12 | describe('rest parameters', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/TemplateInterpolation.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React, { Component } from 'react';
9 | import PropTypes from 'prop-types';
10 |
11 | function load(name) {
12 | return [
13 | { id: 1, name: `${name}1` },
14 | { id: 2, name: `${name}2` },
15 | { id: 3, name: `${name}3` },
16 | { id: 4, name: `${name}4` },
17 | ];
18 | }
19 |
20 | export default class extends Component {
21 | static propTypes = {
22 | onReady: PropTypes.func.isRequired,
23 | };
24 |
25 | constructor(props) {
26 | super(props);
27 | this.state = { users: [] };
28 | }
29 |
30 | async componentDidMount() {
31 | const users = load('user_');
32 | this.setState({ users });
33 | }
34 |
35 | componentDidUpdate() {
36 | this.props.onReady();
37 | }
38 |
39 | render() {
40 | return (
41 |
42 | {this.state.users.map(user =>
{user.name}
)}
43 |
44 | );
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/syntax/TemplateInterpolation.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import TemplateInterpolation from './TemplateInterpolation';
11 |
12 | describe('template interpolation', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | return new Promise(resolve => {
16 | ReactDOM.render(, div);
17 | });
18 | });
19 | });
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssInclusion.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import './assets/style.css';
10 |
11 | export default () => We love useless text.
;
12 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssInclusion.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import CssInclusion from './CssInclusion';
11 |
12 | describe('css inclusion', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/ImageInclusion.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import tiniestCat from './assets/tiniest-cat.jpg';
10 |
11 | export default () => (
12 |
13 | );
14 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/ImageInclusion.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import ImageInclusion from './ImageInclusion';
11 |
12 | describe('image inclusion', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/JsonInclusion.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import { abstract } from './assets/abstract.json';
10 |
11 | export default () => {abstract};
12 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/JsonInclusion.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import JsonInclusion from './JsonInclusion';
11 |
12 | describe('JSON inclusion', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/LinkedModules.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import './assets/style.css';
10 | import { test, version } from 'test-integrity';
11 |
12 | export default () => {
13 | const v = version();
14 | if (!test() || v !== '2.0.0') {
15 | throw new Error('Functionality test did not pass.');
16 | }
17 | return {v}
;
18 | };
19 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/LinkedModules.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import { test, version } from 'test-integrity';
11 | import LinkedModules from './LinkedModules';
12 |
13 | describe('linked modules', () => {
14 | it('has integrity', () => {
15 | expect(test());
16 | expect(version() === '2.0.0');
17 | });
18 |
19 | it('renders without crashing', () => {
20 | const div = document.createElement('div');
21 | ReactDOM.render(, div);
22 | });
23 | });
24 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/NoExtInclusion.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import aFileWithoutExt from './assets/aFileWithoutExt';
10 |
11 | const text = aFileWithoutExt.includes('base64')
12 | ? atob(aFileWithoutExt.split('base64,')[1]).trim()
13 | : aFileWithoutExt;
14 |
15 | export default () => (
16 |
17 | aFileWithoutExt
18 |
19 | );
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/NoExtInclusion.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import NoExtInclusion from './NoExtInclusion';
11 |
12 | describe('no ext inclusion', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgInclusion.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import logo from './assets/logo.svg';
10 |
11 | export default () =>
;
12 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/SvgInclusion.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import SvgInclusion from './SvgInclusion';
11 |
12 | describe('svg inclusion', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/UnknownExtInclusion.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import aFileWithExtUnknown from './assets/aFileWithExt.unknown';
10 |
11 | const text = aFileWithExtUnknown.includes('base64')
12 | ? atob(aFileWithExtUnknown.split('base64,')[1]).trim()
13 | : aFileWithExtUnknown;
14 |
15 | export default () => (
16 |
17 | aFileWithExtUnknown
18 |
19 | );
20 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/UnknownExtInclusion.test.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import UnknownExtInclusion from './UnknownExtInclusion';
11 |
12 | describe('unknown ext inclusion', () => {
13 | it('renders without crashing', () => {
14 | const div = document.createElement('div');
15 | ReactDOM.render(, div);
16 | });
17 | });
18 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/aFileWithExt.unknown:
--------------------------------------------------------------------------------
1 | Whoooo, spooky!
2 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/aFileWithoutExt:
--------------------------------------------------------------------------------
1 | This is just a file without an extension
2 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/abstract.json:
--------------------------------------------------------------------------------
1 | {
2 | "abstract": "This is an abstract."
3 | }
4 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/logo.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/style.css:
--------------------------------------------------------------------------------
1 | /*
2 | * Ensure CSS inclusion doesn't regress
3 | * https://github.com/facebookincubator/create-react-app/issues/2677
4 | */
5 | @import '~normalize.css/normalize.css';
6 |
7 | #feature-css-inclusion {
8 | background: palevioletred;
9 | color: papayawhip;
10 | }
11 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/tiniest-cat.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/netguru/create-react-app/a2f2ffa257f73b840f4024486f379c332d7ed36c/packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/tiniest-cat.jpg
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | import React from 'react';
9 | import ReactDOM from 'react-dom';
10 | import App from './App';
11 |
12 | ReactDOM.render(, document.getElementById('root'));
13 |
--------------------------------------------------------------------------------
/packages/react-scripts/fixtures/kitchensink/src/subfolder/lol.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2015-present, Facebook, Inc.
3 | *
4 | * This source code is licensed under the MIT license found in the
5 | * LICENSE file in the root directory of this source tree.
6 | */
7 |
8 | module.exports = function() {
9 | return `haha`;
10 | };
11 |
--------------------------------------------------------------------------------
/packages/react-scripts/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@netguru/react-scripts",
3 | "version": "3.1.1",
4 | "description": "Netguru configuration and scripts for Create React App",
5 | "repository": "netguru/create-react-app",
6 | "license": "MIT",
7 | "engines": {
8 | "node": ">=6"
9 | },
10 | "bugs": {
11 | "url": "https://github.com/netguru/create-react-app/issues"
12 | },
13 | "files": [
14 | "bin",
15 | "config",
16 | "scripts",
17 | "template",
18 | "utils"
19 | ],
20 | "bin": {
21 | "react-scripts": "./bin/react-scripts.js"
22 | },
23 | "dependencies": {
24 | "autoprefixer": "7.1.6",
25 | "babel-core": "6.26.0",
26 | "babel-eslint": "7.2.3",
27 | "babel-jest": "20.0.3",
28 | "babel-loader": "7.1.2",
29 | "babel-preset-env": "1.6.1",
30 | "babel-preset-es2015": "^6.24.1",
31 | "babel-preset-react": "^6.24.1",
32 | "babel-preset-stage-2": "^6.24.1",
33 | "babel-runtime": "6.26.0",
34 | "case-sensitive-paths-webpack-plugin": "2.1.1",
35 | "chalk": "1.1.3",
36 | "css-loader": "0.28.7",
37 | "dotenv": "4.0.0",
38 | "dotenv-expand": "4.2.0",
39 | "eslint": "~4.15.0",
40 | "eslint-config-airbnb": "^16.1.0",
41 | "eslint-import-resolver-webpack": "^0.8.1",
42 | "identity-obj-proxy": "3.0.0",
43 | "node-sass": "^4.5.3",
44 | "sass-loader": "^6.0.6",
45 | "stylelint": "~8.4.0",
46 | "stylelint-config-css-modules": "^1.0.0",
47 | "stylelint-config-standard": "^18.0.0",
48 | "stylelint-declaration-use-variable": "^1.6.0",
49 | "stylelint-order": "^0.5.0",
50 | "eslint-loader": "1.9.0",
51 | "eslint-plugin-flowtype": "2.39.1",
52 | "eslint-plugin-import": "^2.8.0",
53 | "eslint-plugin-jsx-a11y": "^6.0.3",
54 | "eslint-plugin-react": "^7.4.0",
55 | "extract-text-webpack-plugin": "3.0.2",
56 | "file-loader": "1.1.5",
57 | "fs-extra": "3.0.1",
58 | "html-webpack-plugin": "2.29.0",
59 | "jest": "20.0.4",
60 | "object-assign": "4.1.1",
61 | "postcss-flexbugs-fixes": "3.2.0",
62 | "postcss-loader": "2.0.8",
63 | "promise": "8.0.1",
64 | "raf": "3.4.0",
65 | "raw-loader": "^0.5.1",
66 | "react-dev-utils": "^5.0.2",
67 | "resolve": "1.6.0",
68 | "style-loader": "0.19.0",
69 | "svg-react-loader": "0.4.5",
70 | "sw-precache-webpack-plugin": "0.11.4",
71 | "url-loader": "0.6.2",
72 | "webpack": "3.8.1",
73 | "webpack-dev-server": "2.11.3",
74 | "webpack-manifest-plugin": "1.3.2",
75 | "whatwg-fetch": "2.0.3"
76 | },
77 | "devDependencies": {
78 | "react": "^16.0.0",
79 | "react-dom": "^16.0.0",
80 | "react-hot-loader": "^4.3.2",
81 | "normalize.css": "^7.0.0"
82 | },
83 | "optionalDependencies": {
84 | "fsevents": "^1.1.3"
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [ "env", { "modules": false } ],
4 | "es2015",
5 | "stage-2",
6 | "react"
7 | ],
8 | "plugins": ["react-hot-loader/babel"]
9 | }
10 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 | end_of_line = lf
10 | # editorconfig-tools is unable to ignore longs strings or urls
11 | max_line_length = null
12 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: 'airbnb',
3 | parser: 'babel-eslint',
4 | env: {
5 | jest: true,
6 | browser: true,
7 | },
8 | settings: {
9 | 'import/resolver': {
10 | webpack: {
11 | config: {
12 | resolve: {
13 | modules: ['node_modules', 'src'],
14 | extensions: ['.js', '.json', '.jsx'],
15 | },
16 | },
17 | },
18 | },
19 | },
20 | rules: {
21 | 'react/jsx-filename-extension': [
22 | 2, { extensions: ['.js'] },
23 | ],
24 | },
25 | };
26 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 |
6 | # testing
7 | /coverage
8 |
9 | # production
10 | /build
11 |
12 | # misc
13 | .DS_Store
14 | .env.local
15 | .env.development.local
16 | .env.test.local
17 | .env.production.local
18 |
19 | npm-debug.log*
20 | yarn-debug.log*
21 | yarn-error.log*
22 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/netguru/create-react-app/a2f2ffa257f73b840f4024486f379c332d7ed36c/packages/react-scripts/template/public/favicon.ico
--------------------------------------------------------------------------------
/packages/react-scripts/template/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
22 | React App
23 |
24 |
25 |
28 |
29 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/components/App/index.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { hot } from 'react-hot-loader';
3 | import logo from './logo.svg';
4 | import LogoInline from './logo.inline.svg';
5 | import styles from './style.scss';
6 |
7 | class App extends Component {
8 | state = {
9 | count: 0,
10 | };
11 |
12 | componentDidMount() {
13 | setInterval(this.increment, 1000);
14 | }
15 |
16 | componentWillUnmount() {
17 | clearInterval(this.increment);
18 | }
19 |
20 | increment = () => {
21 | this.setState(prevState => ({
22 | count: prevState.count + 1,
23 | }));
24 | };
25 |
26 | render() {
27 | return (
28 |
29 |
30 |
31 |
32 |
33 | Welcome to React | Count: {this.state.count}
34 |
35 |
36 |
37 | To get started, edit src/components/App/index.js
and save
38 | to reload.
39 |
40 |
41 | );
42 | }
43 | }
44 |
45 | export { App as AppUnwrapped };
46 | export default hot(module)(App);
47 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/components/App/index.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import { AppUnwrapped as App } from './index';
4 |
5 | it('renders without crashing', () => {
6 | const div = document.createElement('div');
7 | ReactDOM.render(, div);
8 | ReactDOM.unmountComponentAtNode(div);
9 | });
10 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/components/App/logo.inline.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/components/App/logo.svg:
--------------------------------------------------------------------------------
1 |
8 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/components/App/style.scss:
--------------------------------------------------------------------------------
1 | @import '~shared/styles/index.scss';
2 |
3 | .app {
4 | text-align: center;
5 | }
6 |
7 | .appLogo {
8 | @include circle(80px);
9 |
10 | background: $white;
11 | animation: appLogoSpin infinite 20s linear;
12 | }
13 |
14 | .appHeader {
15 | height: 150px;
16 | padding: 20px;
17 | color: $white;
18 | background: $brand-primary;
19 | }
20 |
21 | .appIntro {
22 | font-size: $fs-1;
23 | }
24 |
25 | .appTitle {
26 | font-size: $fs-2;
27 | }
28 |
29 | @keyframes appLogoSpin {
30 | from {
31 | transform: rotate(0deg);
32 | }
33 |
34 | to {
35 | transform: rotate(360deg);
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import 'normalize.css';
4 |
5 | import App from 'components/App';
6 | import registerServiceWorker from 'utils/registerServiceWorker';
7 |
8 | ReactDOM.render(, document.getElementById('root'));
9 |
10 | registerServiceWorker();
11 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/shared/styles/colors.scss:
--------------------------------------------------------------------------------
1 | $brand-primary: #00d664;
2 | $white: #fff;
3 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/shared/styles/index.scss:
--------------------------------------------------------------------------------
1 | @import './z-index.scss';
2 | @import './colors.scss';
3 | @import './typography.scss';
4 | @import './mixins.scss';
5 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/shared/styles/mixins.scss:
--------------------------------------------------------------------------------
1 | @mixin _position($position, $args) {
2 | @each $dir in top, left, bottom, right {
3 | $i: index($args, $dir);
4 |
5 | @if $i {
6 | #{$dir}: nth($args, $i + 1);
7 | }
8 | }
9 |
10 | position: $position;
11 | }
12 |
13 | @mixin absolute($args) {
14 | @include _position(absolute, $args);
15 | }
16 |
17 | @mixin relative($args) {
18 | @include _position(relative, $args);
19 | }
20 |
21 | @mixin fixed($args) {
22 | @include _position(fixed, $args);
23 | }
24 |
25 | @mixin sizing($args, $prefix: "") {
26 | $width: if(length($args) == 2, nth($args, 1), $args);
27 | $height: if(length($args) == 2, nth($args, 2), $args);
28 |
29 | #{$prefix}width: $width;
30 | #{$prefix}height: $height;
31 | }
32 |
33 | @mixin min-sizing($args) {
34 | @include sizing($args, "min-");
35 | }
36 |
37 | @mixin max-sizing($args) {
38 | @include sizing($args, "max-");
39 | }
40 |
41 | @mixin circle($args) {
42 | @include sizing($args);
43 |
44 | border-radius: 50%;
45 | }
46 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/shared/styles/typography.scss:
--------------------------------------------------------------------------------
1 | $fs-1: 1rem;
2 | $fs-2: 1.5rem;
3 |
--------------------------------------------------------------------------------
/packages/react-scripts/template/src/shared/styles/z-index.scss:
--------------------------------------------------------------------------------
1 | $z-index-1: 1000;
2 | $z-index-2: 2000;
3 | $z-index-3: 3000;
4 | $z-index-4: 4000;
5 | $z-index-5: 5000;
6 | $z-index-6: 6000;
7 | $z-index-7: 7000;
8 | $z-index-8: 8000;
9 | $z-index-9: 9000;
10 |
--------------------------------------------------------------------------------
/tasks/e2e-old-node.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) 2015-present, Facebook, Inc.
3 | #
4 | # This source code is licensed under the MIT license found in the
5 | # LICENSE file in the root directory of this source tree.
6 |
7 | # ******************************************************************************
8 | # This is an end-to-end test intended to run on CI.
9 | # You can also run it locally but it's slow.
10 | # ******************************************************************************
11 |
12 | # Start in tasks/ even if run from root directory
13 | cd "$(dirname "$0")"
14 |
15 | temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'`
16 |
17 | function cleanup {
18 | echo 'Cleaning up.'
19 | cd "$root_path"
20 | rm -rf $temp_app_path
21 | }
22 |
23 | # Error messages are redirected to stderr
24 | function handle_error {
25 | echo "$(basename $0): ERROR! An error was encountered executing line $1." 1>&2;
26 | cleanup
27 | echo 'Exiting with error.' 1>&2;
28 | exit 1
29 | }
30 |
31 | function handle_exit {
32 | cleanup
33 | echo 'Exiting without error.' 1>&2;
34 | exit
35 | }
36 |
37 | # Exit the script with a helpful error message when any error is encountered
38 | trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR
39 |
40 | # Cleanup before exit on any termination signal
41 | trap 'set +x; handle_exit' SIGQUIT SIGTERM SIGINT SIGKILL SIGHUP
42 |
43 | # Echo every command being executed
44 | set -x
45 |
46 | # Go to root
47 | cd ..
48 | root_path=$PWD
49 |
50 | # We need to install create-react-app deps to test it
51 | cd "$root_path"/packages/create-react-app
52 | npm install
53 | cd "$root_path"
54 |
55 | # If the node version is < 6, the script should just give an error.
56 | cd $temp_app_path
57 | err_output=`node "$root_path"/packages/create-react-app/index.js test-node-version 2>&1 > /dev/null || echo ''`
58 | [[ $err_output =~ You\ are\ running\ Node ]] && exit 0 || exit 1
59 |
60 | # Cleanup
61 | cleanup
62 |
--------------------------------------------------------------------------------
/tasks/publish.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Copyright (c) 2015-present, Facebook, Inc.
3 | #
4 | # This source code is licensed under the MIT license found in the
5 | # LICENSE file in the root directory of this source tree.
6 |
7 | # ******************************************************************************
8 | # This releases an update to the `react-scripts` package.
9 | # Don't use `npm publish` for it.
10 | # Read the release instructions:
11 | # https://github.com/facebookincubator/create-react-app/blob/master/CONTRIBUTING.md#cutting-a-release
12 | # ******************************************************************************
13 |
14 | # Start in tasks/ even if run from root directory
15 | cd "$(dirname "$0")"
16 |
17 | # Exit the script on any command with non 0 return code
18 | # We assume that all the commands in the pipeline set their return code
19 | # properly and that we do not need to validate that the output is correct
20 | set -e
21 |
22 | # Echo every command being executed
23 | set -x
24 |
25 | # Go to root
26 | cd ..
27 | root_path=$PWD
28 |
29 | if [ -n "$(git status --porcelain)" ]; then
30 | echo "Your git status is not clean. Aborting.";
31 | exit 1;
32 | fi
33 |
34 | # Compile
35 | cd packages/react-error-overlay/
36 | npm run build:prod
37 | cd ../..
38 | # Go!
39 | ./node_modules/.bin/lerna publish --independent "$@"
--------------------------------------------------------------------------------
/tasks/replace-own-deps.js:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env node
2 | /**
3 | * Copyright (c) 2015-present, Facebook, Inc.
4 | *
5 | * This source code is licensed under the MIT license found in the
6 | * LICENSE file in the root directory of this source tree.
7 | */
8 | 'use strict';
9 |
10 | // Replaces internal dependencies in package.json with local package paths.
11 |
12 | const fs = require('fs');
13 | const path = require('path');
14 |
15 | const packagesDir = path.join(__dirname, '../packages');
16 | const pkgFilename = path.join(packagesDir, 'react-scripts/package.json');
17 | const data = require(pkgFilename);
18 |
19 | fs.readdirSync(packagesDir).forEach((name) => {
20 | if (data.dependencies[name]) {
21 | data.dependencies[name] = 'file:' + path.join(packagesDir, name);
22 | }
23 | })
24 |
25 | fs.writeFile(pkgFilename, JSON.stringify(data, null, 2), 'utf8', (err) => {
26 | if (err) throw err;
27 | console.log('Replaced local dependencies.');
28 | });
29 |
--------------------------------------------------------------------------------