ProjectEvergreen / greenwood

Greenwood is your workbench for the web, embracing web standards from the ground up to empower your stack from front to back.
https://greenwoodjs.dev
MIT License
100 stars 10 forks source link

generated build output is creating some unexpected / broken pages when page name has index in it (v0.10.0-alpha.1) #455

Closed thescientist13 closed 3 years ago

thescientist13 commented 3 years ago

Type of Change

Summary

Noticed that there are a couple of interesting pages directories being created in the public/ directory. Not sure if this is related to some sort of incorrect regex / string match? (index.h, plugin-hooks/)

Screen Shot 2020-12-24 at 12 34 08 PM

I tested in #449 too and was able to repro there.

Details

For index.h it doesn't seem to break anything, though it must be coming there from somewhere? So obviously not ideal.

plugins-hooks is bit more problematic. It shows up on the Plugins sidebar correctly, but clicking the linking breaks and goes to the wrong page

Screen Shot 2020-12-24 at 12 36 31 PM Screen Shot 2020-12-24 at 12 36 46 PM

My guess is that this has something to do with the fact that index is in both of these names.

thescientist13 commented 3 years ago

Hmm, I must have been getting my tests mixed up, and I can't reproduce in the release/0.10.0 branch, but it is an issue in the branch for #449 , so I will just push the change there.

thescientist13 commented 3 years ago

I take it back.. it was misleading.

Although in the output from the console, the page paths looks correct

% yarn build
yarn run v1.12.3
$ node . build
-------------------------------------------------------
Welcome to Greenwood ♻️
-------------------------------------------------------
Running Greenwood with the build command.
Initializing project config
Initializing project workspace contexts
Generating graph of workspace files...
Serializing pages at http://127.0.0.1:1984
pages to generate

 ./about/community.md
 ./about/features.md
 ./about/goals.md
 ./about/how-it-works.md
 ./about/index.md
 ./docs/build.md
 ./docs/component-model.md
 ./docs/configuration.md
 ./docs/css-and-images.md
 ./docs/data.md
 ./docs/front-matter.md
 ./docs/index.md
 ./docs/layouts.md
 ./docs/markdown.md
 ./docs/menus.md
 ./docs/tech-stack.md
 ./getting-started/branding.md
 ./getting-started/build-and-deploy.md
 ./getting-started/creating-content.md
 ./getting-started/index.md
 ./getting-started/key-concepts.md
 ./getting-started/next-steps.md
 ./getting-started/project-setup.md
 ./getting-started/quick-start.md
 ./guides/cloudflare-workers-deployment.md
 ./guides/firebase.md
 ./guides/index.md
 ./guides/netlify-cms.md
 ./guides/netlify-deploy.md
 ./guides/now.md
 ./guides/s3-cloudfront.md
 ./plugins/composite-plugins.md
 ./plugins/index-hooks.md
 ./plugins/index.md
 ./plugins/webpack.md
serializing page... /
serializing page... /about/community/
serializing page... /about/features/
serializing page... /about/goals/
serializing page... /about/how-it-works/
serializing page... /about/
serializing page... /docs/build/
serializing page... /docs/component-model/
serializing page... /docs/configuration/
serializing page... /docs/css-and-images/
serializing page... /docs/data/
serializing page... /docs/front-matter/
serializing page... /docs/
serializing page... /docs/layouts/
serializing page... /docs/markdown/
serializing page... /docs/menus/
serializing page... /docs/tech-stack/
serializing page... /getting-started/branding/
serializing page... /getting-started/build-and-deploy/
serializing page... /getting-started/creating-content/
serializing page... /getting-started/
serializing page... /getting-started/key-concepts/
serializing page... /getting-started/next-steps/
serializing page... /getting-started/project-setup/
serializing page... /getting-started/quick-start/
serializing page... /guides/cloudflare-workers-deployment/
serializing page... /guides/firebase/
serializing page... /guides/
serializing page... /guides/netlify-cms/
serializing page... /guides/netlify-deploy/
serializing page... /guides/now/
serializing page... /guides/s3-cloudfront/
serializing page... /plugins/composite-plugins/
serializing page... /plugins/index-hooks/
serializing page... /plugins/
serializing page... /plugins/webpack/
Since Acorn 8.0.0, options.ecmaVersion is required.
Defaulting to 2020, but this will stop working in the future.
Serializing complete for page /about/features/.
Serializing complete for page /docs/.
Serializing complete for page /docs/component-model/.
Serializing complete for page /docs/css-and-images/.
Serializing complete for page /about/goals/.
Serializing complete for page /docs/front-matter/.
Serializing complete for page /about/.
Serializing complete for page /getting-started/build-and-deploy/.
Serializing complete for page /docs/data/.
Serializing complete for page /.
Serializing complete for page /docs/configuration/.
Serializing complete for page /about/how-it-works/.
Serializing complete for page /about/community/.
Serializing complete for page /guides/netlify-cms/.
Serializing complete for page /docs/build/.
Serializing complete for page /getting-started/project-setup/.
Serializing complete for page /docs/menus/.
Serializing complete for page /getting-started/creating-content/.
Serializing complete for page /getting-started/branding/.
Serializing complete for page /docs/markdown/.
Serializing complete for page /getting-started/.
Serializing complete for page /getting-started/quick-start/.
Serializing complete for page /guides/.
Serializing complete for page /getting-started/next-steps/.
Serializing complete for page /plugins/index-hooks/.
Serializing complete for page /plugins/composite-plugins/.
Serializing complete for page /guides/netlify-deploy/.
Serializing complete for page /guides/now/.
Serializing complete for page /docs/tech-stack/.
Serializing complete for page /guides/cloudflare-workers-deployment/.
Serializing complete for page /guides/s3-cloudfront/.
Serializing complete for page /getting-started/key-concepts/.
Serializing complete for page /docs/layouts/.
Serializing complete for page /guides/firebase/.
Serializing complete for page /plugins/webpack/.
Serializing complete for page /plugins/.
done serializing all pages
copying assets/ directory...
copying graph.json...
✨  Done in 16.00s.

Looking at the actual output of public/, we see the unwanted output

So not related to #449 at all.

thescientist13 commented 3 years ago

Hmm.. did some more testing, looks this was actually a local development issue only, as I had pages in my .greenwood/ directory that were causing this. When running this, everything was fine, even on release/0.10.0 branch.

% git status
On branch release/0.10.0
Untracked files:
  (use "git add <file>..." to include in what will be committed)
    TODO.md

% rm -rf ./public && rm -rf _.greenwood/_ && yarn build

...

% ls -l public
total 288
drwxr-xr-x   7 owenbuckley  staff    224 Dec 28 16:24 about
drwxr-xr-x  26 owenbuckley  staff    832 Dec 28 16:24 assets
-rw-r--r--   1 owenbuckley  staff   3762 Dec 28 16:24 banner.b8fdba25.js
-rw-r--r--   1 owenbuckley  staff   1531 Dec 28 16:24 card.7da9cd6c.js
drwxr-xr-x  13 owenbuckley  staff    416 Dec 28 16:24 docs
-rw-r--r--   1 owenbuckley  staff    912 Dec 28 16:24 eve-container.d5da388f.js
-rw-r--r--   1 owenbuckley  staff   1043 Dec 28 16:24 footer.8f4ef5eb.js
drwxr-xr-x  10 owenbuckley  staff    320 Dec 28 16:24 getting-started
-rw-r--r--   1 owenbuckley  staff  49973 Dec 28 16:24 graph.json
drwxr-xr-x   9 owenbuckley  staff    288 Dec 28 16:24 guides
-rw-r--r--   1 owenbuckley  staff   7283 Dec 28 16:24 header.47e6822e.js
-rw-r--r--   1 owenbuckley  staff  22371 Dec 28 16:24 index.html
-rw-r--r--   1 owenbuckley  staff  27126 Dec 28 16:24 lit-element.5d109b2b.js
drwxr-xr-x   6 owenbuckley  staff    192 Dec 28 16:24 plugins
-rw-r--r--   1 owenbuckley  staff    372 Dec 28 16:24 row.0820cdfe.js
-rw-r--r--   1 owenbuckley  staff    839 Dec 28 16:24 scroll.2bbdfbda.js
-rw-r--r--   1 owenbuckley  staff   4445 Dec 28 16:24 shelf.b8bee4ad.js
drwxr-xr-x   5 owenbuckley  staff    160 Dec 28 16:24 styles
owenbuckley@Owens-MBP-2 greenwood % ls -l public/plugins
total 56
drwxr-xr-x  3 owenbuckley  staff     96 Dec 28 16:24 composite-plugins
drwxr-xr-x  3 owenbuckley  staff     96 Dec 28 16:24 index-hooks
-rw-r--r--  1 owenbuckley  staff  25459 Dec 28 16:24 index.html
drwxr-xr-x  3 owenbuckley  staff     96 Dec 28 16:24 webpack

I guess I should do a better job of maintaining my local dev environment. 😊

thescientist13 commented 3 years ago

Ok, there still seems to be an issue with this, but it is a bit more subtle now for the [index-hooks]() page. (notice the page is empty)

The routes and page index.html is correct

% ls -l public/plugins 
total 56
drwxr-xr-x  3 owenbuckley  staff     96 Dec 30 12:56 composite-plugins
drwxr-xr-x  3 owenbuckley  staff     96 Dec 30 12:56 index-hooks
-rw-r--r--  1 owenbuckley  staff  26667 Dec 30 12:56 index.html
drwxr-xr-x  3 owenbuckley  staff     96 Dec 30 12:56 webpack

But looking at the the page source will show that it is not getting its <content-outlet> swapped out.

      <div class="container-fluid style-scope eve-container">

          <app-scroll><!---->

            <content-outlet></content-outlet>

    <!----></app-scroll>

      </div>