Preconstruct

在 monorepos 中无痛苦地开发和构建你的代码。「🎁 Dev and build your code painlessly in monorepos」

  • 所有者: preconstruct/preconstruct
  • 平台: Windows,Linux,Mac
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

Preconstruct ?

Dev and build your code painlessly in monorepos

Key Features

  • In dev mode, your code behaves the same as it will in production, including locally linked in monorepos
  • Add multiple entrypoints to your packages for publishing
  • CLI helps walk you through set-up and making changes to your configs
  • Works with different kinds of JS monorepos
  • Also works for single package repos!
  • Builds your code with rollup

Getting Started

Assuming you already have a source file at src/index.js (or src/index.ts) or you're using Yarn Workspaces and have packages with src/index.js (or src/index.ts), you can setup Preconstruct like this.

yarn add --dev @preconstruct/cli
yarn preconstruct init

If you're in a monorepo, you should also run yarn preconstruct dev and add it to a postinstall script("postinstall": "preconstruct dev") that runs preconstruct dev so that you can import your code without having to rebuild your project every time in changes.

Publishing packages

Before you publish packages to npm, run preconstruct build. Preconstruct will use your Babel config and build flat bundles so make sure to configure Babel with the transforms you want.

We strongly recomment making a single script in your package.json that runs both build and publish, to stop broken publishes, such as "release": "preconstruct build && yarn publish:packages. If you're in a single-package repo, you could also run preconstruct build in a prepare or prepublishOnly script.

Further Guides

There are a number of tasks that become easier with preconstruct that lie slightly outside the main workflow. Check out the following guides for setting these up.

See the docs at preconstruct.tools

Thanks/Inspiration

  • microbundle was a huge inspiration for this! ❤️
  • rollup - rollup has done the really hard stuff that makes preconstruct possible!
  • bolt - lots of utils and things in this project were inspired by things in bolt
  • Kye Hohenberger for thinking of the name preconstruct
  • Too many awesome people to name at Thinkmill who have given so much great feedback to make Preconstruct better and Thinkmill for sponsoring the development of Preconstruct ?
  • all the people who wrote all the dependencies for this project!

主要指標

概覽
名稱與所有者preconstruct/preconstruct
主編程語言TypeScript
編程語言JavaScript (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2018-11-05 21:24:31
推送於2025-03-27 02:19:15
最后一次提交2021-01-23 09:49:45
發布數199
最新版本名稱@preconstruct/cli@2.8.12 (發布於 2025-03-27 02:19:14)
第一版名稱v0.0.2 (發布於 2018-11-06 14:43:26)
用户参与
星數1.2k
關注者數7
派生數63
提交數899
已啟用問題?
問題數157
打開的問題數48
拉請求數379
打開的拉請求數13
關閉的拉請求數70
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?