Skip to content

Commit

Permalink
Do some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
EnoahNetzach committed Dec 29, 2016
1 parent ebca9e6 commit b35516b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 102 deletions.
4 changes: 0 additions & 4 deletions packages/react-scripts/fixtures/kitchensink/README.md

This file was deleted.

19 changes: 0 additions & 19 deletions packages/react-scripts/fixtures/kitchensink/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,9 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tag above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favico.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start`.
To create a production bundle, use `npm run build`.
-->
</body>
</html>
103 changes: 31 additions & 72 deletions packages/react-scripts/fixtures/kitchensink/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,136 +5,95 @@ class App extends React.Component {
super(props);

this.state = { feature: null };

this.setFeature = this.setFeature.bind(this);
}

componentDidMount() {
switch (location.hash.slice(1)) {
case 'array-destructuring':
require.ensure(['./features/syntax/ArrayDestructuring'], () =>
this.setState({ feature: require('./features/syntax/ArrayDestructuring').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/ArrayDestructuring').default));
break;
case 'array-spread':
require.ensure(['./features/syntax/ArraySpread'], () =>
this.setState({ feature: require('./features/syntax/ArraySpread').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/ArraySpread').default));
break;
case 'async-await':
require.ensure(['./features/syntax/AsyncAwait'], () =>
this.setState({ feature: require('./features/syntax/AsyncAwait').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/AsyncAwait').default));
break;
case 'class-properties':
require.ensure(['./features/syntax/ClassProperties'], () =>
this.setState({ feature: require('./features/syntax/ClassProperties').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/ClassProperties').default));
break;
case 'computed-properties':
require.ensure(['./features/syntax/ComputedProperties'], () =>
this.setState({ feature: require('./features/syntax/ComputedProperties').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/ComputedProperties').default));
break;
case 'css-inclusion':
require.ensure(['./features/webpack/CssInclusion'], () =>
this.setState({ feature: require('./features/webpack/CssInclusion').default })
);
require.ensure([], () => this.setFeature(require('./features/webpack/CssInclusion').default));
break;
case 'custom-interpolation':
require.ensure(['./features/syntax/CustomInterpolation'], () =>
this.setState({ feature: require('./features/syntax/CustomInterpolation').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/CustomInterpolation').default));
break;
case 'default-parameters':
require.ensure(['./features/syntax/DefaultParameters'], () =>
this.setState({ feature: require('./features/syntax/DefaultParameters').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/DefaultParameters').default));
break;
case 'destructuring-and-await':
require.ensure(['./features/syntax/DestructuringAndAwait'], () =>
this.setState({ feature: require('./features/syntax/DestructuringAndAwait').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/DestructuringAndAwait').default));
break;
case 'file-env-variables':
require.ensure(['./features/env/FileEnvVariables'], () =>
this.setState({ feature: require('./features/env/FileEnvVariables').default })
);
require.ensure([], () => this.setFeature(require('./features/env/FileEnvVariables').default));
break;
case 'generators':
require.ensure(['./features/syntax/Generators'], () =>
this.setState({ feature: require('./features/syntax/Generators').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/Generators').default));
break;
case 'image-inclusion':
require.ensure(['./features/webpack/ImageInclusion'], () =>
this.setState({ feature: require('./features/webpack/ImageInclusion').default })
);
require.ensure([], () => this.setFeature(require('./features/webpack/ImageInclusion').default));
break;
case 'json-inclusion':
require.ensure(['./features/webpack/JsonInclusion'], () =>
this.setState({ feature: require('./features/webpack/JsonInclusion').default })
);
require.ensure([], () => this.setFeature(require('./features/webpack/JsonInclusion').default));
break;
case 'node-path':
require.ensure(['./features/env/NodePath'], () =>
this.setState({ feature: require('./features/env/NodePath').default })
);
require.ensure([], () => this.setFeature(require('./features/env/NodePath').default));
break;
case 'no-ext-inclusion':
require.ensure(['./features/webpack/NoExtInclusion'], () =>
this.setState({ feature: require('./features/webpack/NoExtInclusion').default })
);
require.ensure([], () => this.setFeature(require('./features/webpack/NoExtInclusion').default));
break;
case 'object-destructuring':
require.ensure(['./features/syntax/ObjectDestructuring'], () =>
this.setState({ feature: require('./features/syntax/ObjectDestructuring').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/ObjectDestructuring').default));
break;
case 'object-spread':
require.ensure(['./features/syntax/ObjectSpread'], () =>
this.setState({ feature: require('./features/syntax/ObjectSpread').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/ObjectSpread').default));
break;
case 'promises':
require.ensure(['./features/syntax/Promises'], () =>
this.setState({ feature: require('./features/syntax/Promises').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/Promises').default));
break;
case 'rest-and-default':
require.ensure(['./features/syntax/RestAndDefault'], () =>
this.setState({ feature: require('./features/syntax/RestAndDefault').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/RestAndDefault').default));
break;
case 'rest-parameters':
require.ensure(['./features/syntax/RestParameters'], () =>
this.setState({ feature: require('./features/syntax/RestParameters').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/RestParameters').default));
break;
case 'shell-env-variables':
require.ensure(['./features/env/ShellEnvVariables'], () =>
this.setState({ feature: require('./features/env/ShellEnvVariables').default })
);
require.ensure([], () => this.setFeature(require('./features/env/ShellEnvVariables').default));
break;
case 'svg-inclusion':
require.ensure(['./features/webpack/SvgInclusion'], () =>
this.setState({ feature: require('./features/webpack/SvgInclusion').default })
);
require.ensure([], () => this.setFeature(require('./features/webpack/SvgInclusion').default));
break;
case 'template-interpolation':
require.ensure(['./features/syntax/TemplateInterpolation'], () =>
this.setState({ feature: require('./features/syntax/TemplateInterpolation').default })
);
require.ensure([], () => this.setFeature(require('./features/syntax/TemplateInterpolation').default));
break;
case 'unknown-ext-inclusion':
require.ensure(['./features/webpack/UnknownExtInclusion'], () =>
this.setState({ feature: require('./features/webpack/UnknownExtInclusion').default })
require.ensure([], () => this.setFeature(require('./features/webpack/UnknownExtInclusion').default)
);
break;
default:
this.setState({ feature: null });
this.setFeature(null);
break;
}
}

setFeature(feature) {
this.setState({ feature });
}

render() {
const Feature = this.state.feature;
return Feature ? <Feature /> : null;
Expand Down
5 changes: 0 additions & 5 deletions packages/react-scripts/fixtures/kitchensink/src/index.css

This file was deleted.

4 changes: 2 additions & 2 deletions tasks/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function cleanup {
echo 'Cleaning up.'
cd $root_path
# Uncomment when snapshot testing is enabled by default:
# rm ./packages/react-scripts/templates/app/src/__snapshots__/App.test.js.snap
# rm ./packages/react-scripts/template/src/__snapshots__/App.test.js.snap
rm -rf $temp_cli_path $temp_app_path
}

Expand Down Expand Up @@ -95,7 +95,7 @@ test -e build/favicon.ico
# Run tests with CI flag
CI=true npm test
# Uncomment when snapshot testing is enabled by default:
# test -e templates/app/src/__snapshots__/App.test.js.snap
# test -e template/src/__snapshots__/App.test.js.snap

# Test local start command
npm start -- --smoke-test
Expand Down

0 comments on commit b35516b

Please sign in to comment.