Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

ssg-dev doesn't detect new markdown files #15

Open
justinmoon opened this issue Jan 18, 2020 · 6 comments
Open

ssg-dev doesn't detect new markdown files #15

justinmoon opened this issue Jan 18, 2020 · 6 comments

Comments

@justinmoon
Copy link
Collaborator

justinmoon commented Jan 18, 2020

ssg is running via ssg dev.

I have a content/ folder with markdown files.

I type touch content/new.md. The server logs content/new.md changed. rebuilding...

new.md is not returned by this.ssgData({}) inside route preload functions.

I kill the server and re-run ssg dev and now new.md is returned by this.ssgData({})

@justinmoon
Copy link
Collaborator Author

I'm building off ssg-demo. Problem might be on that end ...

@justinmoon
Copy link
Collaborator Author

When I enabled debugging with DEBUG=* ssg dev, I noticed that these log statements only appear when the server starts:

  ssg:cli reading ssg config +0ms
  ssg:cli-ssg reading ssg config +0ms
  ssg:cli getting SSG data Index +1ms
  ssg:cli-ssg getting core data index +0ms
  ssg:coreData creating ssgCoreData Index +0ms
  ssg:cli-ssg running ssg.config.js createIndex +62ms
  ssg:cli-ssg saving core data index +0ms
  ssg:cli getting watching SSG data files... +62ms
  ssg:cli-ssg watching ssg files +0ms

It seems like the index of files is only created once and isn't recreated after that?

@justinmoon
Copy link
Collaborator Author

justinmoon commented Jan 18, 2020

Do we really only want to call getSSGDataOnce once? Wouldn't we also want to call it inside watchSSGFiles's watchHandler?

@justinmoon justinmoon changed the title SSG doesn't detect new markdown files while running ssg-dev doesn't detect new markdown files Jan 18, 2020
@justinmoon
Copy link
Collaborator Author

justinmoon commented Jan 18, 2020

BTW I'm not a frontend developer so am unsure how to set up my environment to attempt ^^.

I tried cd'ing to ssg-demo/node_modules/ssg and running npm run build but that doesn't do anything -- seems this folder is missing it's src/ folder.

Some basic "contributing" tips would be helpful. It seems like I need to clone ssg into ssg-demo/node_modules?

@swyxio
Copy link
Owner

swyxio commented Jan 21, 2020

hey @justinmoon! sorry for delayed response. you're right on both counts - ssg dev should detect new markdown files, AND i should have some contributing tips.

i would say that the first part isnt high priority but the second one is. don't worry - this kind of thing isnt standard knowledge even for frontend devs. i should probably just record something for you asap.

@swyxio
Copy link
Owner

swyxio commented Jan 21, 2020

i unfortunately dont have the bandwidth to record something for you today. long story short - ssg is written in typescript, so typescript compiles from a src folder to a dist folder, and we only publish the dist folder to npm. only the dist code ends up being run. makes sense right? thats why ssg-demo/node_modules/ssg doesnt have a src.

this may shock you but i havent really implemented the local dev story yet for contributing to ssg. i think we'll probably want to use ts-node and then yarn link it over to wherever you're trying stuff out (e.g. ssg-demo). willing to try to learn how to do this? i can teach you, just help me document it :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants