5.0.0 • Published 3 years ago
@rebox/web v5.0.0
@rebox/web
Set of helpers to deal with React applications using our Babel config.
Install
$ yarn add @rebox/web
API
type TBuildWebAppReleaseOptions = {
entryPointPath: string,
htmlTemplatePath: string,
outputPath: string,
browsersList?: string[], // ['defaults'] by default
globalConstants?: {
[key: string]: string
},
globalAliases?: {
[key: string]: string
},
props?: TJsonValue,
isQuiet?: boolean, // false by default
shouldGenerateSourceMaps?: boolean, // false by default
shouldGenerateBundleAnalyzerReport?: boolean // false by default
}
const buildWebAppRelease: (userOptions: TBuildWebAppReleaseOptions) => Promise<void>
type TRunWebAppOptions = {
entryPointPath: string,
htmlTemplatePath: string,
browsersList?: string[], // ['last 1 Chrome version', 'last 1 Firefox version'] by default
assetsPath?: string,
props?: TJsonValue,
isQuiet?: boolean, // false by default
shouldOpenBrowser?: boolean // false by default
}
const runWebApp: (options: TRunWebAppOptions) => Promise<() => Promise<void>>
Usage
// App.tsx
import { FC } from 'react'
export type TApp = {
color: string
}
export const App: FC<TApp> = ({ color }) => (
<h1 style={{ color }}>Test</h1>
)
<!-- template.html -->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Test</title>
<style>
body { margin: 0 }
</style>
</head>
<body>
<div id="root"></div>
</body>
</html>
// build.ts
import { buildWebAppRelease } from '@rebox/web'
await buildWebAppRelease({
entryPointPath: './App.tsx',
htmlTemplatePath: './template.html',
outputPath: './build/',
props: {
color: '#ff0000'
}
})
// run.ts
import { runWebApp } from '@rebox/web'
await runWebApp({
entryPointPath: './App.tsx',
htmlTemplatePath: './template.html',
props: {
color: '#ff0000'
}
})
5.0.0
3 years ago
4.0.0
3 years ago
3.2.1
3 years ago
3.2.0
4 years ago
3.1.0
4 years ago
3.0.0
4 years ago
2.1.10
4 years ago
2.1.9
4 years ago
2.1.8
4 years ago
2.1.7
4 years ago
2.1.6
4 years ago
2.1.5
4 years ago
2.1.4
4 years ago
2.1.3
4 years ago
2.1.2
4 years ago
2.1.1
4 years ago
2.1.0
4 years ago
2.0.1
4 years ago
2.0.0
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago
0.5.0
4 years ago
0.4.5
5 years ago
0.4.4
5 years ago
0.4.3
5 years ago
0.4.2
5 years ago
0.4.1
5 years ago
0.4.0
5 years ago
0.3.4
5 years ago
0.3.3
5 years ago
0.3.2
5 years ago
0.3.1
5 years ago
0.3.0
5 years ago
0.2.2
5 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.0
5 years ago