chiubaka / genesis

Creates standardized monorepos and pre-configured project scaffolding for Chiubaka Technologies projects.
2 stars 0 forks source link

Create library project generators #98

Open chiubaka opened 2 years ago

chiubaka commented 2 years ago

(Copying from a comment on #39.)

Excitingly, starting work on this today. Types of libraries I expect to have:

Mostly the difference between these will be the base:

chiubaka commented 2 years ago

Since a lot of the difference between these library packages is likely to be in tsconfig.json, I'm doing a quick comparison of typical working configurations for each project type.

Microsoft actually has a few starter project examples. Though they're archived and a few years old, I think they're probably still helpful here:

chiubaka commented 2 years ago

Some options that seem to be common across all projects:

Here are some notable differences:

Honestly, that's kind of it. I'm a bit surprised TBH.

chiubaka commented 2 years ago

Ah, this is a better and more up-to-date resource for common TS configurations: https://github.com/tsconfig/bases#centralized-recommendations-for-tsconfig-bases

chiubaka commented 2 years ago

Ok, target should potentially be changed based on the runtime environment, since this option changes how much of the code is down-leveled for compatibility. ES2015 (aka ES6) seems like the safest target for compatibility if building for the web. Otherwise, for environments like Node.js and React Native, compatibility is really more a function of the platform version than it is of the user's device or browser configuration, so matters less there.

chiubaka commented 2 years ago

Can potentially use the jsx: "react-native" option for React Native, as presumably FB's React Native compilers understand JSX and can do some of their own optimizations if this isn't down-leveled to something else.

chiubaka commented 2 years ago

Actually the differences between a backend, Node-compatible library, and a general, shareable library, are pretty minute. A Node-compatible library likely needs to list a node version as a peerDependency, and then set the TS target to something sensible for the version of Node I generate for (I think we're going to target Node v18).

chiubaka commented 1 year ago

Bumping this so that it doesn't appear stale for import into Linear.