パッケージの詳細

preconstruct

preconstruct8.9kMIT非推奨1.0.0

This package has been renamed to @preconstruct/cli

Dev and build your code painlessly in monorepos

readme

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

1.0.0

Major Changes

0.3.2

Patch Changes

  • 21bbc08 #205 Thanks @Vultraz! - Fixed dist file check failing on Windows due to path separator mismatch

0.3.1

Patch Changes

0.3.0

Minor Changes

  • f02cce5 #163 Thanks @mitchellhamilton! - Remove automatic inclusion of @babel/plugin-transform-runtime.

    Preconstruct no longer automatically includes @babel/plugin-transform-runtime to reduce confusion where code works when built with Preconstruct but fails if built using another tool which directly uses a project's Babel config. You should include @babel/plugin-transform-runtime in your Babel config unless it is already included.

    {
      "plugins": ["@babel/plugin-transform-runtime"]
    }

Patch Changes

0.2.0

Minor Changes

0.1.3

Patch Changes

  • aefeb4f Thanks @mitchellhamilton! - Use TypeScript internally

  • Updated dependencies [aefeb4f]:

    • @preconstruct/hook@undefined

0.1.2

Patch Changes

0.1.1

Patch Changes

  • f14c39e Thanks @mitchellhamilton! - Add a comment to the commonjs file for preconstruct dev explaining what it does
  • 7c278d2 Thanks @mitchellhamilton! - Change redirect for flow in preconstruct dev to a file with export * because symlinks seem to be breaking

0.1.0

Minor Changes

  • 2f50306 #88 Thanks @mitchellhamilton! - Remove react-native field support(note: this doesn't mean you can't build libraries for react native with preconstruct, it just means preconstruct won't make a special build for react native)

0.0.90

Patch Changes

0.0.89

Patch Changes

  • b147abd - Fix TypeScript declaration generation in some cases with resolving

0.0.88

Patch Changes

  • ba73086 - Fix typescript declaration generation in some cases

0.0.87

Patch Changes

  • 19d36a4 - Build preconstruct with preconstruct
  • 9c36a88 - Allow empty bundles

0.0.86

Patch Changes

0.0.85

Patch Changes

0.0.84

Patch Changes

0.0.83

Patch Changes

0.0.82

Patch Changes

  • 1e851be #69 Thanks @mitchellhamilton! - Switch symlinks in preconstruct dev to CommonJS re-exports to avoid issues when using Node's --preserve-symlinks option.

0.0.81

Patch Changes

  • 99f1549 - Remove dependency on some emotion packages that caused preconstruct to break when building emotion

0.0.80

Patch Changes

  • ccc162f #64 Thanks @mitchellhamilton! - Refactor logging and include package name in uncaught build errors
  • 9cab2d1 #65 Thanks @mitchellhamilton! - Replace internal Babel runtime helpers CJS transform from an AST transform to regex
  • df58a43 #68 Thanks @mitchellhamilton! - Add validation to disallow transitive peerDependencies where the peerDep is not specified in the direct parent
  • ff49a6d #66 Thanks @mitchellhamilton! - Create rollup externals from dependencies and peerDependencies without checking nested deps. If you get an error saying that a dependency is missing when it previously worked, you should add that package as a dependency or peerDependency.

0.0.79

Patch Changes

  • 525137a - Remove erroneous console.log

0.0.78

  • Updated dependencies [9efd990]:
    • @preconstruct/hook@0.0.3

0.0.77

  • Updated dependencies [aea0c36]:
    • @preconstruct/hook@0.0.2

0.0.76

Patch Changes

  • ce8909b - Add file redirect instead of symlink redirect for TS in dev

0.0.75

Patch Changes

  • 7bade91 - Improve TypeScript declaration generation performance

0.0.74

Patch Changes

  • f79b195 - Change import path generated in TypeScript declarations

0.0.73

Patch Changes

  • 2e01590 #60 Thanks @mitchellhamilton! - Stop adding a postinstall script with preconstruct dev in preconstruct init. This was causing problems with single package repos so it's being removing for now.

0.0.72

Patch Changes

  • cd0979f - Change TS declaration filename

0.0.71

Patch Changes

0.0.70

Patch Changes

0.0.69

Patch Changes

  • 802fec0 #54 Thanks @mitchellhamilton! - Replace flow file that re-exports source contents with a symlink in dev command. This fixes the problem where if you added or removed the default export of an entrypoint source file, you would have to run preconstruct dev again.
  • b351218 #55 Thanks @mitchellhamilton! - Add support for TypeScript resolving types with dev command

0.0.68

Patch Changes

  • 9022265 - Set fields in a better order

0.0.67

Patch Changes

  • b22d4e1 - Fix init command prompting incorrectly for UMD builds
  • 0a9b9d7 - Remove aliases export, this is now replaced with the dev command

0.0.66

Patch Changes