Fork me on GitHub
#biff
<
2022-06-11
>
Jacob O'Bryant18:06:46

Just pushed the last commit for platypub that's needed for the release! (knock on wood) Next I'll write up some issues and do a short announcement blog post. Some upgrade notes for @jeffparker and anyone else who may have been playing around with platypub already: • I've changed the schema so that each document includes a user field. After you pull the new code and run ./task dev, you can evaluate (com.platypub.repl/migrate! "") to update any existing docs to match the schema, substituting "<mailto:[email protected]|[email protected]>" with whatever user you want to own the existing docs. • I realized that we can have themes/default/ be tracked by git while gitignoring everything else in themes/* . So I removed the themes.TEMPLATE folder, and going forward you won't have to do any manual copying to keep the default theme up-to-date. You may want to delete/move the themes/default/ folder before pulling the new code. To customize the theme beyond what's provided by the config, you can copy themes/default/ to themes/mytheme/ or whatever. (Though for adding images or other files, no need to copy the folder. you can put them in the themes/default/assets/ folder which isn't tracked by git) other notes: • Speaking of theme config, themes can now have a https://github.com/jacobobryant/platypub/blob/master/themes/default/custom-schema.edn file which will cause additional fields to show up in Platypub's site edit page. I'm now using the default theme as-is for http://blog.thesample.ai. • I made some updates to npm dependency handling so publishing sites should be faster now, after the first publish at least. • multiple users is kind of a proof-of-concept at this point; platypub isn't ready to be deployed as a managed service yet. There's no security to prevent users from editing each others docs etc, though absent any tampering the UI will only show your own docs

🚀 1
😁 1
😍 1
jeffparker21:06:24

The migrate! function worked well on my existing data. So far all is working same as before. Thanks. I needed to run npm install -D @tailwindcss/forms for the newly-introduced plugin, FYI.

jeffparker22:06:10

The sticky editor toolbar is a very nice enhancement, especially in mobile-sized windows.

👌 1
Jacob O'Bryant00:06:30

hm, that shouldn't be necessary. I just did a fresh clone and am running into some other issues with tailwind so I'll investigate more later

Jacob O'Bryant00:06:12

oh actually it was the same error. I think it wasn't showing up in stdout because the tailwind command exits with status 0 even when there were errors, so com.biffweb/sh swallows the stderr output. Anyway, just pushed a commit with that added to package.json

👍 1
Jacob O'Bryant18:06:30

I think I'll aim to announce platypub on Tuesday. If anyone else wants to give it a try before then that'd be great. See the readme: https://github.com/jacobobryant/platypub

Cal Herries10:06:39

FYI I’m trying to publish a platypub site, but I’m having trouble previewing or publishing it. The problem seems to be with the relative paths in the node modules. When I try to preview a site, I get this error:

INFO com.platypub.feat.sites - node:internal/modules/cjs/loader:942
  throw err;
  ^

Error: Cannot find module '../peers/index.js'
Require stack:
- /Users/callumherries/code/clj/play/platypub/storage/previews/6d1724e6-cce0-46ce-95f0-008ca3a11895/node_modules/.bin/tailwindcss
    at Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
    at Module._load (node:internal/modules/cjs/loader:780:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/callumherries/code/clj/play/platypub/storage/previews/6d1724e6-cce0-46ce-95f0-008ca3a11895/node_modules/.bin/tailwindcss:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Module._load (node:internal/modules/cjs/loader:827:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/callumherries/code/clj/play/platypub/storage/previews/6d1724e6-cce0-46ce-95f0-008ca3a11895/node_modules/.bin/tailwindcss'
  ]
}

Node.js v18.3.0
"Elapsed time: 820.852262 msecs"
Even though the referenced file exists at the path storage/previews/6d1724e6-cce0-46ce-95f0-008ca3a11895/node_modules/tailwindcss/peers/index.js I get a similar error when trying to publish a site, but with the yargs package, not tailwindcss. My node and npm version:
$ node -v
v18.3.0
$ npm -v
8.12.1 

Jacob O'Bryant01:06:22

huh, very interesting... I have no idea why that would be happening. I'll try to investigate that on Friday. (looks like I'm on v12.22.1 for node and 6.14.12 for npm, hopefully upgrading will trigger the bug). Thanks for the report!

Jacob O'Bryant16:06:09

@U0123R34Q9Y I'm assuming you're on OS X? I've tried using same node and npm versions but didn't get the error. Current hypothesis is that for some reason the symlinks aren't being handled correctly on your machine. i.e. node_modules/.bin/tailwindcss is a symlink to node_modules/tailwindcss/lib/cli.js , and ../peers/index.js is the first thing it requires--I wonder if the require is being resolved from the node_modules/.bin/ directory for some reason instead of node_modules/tailwindcss/lib/. (similar for node_modules/.bin/zip-it-and-ship-it, which runs when you publish a site). In an empty directory, does npm install tailwindcss && npx tailwindcss --help work?

Jacob O'Bryant22:06:54

whelp I finally got dev environment working on my usually-unused mac and looks like I get this error too

Jacob O'Bryant01:06:20

Just pushed a commit which I believe fixes this (I ran into problems with my mac environment so haven't been able to test it to make sure, but I'm pretty confident it'll work): https://github.com/jacobobryant/platypub/commit/e1a28ffa90d278c609b83c1d40d2dbe5cc593352 It was kind of a weird bug. on mac (but not linux for some reason, I guess), npm install adds a _where key to the package.json of all the packages in node_modules , which contains the absolute path of the directory in which npm install was ran. Before this commit, platypub ran npm install in themes/default first and then copied the folder over to storage/previews/* , as a way to cache the npm deps. Even though the _where key is https://github.com/npm/npm/issues/10393, evidently it was breaking something here. (Although I didn't test the fix with platypub, I was able to reproduce the bug while running a simple npx tailwindcss --help from the terminal, and the fix worked). So now after copying the theme folder to storage/previews/*, we delete node_modules and run npm install again each time, which actually still seems to be fairly fast.

🙌 1
Cal Herries06:06:15

Brilliant! Works now. Thanks for diving into that

🎅 1