josemarluedke / docfy

Build fully personalized documentation sites; write content and demos in Markdown.
https://docfy.dev
MIT License
74 stars 26 forks source link

How can I write gjs / gts? #141

Open NullVoxPopuli opened 2 years ago

NullVoxPopuli commented 2 years ago

I'd like to provide live demos of strict-mode templates in my docs.

Can I write gjs / gts?

josemarluedke commented 2 years ago

Currently, we don't have support for it, but a PR adding would be welcome.

nicolechung commented 1 year ago

How would this work (as someone who only knows a bit about gjs/gts?)

Would it be something like:

  1. install glint as dev dependencies
  2. modify lines like this one: https://github.com/josemarluedke/docfy/blob/367f4946c144db8c5ef4e03fe44ba7450c89849e/packages/ember/src/index.ts#L38
  3. add a glint component to packages/ember/addon
  4. publish a glint demo?
NullVoxPopuli commented 1 year ago

glint is totally separate from gjs/gts, but the gist would be

  1. install ember-template-imports peerDependencies entry
  2. not quite, there is no backing js with gjs/gts. it just... is. I really think we should switch to using the live tag here : https://github.com/josemarluedke/docfy/blob/367f4946c144db8c5ef4e03fe44ba7450c89849e/packages/ember/src/plugins/extract-demos-to-components.ts#L63 as I do here: https://jsbin.com/serolidome/1/edit?html,output gjs needs to be returned here: https://github.com/josemarluedke/docfy/blob/367f4946c144db8c5ef4e03fe44ba7450c89849e/packages/ember/src/plugins/extract-demos-to-components.ts#L68 (or we use the live tag, and don't mess with that branch

Another option may be to just make a separate plugin for gjs/gts components using the liveCodeExtraction plugin I have in the jsbin

nicolechung commented 1 year ago

So I tried copying over the code from above, and then adding this to the README in the dummy-docs:

{imagine backticks here}gjs live
<template>
Hello!
</template>
{/end imagine backticks here}

But I got the following error:

Error occurred:

- While rendering:
  -top-level
    application
      docs
        docs.index

There was an error running your app in fastboot. More info about the error:
 Error: Attempted to resolve `ember-repl8a6aa7086c6a5dfb-b99e0fc2d0433e37`, which was expected to be a component, but nothing was found.
    at resolveComponent (/var/folders/jc/81dkjn9s2sg5cpt_66jd8l640000gn/T/broccoli-19053Mj6xWKP11waW/out-206-broccoli_merge_trees/assets/@glimmer/opcode-compiler.js:234:1)
    at encodeOp (/var/folders/jc/81dkjn9s2sg5cpt_66jd8l640000gn/T/broccoli-19053Mj6xWKP11waW/out-206-broccoli_merge_trees/assets/@glimmer/opcode-compiler.js:2521:1)
    at pushOp (/var/folders/jc/81dkjn9s2sg5cpt_66jd8l640000gn/T/broccoli-19053Mj6xWKP11waW/out-206-broccoli_merge_trees/assets/@glimmer/opcode-compiler.js:2445:1)
nicolechung commented 1 year ago

Note ^^ I tried updating fastboot, thinking it was maybe an earlier version, but this didn't seem to change that error message.

NullVoxPopuli commented 1 year ago

ember-repl8a6aa7086c6a5dfb-b99e0fc2d0433e37,

was a component named this emitted on the broccoli tmp dir?

nicolechung commented 1 year ago

It looks like it...I will try to get a screenshot of the folder.