(Not necessary right now, no shell scripts are required right now) find . -name '*.sh' -exec chmod +x {} \;
Ensure your $TERMINAL
environment variable points to a graphical terminal application.
// TODO: Add reason.
yarn set version stable && yarn install && yarn dlx @yarnpkg/sdks vscode
Currently we have themes/subtle
.
Therefore, I had to manually modify the source code of the installed NueJS package.
bun i -g nuekit
then modify ~/.bun/install/global/node_modules/nuekit/src/builder.js
so that around line 1 is changed to:
import apply from '../../../../../lightningcss-plugins/apply/index.js';
import customUnits from '../../../../../lightningcss-plugins/custom-units/index.js';
import propertyLookup from '../../../../../lightningcss-plugins/property-lookup/index.js';
import size from '../../../../../lightningcss-plugins/size/index.js';
and around line 135 is changed to:
return mod.transform({
code: Buffer.from(css),
drafts: {customMedia: true},
targets: {safari: (17 << 16) | (3 << 8), chrome: (122 << 16), firefox: (115 << 16) | (7 << 8), android: (122 << 16), ios_saf: (16<< 16) | (7 << 8)},
cssModules: {pattern: '[local]'},
include,
minify,
visitor: mod.composeVisitors([apply, customUnits, propertyLookup, size]),
}).code?.toString()
from original line 135's:
return mod.transform({code:Buffer.from(css), include, minify}).code?.toString()
A backup of this modified file is at bak/nuekit/src/builder.js
.
Therefore, I had to reduce the number of CSS files from the beginning.
For example, merging two files into one by separating them with:
/**************************************************/
Probably because VMware shared folder doesn't work with inotify
.
Therefore, I had to:
-
Install
chokidar-cli
andhttp-server
bun i -g chokidar-cli bun i -D http-server # Because Nue's server keeps complaining Error in posts/*.md, on <html> component # Edit: Okay found it. Need to add content_collection to front matter, which isn't necessary in my opinion. # I'm keep using http-server to hopefully save me from some future headaches.
-
Watch the project directory for any changes to trigger a build. Note the folder
.dist
needs to be excluded or else there'll be an infinite loop.Project directory: for example, switch to
themes/subtle
in your terminal first.bun run chokidar "**/*.*" -i ".dist/**/*.*" -c "bun run node_modules/nuekit/src/cli.js build" -p --initial
-
Watch the build directory for any changes to trigger a server restart, in another terminal:
bun run chokidar ".dist/dev/**/*.*" -i ".dist/dev/**/*.html" -c "lsof -t -i:8080 | xargs -r kill && bun run node_modules/http-server/bin/http-server .dist/dev -c-1" -p --initial
*.html
is ignored because chokidar frequently false reports it as changed just because Chromium reloaded the page. -
Setup auto-reload in browser. I wrote a Violentmonkey userscript to do this:
setTimeout(() => { if (!navigator.userActivation.hasBeenActive) { location.reload() } }, 5000)
which means, if no user interaction is detected within the first 5 seconds of page load, the page will auto reload.
Update: I switched to Linux as my main dev system and above workaround is unnecessary now.
rm bun.lockb && bun i
See oven-sh/bun#5413
See oven-sh/bun#4628
Tried switching to other bun i
backends, no luck.
rsync -rRL --exclude='*/**/node_modules/*' node_modules/ configs/biome-config/
(Outdated) Um, just ignore those "File name too long" errors.
Adding the xtype filter to find causes all those files in links to be not found by find, because find doesn't resolve contents in directories that are links.
You can use this command: bun i && ./cpNM.sh
TODO: I should write a better script for this. Currently, the script needs to be manually updated each time I change a package's location. Currently, the script copies everything w/o considering the actual dependencies of each package.
See oven-sh/bun#5688 (comment)
Still, some dependencies require themselves to be found in the package's node_modules folder. For example, to extend a tsconfig. Therefore, the above script isn't useless, just needs some more exclusions.
TODO: Add some more exclusions to the above script.
Astro, for example, doesn't work well with Bun, which means some packages written using Bun
apis cannot run when imported into Astro.
On my system, sh
is not found at /bin/sh
.
For portability, https://stackoverflow.com/a/10383546
Because when we copied node_modules
from root to each packages, we didn't let it ignore biome.
And biome needs to find a biome.json, which we don't have when called from subpackages.
cpNM.sh
Script now fixed.
You can also run rm -rf */*/**/@biomejs/
.
find posts -iname "*.md" -type f -exec sh -c 'pandoc "${0}" -o "${0%.md}.txt"' {} \;
Stolen from https://stackoverflow.com/a/26304106
rg -P -U --passthru -N '#(?:.|\n)+?(?=\n\n)' -r '' posts/why-this-theme.txt
rg -U --passthru -N '\n' -r '' posts/why-this-theme.txt
For eventualConsumer
s:
esbuild src/bin.ts --bundle --platform=node --charset=utf8 --format=esm --preserve-symlinks --target=node20 --drop:debugger --drop-labels=DEV,D --define:process.env.NODE_ENV=\\\"production\\\" --minify-whitespace --minify-syntax --keep-names --outdir=dist/final/ --metafile=dist/temp/esbuild/meta.json --log-limit=0 --sourcemap=external
Otherwise:
esbuild src/index.ts --bundle --platform=node --charset=utf8 --format=esm --packages=external --target=node20 --drop:debugger --drop-labels=DEV,D --keep-names --outdir=dist/final/ --metafile=dist/temp/esbuild/meta.json --preserve-symlinks --log-limit=0 --sourcemap
tr -dc A-Za-z0-9 </dev/urandom | head -c 9999; echo
Because I don't want my code to be littered with :where
Otherwise Astro may not actually include those CSS properly.
Astro.glob()
only supports plain strings. It doesn't even support template strings.
I had to use an integration to generate a JS file to generate Astro.glob()
.
Git reads all .gitignore files and ignore all the entries specified, no matter where they are. Only one .gitignore file makes it more manageable.
Sometimes I forget to commit while I still remember what the changes were. I agree, I should do better.
Yarn pnp patched TypeScript doesn't work well with packages that depend on TypeScript in monorepo.
Too slow, no matter which mode it's in.
Yarn is slow on initial resolve, but subsequent changes are pretty fast.
Gives invalid ast for some code. I'm leaning that it's not escaping properly. (Unconfirmed)
pacman -Sy --noconfirm graphviz imagemagick patch plantuml librsvg unzip
import { $ } from 'zx';
await $`go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest`;
await $`xcaddy build ${[
'--with', 'github.com/mholt/caddy-events-exec',
'--with', 'github.com/mholt/caddy-webdav',
'--with', 'github.com/mholt/caddy-l4',
'--with', 'github.com/porech/caddy-maxmind-geolocation',
'--with', 'github.com/mholt/caddy-ratelimit',
'--with', 'github.com/caddyserver/cache-handler',
'--with', 'github.com/caddyserver/jsonc-adapter',
'--with', 'github.com/caddy-dns/porkbun',
'--with', 'github.com/caddy-dns/njalla',
]}`
.pipe(process.stdout);
await $`chmod +x ./caddy`;
await $`caddy --version`;