@michael/dev-common (0.1.0)
Installation
@michael:registry=npm config set @michael:registry=npm install @michael/dev-common@0.1.0"@michael/dev-common": "0.1.0"About this package
dev-common
The development tooling the sadil.eu apps share, Wilco and Pinnace:
lint, format, type-check and test configuration, and checks of an app's
deployment. Published as @michael/dev-common on the Forgejo npm registry
at code.sadil.eu, where it is public; an app takes it as a devDependency.
It ships plain JavaScript, with types beside it, because Node and Vite load
it from node_modules, where they won't strip TypeScript.
What's inside
-
ESLint (
@michael/dev-common/eslint):eslintConfig({ ignores }), the flat config Wilco set up: ESLint's, typescript-eslint's and eslint-plugin-vue's recommended rules, with Prettier owning formatting.// eslint.config.js import { eslintConfig } from "@michael/dev-common/eslint"; export default eslintConfig({ ignores: ["dist-profile/**"] }); -
Prettier (
@michael/dev-common/prettier): Prettier's defaults, kept here so that an option set later reaches both apps. Inpackage.json:"prettier": "@michael/dev-common/prettier". Each app keeps its own.prettierignore. -
TypeScript (
@michael/dev-common/tsconfig.json): the strictness options beyond Quasar's generated config:{ "extends": ["./.quasar/tsconfig.json", "@michael/dev-common/tsconfig.json"] } -
Vitest (
@michael/dev-common/vitest):vitestConfig(config), the base for a Quasar app's tests: Vue and Quasar's plugin, jsdom, the jsdom gaps filled (vitest-setup.js: adopted stylesheets,Element.scrollTo, range boxes), and Quasar's client bundle and web-common compiled by Vitest.configmerges over it; itssetupFilesrun after the shared one.// vitest.config.ts import { vitestConfig } from "@michael/dev-common/vitest"; import { webCommon } from "@michael/web-common/vite"; export default vitestConfig({ plugins: [webCommon(options)] }); -
compose-hardening(a command): renders the app's Compose project (docker compose config, which needs no daemon) and checks that every service runs as a user other than root, on a read-only root file system, with every capability dropped and none added, without gaining privileges, with pids and memory limits, publishing no ports, not privileged, in no host namespace, and without the Docker socket. A service that needs one of these says so, with its reason, in a top-levelx-hardeningsection (Compose drops extension keys inside a service, but keeps this one); the command prints each exception with its reason, and refuses one without a reason or one that excuses nothing.x-hardening: pinnace: root: "the Docker socket is root-equivalent anyway"npx compose-hardening -f deploy/compose.yaml --env-file deploy/env.exampleThe rules are
root,read_only,cap_drop,cap_add,no_new_privileges,ports,limits,privileged,host_namespacesanddocker_socket(compose-hardening.js). -
scan-image(a command): scans local images with a digest-pinned Grype for fixable High and Critical vulnerabilities, without giving the scanner the Docker socket. The database is cached in thegrype-dbvolume, or the oneSCAN_IMAGE_DB_VOLUMEnames.
The ESLint, Vitest and Prettier packages are optional peer dependencies: an app lists the ones it uses, at exact versions, and one that only runs the commands installs none of them.
Changing dev-common
-
Make the change here, with its tests, and run
npm run check(Prettier, the Node tests, the scan script's syntax). -
Raise
versioninpackage.json: a released version never changes. Breaking changes raise the minor while the major is 0. -
Try it in each app before release:
npm pack, then install the tarball there (npm install --save-dev ../common/dev-common/michael-dev-common-x.y.z.tgz) and run the app's checks. -
Publish as web-common's README describes, with a token that may write packages for the
michaelaccount. -
Tag the commit you published from, and push it with
main:git tag -a dev-common/vX.Y.Z -m X.Y.Z git push origin main dev-common/vX.Y.Z -
In each app, set the new exact version,
npm install, and run its checks.
Dependencies
Development dependencies
| ID | Version |
|---|---|
| prettier | 3.9.10 |
Peer dependencies
| ID | Version |
|---|---|
| @eslint/js | ^10.0.0 |
| @quasar/vite-plugin | ^2.0.0 |
| @vitejs/plugin-vue | ^6.0.0 |
| eslint | ^10.0.0 |
| eslint-plugin-vue | ^10.0.0 |
| typescript-eslint | ^8.0.0 |
| vitest | ^5.0.0 |