0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-28 18:26:15 +01:00
posthog/frontend/@posthog/lemon-ui/build.mjs
Marius Andra 2069c4cd8b
feat(frontend): build @posthog/lemon-ui and @posthog/apps-common (#10120)
* fix dayjs

* fix timeouts (we're not strictly speaking running in nodejs)

* export unexported type

* consolidate on a single FormInstance

* no need to rename

* fuse

* forminstance 2

* locationChanged

* BuiltLogic

* remove Type.ts exception

* fix duh

* playing with common apps

* playing with common apps

* fix some scss deprecations 🤷

* revert

* move packages/apps-common

* remove compiled json file

* build apps-common before other packages

* mkdirp, build types before running

* build types before the rest

* move imports json to packages folder

* mark some packages as external, saving 200kb

* revert nonsense

* remove ant dep

* make app source editor types optional for speed

* move dev server reloads to utils.mjs

* remove webpack start scripts (unused)

* refactor build/utils to support various dirs

* apps package

* revert some stuff

* yarn

* go back to the old location and commit packages.json in

* commit it in

* out of scope

* fix bad imports

* fix some postcss mess

* move to @posthog/apps-common

* add more stuff to apps

* include that in packages.json

* simple cjs build

* export everything

* simplify

* make separate package for lemonade

* more lemonade

* fix jest imports

* fix jest imports

* yarn as well

* src

* write types before building

* rename lemon-ui, part 1

* add readmes

* rename to lemon-ui, part 2

* this app source editor tsd is committed into the repo, so we don't need it before a build
2022-06-10 17:03:06 +02:00

36 lines
1.0 KiB
JavaScript
Executable File

#!/usr/bin/env node
import * as path from 'path'
import * as fs from 'fs'
import { startDevServer, buildInParallel, printResponse } from '../../utils.mjs'
import url from 'url'
export const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
const { name, peerDependencies } = JSON.parse(fs.readFileSync(path.join(__dirname, 'package.json')))
startDevServer(__dirname)
await buildInParallel(
[
{
name,
absWorkingDir: __dirname,
entryPoints: ['./src/index.ts'],
format: 'cjs',
outfile: 'dist/index.js',
bundle: true,
chunkNames: '[name]',
entryNames: '[dir]/[name]',
external: Object.keys(peerDependencies ?? []),
publicPath: '',
minify: true,
target: 'esnext',
sourcemap: false,
},
],
{
async onBuildComplete(config, response) {
await printResponse(response, { verbose: true, compact: false })
},
}
)