0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-24 00:47:50 +01:00
posthog/frontend/editor-update-tsd.mjs

32 lines
1.3 KiB
JavaScript
Raw Normal View History

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 :shrug: * 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
import fse from 'fs-extra'
import path from 'path'
import { isDev } from './utils.mjs'
import { fileURLToPath } from 'url'
export const __dirname = path.dirname(fileURLToPath(import.meta.url))
export function writeSourceCodeEditorTypes() {
const readFile = (p) => {
try {
return fse.readFileSync(path.resolve(__dirname, p), { encoding: 'utf-8' })
} catch (e) {
if (isDev) {
chore: use pnpm to manage dependencies (closes #12635) (#13190) * chore: use pnpm to manage dependencies * Fix CI errors * Don't report Docker image size for external PRs * Fix pnpm-lock.yaml formatting * Fix module versions * Ignore pnpm-lock.yaml * Upgrade Cypress action for pnpm support * Set up node and pnpm before Cypress * Fix typescript issues * Include patches directory in Dockerfile * Fix Jest tests in CI * Update lockfile * Update lockfile * Clean up Dockerfile * Update pnpm-lock.yaml to reflect current package.json files * remove yarn-error.log from .gitignore * formatting * update data exploration readme * type jest.config.ts * fix @react-hook issues for jest * fix react-syntax-highlighter issues for jest * fix jest issues from query-selector-shadow-dom * fix transform ignore patterns and undo previous fixes * add missing storybook peer dependencies * fix nullish coalescing operator for storybook * reorder storybook plugins * update editor-update-tsd warning to new npm script * use legacy ssl for chromatic / node 18 compatibility * use pnpm for visual regression testing workflow * use node 16 for chromatic * add @babel/plugin-proposal-nullish-coalescing-operator as direct dependency * try fix for plugin-server * cleanup * fix comment and warning * update more comments * update playwright dockerfile * update plugin source types * conditional image size reporting * revert react-native instructions * less restrictive pnpm verions * use ref component name in line with style guide Co-authored-by: Jacob Gillespie <jacobwgillespie@gmail.com>
2022-12-12 10:28:06 +01:00
console.warn(`🙈 Didn't find "${p}" for the app source editor. Build it with: pnpm packages:build`)
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 :shrug: * 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
} else {
throw e
}
}
}
const types = {
'@types/react/index.d.ts': readFile('../node_modules/@types/react/index.d.ts'),
'@types/react/global.d.ts': readFile('../node_modules/@types/react/global.d.ts'),
'@types/kea/index.d.ts': readFile('../node_modules/kea/lib/index.d.ts'),
'@posthog/apps-common/index.d.ts': readFile('./@posthog/apps-common/dist/index.d.ts'),
'@posthog/lemon-ui/index.d.ts': readFile('./@posthog/lemon-ui/dist/index.d.ts'),
}
const packagesJsonFile = path.resolve(__dirname, './src/scenes/plugins/source/types/packages.json')
fse.mkdirpSync(path.dirname(packagesJsonFile))
fse.writeFileSync(packagesJsonFile, JSON.stringify(types, null, 4) + '\n')
}
writeSourceCodeEditorTypes()