-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
migrate labware designer and discovery client
- Loading branch information
Showing
6 changed files
with
174 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { versionForProject } from '../scripts/git-version' | ||
import pkg from './package.json' | ||
import path from 'path' | ||
import { UserConfig, defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
import postCssImport from 'postcss-import' | ||
import postCssApply from 'postcss-apply' | ||
import postColorModFunction from 'postcss-color-mod-function' | ||
import postCssPresetEnv from 'postcss-preset-env' | ||
import lostCss from 'lost' | ||
|
||
export default defineConfig( | ||
async (): Promise<UserConfig> => { | ||
const project = process.env.OPENTRONS_PROJECT ?? 'robot-stack' | ||
const version = await versionForProject(project) | ||
return { | ||
publicDir: false, | ||
build: { | ||
// Relative to the root | ||
ssr: 'src/index.ts', | ||
outDir: 'lib', | ||
commonjsOptions: { | ||
transformMixedEsModules: true, | ||
esmExternals: true, | ||
}, | ||
}, | ||
plugins: [ | ||
react({ | ||
include: '**/*.tsx', | ||
babel: { | ||
// Use babel.config.js files | ||
configFile: true, | ||
}, | ||
}), | ||
], | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
target: 'CommonJs', | ||
}, | ||
}, | ||
css: { | ||
postcss: { | ||
plugins: [ | ||
postCssImport({ root: 'src/' }), | ||
postCssApply(), | ||
postColorModFunction(), | ||
postCssPresetEnv({ stage: 0 }), | ||
lostCss(), | ||
], | ||
}, | ||
}, | ||
define: { | ||
'process.env': process.env, | ||
global: 'globalThis', | ||
_PKG_VERSION_: JSON.stringify(version), | ||
_PKG_BUGS_URL_: JSON.stringify(pkg.bugs.url), | ||
_OPENTRONS_PROJECT_: JSON.stringify(project), | ||
}, | ||
resolve: { | ||
alias: { | ||
'@opentrons/components/styles': path.resolve( | ||
'../components/src/index.module.css' | ||
), | ||
'@opentrons/components': path.resolve('../components/src/index.ts'), | ||
'@opentrons/shared-data': path.resolve('../shared-data/js/index.ts'), | ||
'@opentrons/step-generation': path.resolve( | ||
'../step-generation/src/index.ts' | ||
), | ||
'@opentrons/discovery-client': path.resolve( | ||
'../discovery-client/src/index.ts' | ||
), | ||
'@opentrons/usb-bridge/node-client': path.resolve( | ||
'../usb-bridge/node-client/src/index.ts' | ||
), | ||
}, | ||
}, | ||
} | ||
} | ||
) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict' | ||
|
||
module.exports = { | ||
env: { | ||
// Note(isk: 3/2/20): Must have babel-plugin-styled-components in each env, | ||
// see here for further details: s https://styled-components.com/docs/tooling#babel-plugin | ||
production: { | ||
plugins: ['babel-plugin-styled-components', 'babel-plugin-unassert'], | ||
}, | ||
development: { | ||
plugins: ['babel-plugin-styled-components'], | ||
}, | ||
test: { | ||
plugins: [ | ||
// NOTE(mc, 2020-05-08): disable ssr, displayName to fix toHaveStyleRule | ||
// https://github.com/styled-components/jest-styled-components/issues/294 | ||
['babel-plugin-styled-components', { ssr: false, displayName: false }], | ||
], | ||
}, | ||
}, | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name='viewport' content='width=device-width,initial-scale=1'> | ||
|
||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700,700i" rel="stylesheet"> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Vite + React + TS</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="src/index.tsx"></script> | ||
</body> | ||
</html> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import path from 'path' | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
import postCssImport from 'postcss-import' | ||
import postCssApply from 'postcss-apply' | ||
import postColorModFunction from 'postcss-color-mod-function' | ||
import postCssPresetEnv from 'postcss-preset-env' | ||
import lostCss from 'lost' | ||
|
||
export default defineConfig({ | ||
build: { | ||
// Relative to the root | ||
outDir: 'dist', | ||
}, | ||
plugins: [ | ||
react({ | ||
include: '**/*.tsx', | ||
babel: { | ||
// Use babel.config.js files | ||
configFile: true, | ||
}, | ||
}), | ||
], | ||
optimizeDeps: { | ||
esbuildOptions: { | ||
target: 'es2020', | ||
}, | ||
}, | ||
css: { | ||
postcss: { | ||
plugins: [ | ||
postCssImport({ root: 'src/' }), | ||
postCssApply(), | ||
postColorModFunction(), | ||
postCssPresetEnv({ stage: 0 }), | ||
lostCss(), | ||
], | ||
}, | ||
}, | ||
define: { | ||
'process.env': process.env, | ||
global: 'globalThis', | ||
}, | ||
resolve: { | ||
alias: { | ||
'@opentrons/components/styles': path.resolve('../components/src/index.module.css'), | ||
'@opentrons/components': path.resolve('../components/src/index.ts'), | ||
'@opentrons/shared-data': path.resolve('../shared-data/js/index.ts'), | ||
'@opentrons/step-generation': path.resolve('../step-generation/src/index.ts'), | ||
}, | ||
}, | ||
}) |