Skip to content

Commit

Permalink
chore(react-intl): add example sandbox for create-react-app
Browse files Browse the repository at this point in the history
  • Loading branch information
longlho committed Jan 25, 2021
1 parent 0915dfb commit e38085d
Show file tree
Hide file tree
Showing 9 changed files with 18,192 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/.rescriptsrc.js
@@ -0,0 +1,28 @@
module.exports = [
[
"use-babel-config",
{
presets: ["react-app"],
plugins: [
"react-require",
[
"babel-plugin-formatjs",
{
idInterpolationPattern: "[sha512:contenthash:base64:6]",
ast: true,
},
],
],
},
],
[
"use-eslint-config",
{
extends: ["react-app"],
plugins: ["eslint-plugin-formatjs"],
rules: {
"formatjs/enforce-description": "error",
},
},
],
];
18,035 changes: 18,035 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/package-lock.json

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/package.json
@@ -0,0 +1,35 @@
{
"name": "react-app-rewired",
"version": "1.0.0",
"description": "",
"keywords": [],
"main": "src/index.tsx",
"dependencies": {
"@rescripts/cli": "0.0.15",
"@rescripts/rescript-env": "0.0.12",
"babel-plugin-formatjs": "9.0.1",
"eslint-plugin-formatjs": "2.10.4",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-intl": "5.10.16",
"react-scripts": "4.0.1"
},
"devDependencies": {
"@types/react": "17.0.0",
"@types/react-dom": "17.0.0",
"typescript": "4.1.3",
"babel-plugin-react-require": "3.1.3"
},
"scripts": {
"start": "rescripts start",
"build": "rescripts build",
"test": "rescripts test --env=jsdom",
"eject": "react-scripts eject"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
43 changes: 43 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/public/index.html
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<!--
Notice the use of %PUBLIC_URL% in the tags 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 "favicon.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>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<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` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>

</html>
16 changes: 16 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/src/App.tsx
@@ -0,0 +1,16 @@
import "./styles.css";
import { IntlProvider, FormattedMessage } from "react-intl";
export default function App() {
return (
<IntlProvider locale="en" messages={{}}>
<div className="App">
<h1>
<FormattedMessage defaultMessage="Hello CodeSandbox" />
</h1>
<h2>
<FormattedMessage defaultMessage="Start editing to see some magic happen!" />
</h2>
</div>
</IntlProvider>
);
}
5 changes: 5 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/src/index.tsx
@@ -0,0 +1,5 @@
import { render } from "react-dom";
import App from "./App";

const rootElement = document.getElementById("root");
render(<App />, rootElement);
@@ -0,0 +1 @@
/// <reference types="react-scripts" />
@@ -0,0 +1,4 @@
.App {
font-family: sans-serif;
text-align: center;
}
25 changes: 25 additions & 0 deletions packages/react-intl/example-sandboxes/rescripts/tsconfig.json
@@ -0,0 +1,25 @@
{
"include": [
"./src/**/*"
],
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"lib": [
"dom",
"es2015"
],
"jsx": "react-jsx",
"target": "es5",
"allowJs": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"noFallthroughCasesInSwitch": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true
}
}

0 comments on commit e38085d

Please sign in to comment.