0.0.105 • Published 14 days ago

web-vcore v0.0.105

Weekly downloads
-
License
MIT
Repository
github
Last release
14 days ago

web-vcore

Core code shared between my projects, for web-app frontends.

Installation

todo: update these instructions

1) Install the package: (or symlink it; that's recommended for long-term usage)

npm install web-vcore

2) opt Add the following to your code entry-file (or anywhere really):

import type {} from "web-vcore/nm/@All"; // helps vscode's auto-importer notice the "web-vcore/nm/*" package re-exports

3) Add the following to your tsconfig.json: (these entries are only needed for packages that are peer-dependencies of a user-project node-module)

"compilerOptions" {
	"paths": {
		"react": [
			"node_modules/web-vcore/node_modules/react",
			"node_modules/react",
		]
		// for monorepo:
		/*"react": [
			"../../../node_modules/web-vcore/node_modules/react",
			"../../../node_modules/react",
		]*/
	},
},
"references": [
	{"path": "node_modules/web-vcore"},
	// for monorepo:
	//{"path": "../../node_modules/web-vcore"},
]

4) Make-so web-vcore's package-patches get applied, by adding/merging the following command into your project's postinstall script:

"postinstall": "cd ./node_modules/web-vcore && node ./Scripts_Dist/ApplyPatches.js"

5) Various other things, like populating the RootStore interface. (for now, just reference an existing project that uses web-vcore, as seen below)

Creating package patches

Regular: patch-package patch MY_PACKAGE With package.json: patch-package patch MY_PACKAGE --exclude 'nothing'

If including package.json, modify the diff file afterward to omit the npm-install-related noise.

For details on how the patch files are parsed, see here: https://github.com/ds300/patch-package/blob/5c2c92bf504885fba4840870a23fc8999c00e572/src/patch/parse.ts

Usage of yalc/zalc with subdeps

todo: ensure these instructions are up-to-date

Steps to newly-link subdep:

  • 1) Run zalc push in subdep's source repo.
  • 2) Run zalc link SUBDEP_NAME in web-vcore repo.
  • 3) Open package.json, and set the version for that subdep (back to) the current version number. (must update this when version changes in subdep's source repo)
  • 4) Run yarn in web-vcore repo.
  • 5) Run zalc push in web-vcore repo.
  • 6) Run yarn in user project.
  • Note: If you need to repair the linkage manually fsr, use a tool like Hard Link Shell Extension to create a Junction from node_modules/X to .yalc/X.

Troubleshooting

  • Note: Because using yalc results in different contents for yarn.lock, developers who are using yalc should refrain from committing changes to that file while yalc is in use (else the "proper" yalc.lock contents that are generated by other devs would keep getting overwritten, causing a back and forth process). To make this more convenient, it's recommended to add the following script to package.json, and run it instead of yarn install: "yalc-i": "yarn install && git checkout HEAD -- yarn.lock"

Documentation

For the most part, web-vcore is meant to be learned/used based on referencing the codebase of existing projects using it (eg. Debate Map). This is because the package is only intended/expected to be used for projects I'm building, so there's not that much benefit to creating full-fledged documentation.

That said, there are some things (eg. particularly complex components) for which documentation is worth creating, both for collaborators on projects I've made, as well as for my own reference in the future.

What is the purpose of web-vcore? And why is web-vcore updated so frequently?

There are two primary functions of the web-vcore package: 1) Serve as a "container of subdependencies", such that by adding web-vcore to a project, you get a set of subdependencies with it that are known to work well together, with consistent versions that are used across my web projects. 2) Because my web projects use a lot of custom libraries, and because I frequently make small "micro changes" to those libraries, I've found it helpful to combine web-vcore with use of yalc (or in some cases, a fork of it called zalc). Specifically, I use yalc as a way to have local changes made to custom libraries (ie. subdependencies of web-vcore that I've written myself) propagated up to the higher-level web projects, without needing to constantly be making npm publishes of both the subdependencies and the web-vcore container package; I yalc-push from the subdep into the web-vcore package, then yalc-push from there into the larger web project(s).

Due to local library changes being propagated to my web projects without needing npm-publishes, this of course raises the concern of me neglecting to actually push those changes to a place where other developers of my web projects can access them. The middle-ground I've settled on for now is:

  • Include the .yalc folder of web-vcore in the contents that npm publishes for the web-vcore package. Thus, as long as I remember to do an npm-publish of the web-vcore package each time I make subdependency changes, I don't need to bother about comprehensively tracking down what subdependencies were changed during each web-project commit, in order to make additional library publishes. (I do of course eventually make npm publishes for those subdependencies, but this way I can do so at convenient times and with greater care.)

While this approach is non-standard, and not perfect, it has been very helpful from a practical standpoint, in terms of letting me iterate quickly while still maintaining the separation of logic into lots of small components/libraries.

0.0.105

14 days ago

0.0.104

1 month ago

0.0.103

2 months ago

0.0.102

2 months ago

0.0.101

2 months ago

0.0.100

2 months ago

0.0.99

2 months ago

0.0.98

2 months ago

0.0.97

3 months ago

0.0.96

3 months ago

0.0.95

4 months ago

0.0.94

4 months ago

0.0.93

4 months ago

0.0.92

4 months ago

0.0.91

4 months ago

0.0.86

4 months ago

0.0.87

4 months ago

0.0.88

4 months ago

0.0.89

4 months ago

0.0.90

4 months ago

0.0.85

5 months ago

0.0.84

6 months ago

0.0.80

10 months ago

0.0.81

9 months ago

0.0.82

9 months ago

0.0.83

8 months ago

0.0.76

11 months ago

0.0.77

11 months ago

0.0.78

11 months ago

0.0.79

11 months ago

0.0.73

12 months ago

0.0.74

12 months ago

0.0.75

12 months ago

0.0.70

1 year ago

0.0.71

1 year ago

0.0.72

12 months ago

0.0.66

1 year ago

0.0.67

1 year ago

0.0.68

1 year ago

0.0.69

1 year ago

0.0.62

1 year ago

0.0.64

1 year ago

0.0.65

1 year ago

0.0.60

1 year ago

0.0.61

1 year ago

0.0.59

1 year ago

0.0.51

1 year ago

0.0.52

1 year ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.57

1 year ago

0.0.58

1 year ago

0.0.50

1 year ago

0.0.49

1 year ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.48

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.39

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.36

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.19

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.16

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago