Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rfc/issue 355 no bundle development #417

Merged
merged 60 commits into from
Nov 12, 2020

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Sep 22, 2020

Related Issue

uses #355 of bundle-less development as a base to re-design the project from the ground as prototyped in this POC repo and now uses . The new vision is to be more HTML based and try align more with the native practices and patterns of the web instead of doing it all through JS / webpack, like using import maps in development instead of bundlers, <script type="module">, and generating more ESM friendly output using Rollup.

Right now only the home page is migrated and no GraphQL / SPA yet...

This is presented in the context of a proposed 1.0 And Beyond Roadmap

Screen Shot 2020-09-22 at 9 39 19 AM

Screen Shot 2020-09-22 at 9 41 15 AM

This also fixes (intentionally or unintentionally)

This also invalidates the following issues

Summary of Changes

  1. Created a new lifecycle for a Koa server to use when developing and serializing
  2. Was able to remove the scaffolding lifecycle
  3. Use rollup with some custom created plugins
  4. No bundling in development
  5. We now have a built in serve command for view production builds locally with no external dependencies

TODOs

  1. Duplicate row of <app-cards> when built for production, roll back puppeteer version, or something to do with <slot>? - created instances of <slot>-ed content and lit-element are rendering twice #433
  2. Enable build for all pages / app and page templates for production and develop
  3. build out header navigation from graph.json
  4. Remove usages of execSync in build lifecycle
  5. app template example
  6. fix favicon.ico loading (using <meta> tag, should be a <link> tag)
  7. rollup.config.js TODOs - not needed for this PR
  8. Make sure all lifecycles are using Greenwood compilation object
  9. Get basic specs / build passing amd update coverage / linting configurations if needed
  10. Remove remaining references to webpack - not needed for this PR
  11. prettify URLs (strip index.html) and make sure to support root HTML files, e.g. about.html -> /about
  12. Replace npx http-server with "bare" Koa server
  13. how to import / register a customElement from npm, e.g.' - created handle bare imports in HTML <script> tags when running build command #434
    <script type="module">
      import '@evergreen-wc/eve-container';
    </script>
  14. Markdown code blocks not rendering
  15. prism.css not found in production build - will do as part of more robust standalone Rollup CSS bundling PR - restore support for CSS bundling (w/Rollup) #427
  16. Create release/0.10.0 branch

Questions

  1. Keep colors package? - added to final release and questions checklist #428
  2. Is a theme.css still needed now from the CLI specifically? - added to final release and questions checklist #428
  3. Keep cli/templates? (+clean up context lifecycle) - added to final release and questions checklist #428
  4. How to handle shelf nav click / sub nav display? Use <detail>? - created ensure correct working order of website and expected styles (e.g. shelf and scrolling, docs, markdown plugins, etc) #432

Known Issues

These will be solved in another PR as part of the [**Feature Parity]

@thescientist13 thescientist13 added the RFC Proposal and changes to workflows, architecture, APIs, etc label Sep 22, 2020
@thescientist13 thescientist13 mentioned this pull request Sep 22, 2020
53 tasks
@thescientist13 thescientist13 self-assigned this Sep 22, 2020
@thescientist13
Copy link
Member Author

Spent a little time looking at the double rendering of <eve-card> and I think this may be related to LitElement.

The serialized output is pretty much the same but it looks like in this branch, the content that should be in the Shadow DOM is duplicated in the Light DOM, where on the current site only the static content is in the light DOM.

Prod

  <eve-row class="style-scope wc-md-53f9cab0ead9d09 eve-53f9cab0ead9d09"><!---->
    
      
    <eve-card title="webpack" img="/assets/webpack.svg" size="full" style="width:100%" class="style-scope wc-md-53f9cab0ead9d09 eve-53f9cab0ead9d09"><!---->
    
      <div class="card card-full style-scope eve-card">
        
        <div class="card-img-top style-scope eve-card">
          <img class="style-scope eve-card" src="/assets/webpack.svg" alt="webpack">
        </div>
      
        
        <h3 class="style-scope eve-card"><!---->webpack<!----></h3>
      
        <div class="body style-scope eve-card">
          
      To us, webpack is more than a module bundler, it's an entire development ecosystem!  We use webpack
      under the hood to power the development workflow and to help generate a performant site for you with the power of tools like Babel and PostCSS.  The best part?  You don't have to know anything about that!  Greenwood handles all the configuration and optimizations for you, so you can be sure that your users will get the best experience possible, and as a developer, so will you.
    
        </div>
      </div>
    <!----></eve-card>
    <eve-card title="Web Components" img="/assets/webcomponents.svg" size="full" style="width:100%" class="style-scope wc-md-53f9cab0ead9d09 eve-53f9cab0ead9d09"><!---->
    
      <div class="card card-full style-scope eve-card">
        
        <div class="card-img-top style-scope eve-card">
          <img class="style-scope eve-card" src="/assets/webcomponents.svg" alt="Web Components">
        </div>
      
        
        <h3 class="style-scope eve-card"><!---->Web Components<!----></h3>
      
        <div class="body style-scope eve-card">
          
      Do we love Web Components?  You bet we do!  In fact, it's one of many things we love about the modern web, including other features like Modules, FlexBox and CSS Grid, Fetch API, and more!  It's all there for you in the browser, and with Greenwood, we make sure all those features will work for all your users.  Sit back and write the modern code you want and Greenwood will take care of the rest.
    
        </div>
      </div>
    <!----></eve-card>
    <eve-card title="NodeJS" img="/assets/nodejs.png" size="full" style="width:100%" class="style-scope wc-md-53f9cab0ead9d09 eve-53f9cab0ead9d09"><!---->
    
      <div class="card card-full style-scope eve-card">
        
        <div class="card-img-top style-scope eve-card">
          <img class="style-scope eve-card" src="/assets/nodejs.png" alt="NodeJS">
        </div>
      
        
        <h3 class="style-scope eve-card"><!---->NodeJS<!----></h3>
      
        <div class="body style-scope eve-card">
          
      Although Greenwood generates a static site that you can host just about anywhere (Netlify, S3, Apache, etc), for developing and building your site Greenwood requires NodeJS to be available on the command line.  This allows us to tap into all the amazing web development tools and libraries available on npm and also means you can use those packages too when developing your own site!  Greenwood will aim to support the latest LTS release of NodeJS and the version of npm that comes with.
    
        </div>
      </div>
    <!----></eve-card>
  
    <!----></eve-row>

Screen Shot 2020-09-23 at 9 08 44 PM

Now

<app-row><!---->
      
                  <app-card title="webpack" img="../assets/webpack.svg" size="full" style="width:100%"><!---->
    
      <div class="card card-full style-scope app-card">
        
        <div class="card-img-top style-scope app-card">
          <img class="style-scope app-card" src="../assets/webpack.svg" alt="webpack">
        </div>
      
        
        <h3 class="style-scope app-card"><!---->webpack<!----></h3>
      
        <div class="body style-scope app-card">
          
                    To us, webpack is more than a module bundler, it's an entire development ecosystem!  We use webpack
                    under the hood to power the development workflow and to help generate a performant site for you with the power of tools like Babel and PostCSS.  The best part?  You don't have to know anything about that!  Greenwood handles all the configuration and optimizations for you, so you can be sure that your users will get the best experience possible, and as a developer, so will you.
                  
        </div>
      </div>
    <!----></app-card>
                  <app-card title="Web Components" img="../assets/webcomponents.svg" size="full" style="width:100%"><!---->
    
      <div class="card card-full style-scope app-card">
        
        <div class="card-img-top style-scope app-card">
          <img class="style-scope app-card" src="../assets/webcomponents.svg" alt="Web Components">
        </div>
      
        
        <h3 class="style-scope app-card"><!---->Web Components<!----></h3>
      
        <div class="body style-scope app-card">
          
                    Do we love Web Components?  You bet we do!  In fact, it's one of many things we love about the modern web, including other features like Modules, FlexBox and CSS Grid, Fetch API, and more!  It's all there for you in the browser, and with Greenwood, we make sure all those features will work for all your users.  Sit back and write the modern code you want and Greenwood will take care of the rest.
                  
        </div>
      </div>
    <!----></app-card>
                  <app-card title="NodeJS" img="../assets/nodejs.png" size="full" style="width:100%"><!---->
    
      <div class="card card-full style-scope app-card">
        
        <div class="card-img-top style-scope app-card">
          <img class="style-scope app-card" src="../assets/nodejs.png" alt="NodeJS">
        </div>
      
        
        <h3 class="style-scope app-card"><!---->NodeJS<!----></h3>
      
        <div class="body style-scope app-card">
          
                    Although Greenwood generates a static site that you can host just about anywhere (Netlify, S3, Apache, etc), for developing and building your site Greenwood requires NodeJS to be available on the command line.  This allows us to tap into all the amazing web development tools and libraries available on npm and also means you can use those packages too when developing your own site!  Greenwood will aim to support the latest LTS release of NodeJS and the version of npm that comes with.
                  
        </div>
      </div>
    <!----></app-card>
                
    <!----></app-row>

Screen Shot 2020-09-29 at 9 55 08 PM


Has to do with something regarding Shadow DOM and possibly nested <slot> possibly and If I comment out the <script> tag for card.js in the serialized index.html, there is no issues, so seems JavaScript / lit related.

Couple things to look into

  • same version of lit-element
  • downgrade version puppeteer
  • try just using HTMLElement
  • try with unserialized index.html contents

@thescientist13
Copy link
Member Author

Here's some initial benchmarking of the Getting Started page

Prod

Screen Shot 2020-09-29 at 10 49 50 PM

Screen Shot 2020-09-29 at 10 50 19 PM

Here

Bulk of the JS coming from raw graph.json, but still scores a 💯 😄 . Pretty big improvement though!

Screen Shot 2020-09-29 at 10 50 51 PM

Screen Shot 2020-09-29 at 10 51 33 PM

@thescientist13 thescientist13 changed the base branch from release/0.10.0 to master October 25, 2020 22:49
@thescientist13
Copy link
Member Author

Pretty cool now, if I load up the build output of the Getting Started case, there's basically no overhead anymore. This is just running locally, too.

Screen Shot 2020-10-22 at 10 36 56 PM
Screen Shot 2020-10-22 at 10 37 54 PM

compared to the live site

Screen Shot 2020-10-22 at 10 38 11 PM
Screen Shot 2020-10-22 at 10 39 04 PM


If anything, the font is what's weighing it down, and could maybe be optimized to use <link prefetch> at least? Will track as part of general list of optimizations I keeping notes on.

@thescientist13
Copy link
Member Author

Opening / closing to trigger a build

@thescientist13 thescientist13 merged commit abe7b6f into release/0.10.0 Nov 12, 2020
@thescientist13 thescientist13 deleted the rfc/issue-355-no-bundle-development branch November 12, 2020 01:21
@thescientist13 thescientist13 linked an issue Dec 31, 2020 that may be closed by this pull request
5 tasks
thescientist13 added a commit that referenced this pull request Apr 3, 2021
* basic unbundled rendering of home page

* got livereload working for all files

* JSON support

* import CSS support

* disable eslint complexity

* header working

* ading banner and stylinh and fixed binary image loading

* integrated evergreen deps

* fully restored the home page in develop mode

* wip getting serialization working

* wip getting serialization working

* clean up and refactor, serialize WIP

* upgrade puppeteer to latest

* a  bit hacky but home page is now being built for production

* render header navigation from graph

* page template working for site in development

* all pages working in develop

* all pages serializing for prod

* sort header and shelf

* shelf expansion and table of contents

* label fallback handling

* fix index page rendering

* clean up logging

* favicon support

* refactor server lifecycle to use compilation and expose devServer

* built in serve command

* serve docs

* add support for app templates

* pretty URLs

* shelf working WIP

* quick styling tweak for side nav

* copy assets and graph.json in copy lifecycle

* basic support for css files

* fix copy error for nested folders

* call rollup from JS API

* rollup configuration sourced from compilation

* make sure to await Promise.all

* Rfc/issue 355 organize serve lifecycle (#419)

* task: organize serve

* fix: remove ctx from resolve

* fix: refactor further

* task: scope filters by file

* linting

* renable default tests and limited smoke tests

* disable all tests enable subset of tests

* meta specs

* enable custom title case

* enable custom workspace spec

* track missing dev dep

* enabled workspace assets test case

* fix link closing slash

* content-outlet refactor

* enabled getting started test case

* enable nested directory test case

* enable app template case

* enable page template spec

* enable user directory mapping case

* update comments

* got code markdown rendering and added support for custom plugins from config

* markdown plugins working including prism

* default markdown specs

* enable all tests

* rename markdown case

* syntax highlighting markdown spec

Co-authored-by: Grant Hutchinson <h.g.utchinson@gmail.com>
thescientist13 added a commit that referenced this pull request Apr 3, 2021
* basic unbundled rendering of home page

* got livereload working for all files

* JSON support

* import CSS support

* disable eslint complexity

* header working

* ading banner and stylinh and fixed binary image loading

* integrated evergreen deps

* fully restored the home page in develop mode

* wip getting serialization working

* wip getting serialization working

* clean up and refactor, serialize WIP

* upgrade puppeteer to latest

* a  bit hacky but home page is now being built for production

* render header navigation from graph

* page template working for site in development

* all pages working in develop

* all pages serializing for prod

* sort header and shelf

* shelf expansion and table of contents

* label fallback handling

* fix index page rendering

* clean up logging

* favicon support

* refactor server lifecycle to use compilation and expose devServer

* built in serve command

* serve docs

* add support for app templates

* pretty URLs

* shelf working WIP

* quick styling tweak for side nav

* copy assets and graph.json in copy lifecycle

* basic support for css files

* fix copy error for nested folders

* call rollup from JS API

* rollup configuration sourced from compilation

* make sure to await Promise.all

* Rfc/issue 355 organize serve lifecycle (#419)

* task: organize serve

* fix: remove ctx from resolve

* fix: refactor further

* task: scope filters by file

* linting

* renable default tests and limited smoke tests

* disable all tests enable subset of tests

* meta specs

* enable custom title case

* enable custom workspace spec

* track missing dev dep

* enabled workspace assets test case

* fix link closing slash

* content-outlet refactor

* enabled getting started test case

* enable nested directory test case

* enable app template case

* enable page template spec

* enable user directory mapping case

* update comments

* got code markdown rendering and added support for custom plugins from config

* markdown plugins working including prism

* default markdown specs

* enable all tests

* rename markdown case

* syntax highlighting markdown spec

Co-authored-by: Grant Hutchinson <h.g.utchinson@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking RFC Proposal and changes to workflows, architecture, APIs, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<meta> Component package
2 participants