This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { screen } from "@testing-library/react"; | |
import { | |
renderWithRouterApollo, | |
withReactHookForm, | |
} from "../../../services/testing-helpers"; | |
import ControlledMetadata from "./ControlledMetadata"; | |
describe("Some component", () => { | |
beforeEach(() => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import { screen, fireEvent, waitFor } from "@testing-library/react"; | |
import UIFormRelatedURL from "./RelatedURL"; | |
import { relatedUrlSchemeMock } from "../../Work/controlledVocabulary.gql.mock"; | |
import { renderWithReactHookForm } from "../../../services/testing-helpers"; | |
import userEvent from "@testing-library/user-event"; | |
const props = { | |
codeLists: relatedUrlSchemeMock, | |
name: "relatedUrl", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Demo</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script src="/script.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import App from "./index"; | |
ReactDOM.render(<App foo="Whats up bud" />, document.getElementById("root")); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
interface Props { | |
foo: string; | |
} | |
const App: React.FC<Props> = ({ foo }) => <div>Foo's value is: {foo}</div>; | |
export default App; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { build } = require("esbuild"); | |
const chokidar = require("chokidar"); | |
const liveServer = require("live-server"); | |
(async () => { | |
const builder = await build({ | |
bundle: true, | |
// Defines env variables for bundled JavaScript; here `process.env.NODE_ENV` | |
// is propagated with a fallback. | |
define: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { build } = require("esbuild"); | |
const { dependencies } = require("./package.json"); | |
const entryFile = "src/index.tsx"; | |
const shared = { | |
bundle: true, | |
entryPoints: [entryFile], | |
// Treat all dependencies in package.json as externals to keep bundle size to a minimum | |
external: Object.keys(dependencies), | |
logLevel: "info", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "medium-es-build-article-demo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "dist/index.cjs.js", | |
"module": "dist/index.esm.js", | |
"types": "dist/index.d.ts", | |
"scripts": { | |
"build": "npm run clean && node build.js && tsc --emitDeclarationOnly --outDir dist", | |
"clean": "rimraf dist", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dev | |
dist | |
node_modules | |
public/script.js | |
public/script.js.map | |
# OS | |
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
import ReactDOM from "react-dom"; | |
import App from "./index"; | |
// NOTE: "env" is available via the DotEnv ES Build Plugin defined in serve.js | |
import { NODE_ENV, DEV_URL, STATIC_URL } from "env"; | |
const host = NODE_ENV === "development" ? DEV_URL : STATIC_URL; | |
let sampleManifest: string = `${host}/fixtures/iiif/manifests/sample.json`; |