diff --git a/packages/api-explorer/src/ApiExplorer.tsx b/packages/api-explorer/src/ApiExplorer.tsx index 8f5e827a0..9ae68753f 100644 --- a/packages/api-explorer/src/ApiExplorer.tsx +++ b/packages/api-explorer/src/ApiExplorer.tsx @@ -72,9 +72,9 @@ export interface ApiExplorerProps { headless?: boolean } -export const BodyOverride = createGlobalStyle` html { height: 100%; overflow: hidden; } ` +const BodyOverride = createGlobalStyle` html { height: 100%; overflow: hidden; } ` -const ApiExplorer: FC = ({ +export const ApiExplorer: FC = ({ specs, envAdaptor, setVersionsUrl, @@ -242,11 +242,10 @@ const ApiExplorer: FC = ({ ) } -export const AsideBorder = styled(Aside)<{ +const AsideBorder = styled(Aside)<{ isOpen: boolean headless: boolean }>` width: ${({ isOpen, headless }) => isOpen ? '20rem' : headless ? '2.75rem' : '0rem'}; ` -export default ApiExplorer diff --git a/packages/api-explorer/src/index.tsx b/packages/api-explorer/src/App.tsx similarity index 100% rename from packages/api-explorer/src/index.tsx rename to packages/api-explorer/src/App.tsx diff --git a/packages/api-explorer/src/StandaloneApiExplorer.tsx b/packages/api-explorer/src/StandaloneApiExplorer.tsx index 2410a518f..3a88c9900 100644 --- a/packages/api-explorer/src/StandaloneApiExplorer.tsx +++ b/packages/api-explorer/src/StandaloneApiExplorer.tsx @@ -38,7 +38,7 @@ import type { IAPIMethods } from '@looker/sdk-rtl' import type { SpecList } from '@looker/sdk-codegen' import { Provider } from 'react-redux' -import ApiExplorer from './ApiExplorer' +import { ApiExplorer } from './ApiExplorer' import { store } from './state' import { StandaloneEnvAdaptor } from './utils' import { Loader } from './components' diff --git a/packages/api-explorer/src/index.ts b/packages/api-explorer/src/index.ts new file mode 100644 index 000000000..130350e77 --- /dev/null +++ b/packages/api-explorer/src/index.ts @@ -0,0 +1,30 @@ +/* + + MIT License + + Copyright (c) 2021 Looker Data Sciences, Inc. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. + + */ +export * from './ApiExplorer' +export type { ThemeOverrides, IApixEnvAdaptor } from './utils' +export { getThemeOverrides } from './utils' +export { Loader } from './components' +export { store } from './state' diff --git a/packages/api-explorer/webpack.dev.config.js b/packages/api-explorer/webpack.dev.config.js index 877b3b7ca..ad78f8436 100644 --- a/packages/api-explorer/webpack.dev.config.js +++ b/packages/api-explorer/webpack.dev.config.js @@ -30,6 +30,9 @@ const base = require('../../webpack.base.config')(__dirname) const browser = require('../../webpack.browser.config')() module.exports = merge(base, browser, { + entry: { + app: path.join(__dirname, 'src/App.tsx'), + }, mode: 'development', devServer: { contentBase: path.join(__dirname, 'public'), diff --git a/packages/api-explorer/webpack.prod.config.js b/packages/api-explorer/webpack.prod.config.js index 16843d8e9..9de0e620f 100644 --- a/packages/api-explorer/webpack.prod.config.js +++ b/packages/api-explorer/webpack.prod.config.js @@ -23,10 +23,14 @@ SOFTWARE. */ +const path = require('path') const { merge } = require('webpack-merge') const base = require('../../webpack.base.config')(__dirname) const browser = require('../../webpack.browser.config')() module.exports = merge(base, browser, { + entry: { + app: path.join(__dirname, 'src/index.ts'), + }, mode: 'production', }) diff --git a/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx b/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx index 1bebfed53..f46226306 100644 --- a/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx +++ b/packages/extension-api-explorer/src/ExtensionApiExplorer.tsx @@ -32,10 +32,8 @@ import type { ExtensionContextData } from '@looker/extension-sdk-react' import { ExtensionContext } from '@looker/extension-sdk-react' import type { SpecItem, SpecList } from '@looker/sdk-codegen' import { getSpecsFromVersions } from '@looker/sdk-codegen' -import ApiExplorer from '@looker/api-explorer/src/ApiExplorer' -import { Loader } from '@looker/api-explorer/src/components' +import { ApiExplorer, store, Loader } from '@looker/api-explorer' import { getExtensionSDK } from '@looker/extension-sdk' -import { store } from '@looker/api-explorer/src/state' import { Provider } from 'react-redux' import { ExtensionEnvAdaptor } from './utils' diff --git a/packages/extension-api-explorer/src/utils.ts b/packages/extension-api-explorer/src/utils.ts index e2dcccee7..5727e2788 100644 --- a/packages/extension-api-explorer/src/utils.ts +++ b/packages/extension-api-explorer/src/utils.ts @@ -23,11 +23,8 @@ SOFTWARE. */ -import type { - IApixEnvAdaptor, - ThemeOverrides, -} from '@looker/api-explorer/src/utils' -import { getThemeOverrides } from '@looker/api-explorer/src/utils' +import type { IApixEnvAdaptor, ThemeOverrides } from '@looker/api-explorer' +import { getThemeOverrides } from '@looker/api-explorer' import type { ExtensionSDK } from '@looker/extension-sdk' /**