Git Product home page Git Product logo

l3digital's Introduction

l3 Digital logo

L3 Digital

CircleCI

Static website for L3 Digital, built using GatsbyJS, React, GraphQL, and supplied with content from Contentful CMS. It takes it's design from a HTML5UP theme port gatsby-starter-forty.

Dependencies

  • Gatsby-cli - npm install -g gatsby-cli

Getting Started

  • Install dependencies - npm install
  • Start local development server - npm run dev
  • This will serve up a dev server with hot reload locally at http://localhost:8000/

Environment files

In order to build locally you will need the following files and variables defined in the root of the project. Gatsby makes use of dotenv for building locally, as well as Zeit Now during a local server build using now dev.

.env
    - SENDER_EMAIL
    - SENDER_PASSWORD
.env.build
    - CONTENTFUL_SPACE_ID
    - CONTENTFUL_API_KEY
.env.development
    - SENDER_EMAIL
    - SENDER_PASSWORD
    - CONTENTFUL_SPACE_ID
    - CONTENTFUL_API_KEY

These files SHOULD NOT be committed to the staging/production builds or repo. The variables are stored on the server for build configuration.

For Mobile development

Simply run npm run dev::mobile. You can then access the development server via http://{HOSTNAME}:8000 on any mobile device. This URL will also be printed in the terminal for reference.

Note: You need to be on the same network. Also, if your device is connected to a proxy, you will need to disable it to access the dev server

Production

Running npm run build will build the static site and assets found in /public. You can then publish these as a static site anywhere.

Testing

Testing is carried out via Jest. You can run the test suites by using npm test. This will run all tests and snapshots.

If you have made component changes, more than likely this will affect the snapshots and you will need to run npm test -- -u in order to update the failing snapshots (be sure that the new snapshots reflect the changes correctly).

Zeit Now

Zeit Now is used to deploy and alias builds of the application.

Staging builds are created for non-Master branches. Production builds are created from Master.

Deployment for Staging

You can run a Staging build yourself with npm run now-build::staging, this will initialise, build and deploy the static files to a staging domain. It also now, creates a lambda to handle the contact form.

Debugging

Whilst running deployment you may incur issues with the build. The CLI will inform you of this and tell you how to check the logs for more information.

But you can simply grab the target domain and run now logs https://l3-digital-44t7pkt0h.now.sh .. This is an example as each domain is unique, so make sure to update the URL in this command.

GraphQL

Once you have your development server up and running, this will also spin up a GraphiQL IDE which you can inspect your graph data with queries. This can be accessed at http://localhost:8000/___graphql

The left panel is your query panel, a default query should auto-populate. Failing this, use one of the working examples from the site.

The right panel shows the response back from the server. This will allow you to identify the correct nodes needed for development.

"Docs" on the far right side will allow you to search for available data, such as the content models available from Contentful CMS.

Linting

This is handled by our CI which uses eslint in order to run checks and balances through the codebase. It incorporates plugins for es6 and react to help the eslint parse correctly.

Can be run locally by npm run lint

linting CircleCI config

Dependencies

  • Docker
  • CircleCI CLI $ curl -o /usr/local/bin/circleci https://circle-downloads.s3.amazonaws.com/releases/build_agent_wrapper/circleci && chmod +x /usr/local/bin/circleci

You can then make changes, when needed, to the Circle CI config.yml file and test it locally by npm run lint::circleci

Prop-types

The CI is more strict when it comes to checking prop-types during the linting step. Make sure that all namespaces are correct which you are checking as this can cause the builds to fail.

Troubleshooting

  • Static asset issue - Use npm run clearcache which will remove all stale data and fix the issue.
  • GraphQL issues - New content and assets can take time to propogate out. If it's an issue in local development then try restarting your development server.
  • Zeit Now sometimes fails to deploy during merge checks, and the logs provide no further useful information. This seems to be related to some form of server-side caching. If re-deployment continues to fail, then try deploying manually via CLI with npm run now-build::production. If it continues to fail, then try simplifying your changes to identify the breaking change.
  • If you're having trouble building the project due to missing environment variables, make sure that you have the relavant dotenv files in the root of the project. As mentioned in Environment files.

l3digital's People

Contributors

leigh-mills avatar lmcjt37 avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

l3digital's Issues

Bug | Invalid prop types

A number of invalid prop type errors are appearing in the console

Failed prop type: HomeIndex: prop type 'data' is invalid; it must be a function, usually from React.PropTypes.

Failed prop type: Invalid prop 'description' of type 'object' supplied to 'IndexArticle', expected 'string'.

Investigate cause...

Header not appearing correctly on mobile

Tested on iPhone 6S - iOS 11.4.1

All you see is the dark blue background and the header component isn't appearing. It seems you are still able to click the tag of the logo to reload the home page, but this isn't visible either.

The rest of the page and sub-pages appear to load and render correctly.

Suspected cause is the implementation of the tertiary logic for and

Bug | Slow loading images

Banner images appear to be loading in slowly, to the point where I'm seeing them part load

Speed test for checking difference.
[30ping | 8.45Mbps download | 0.96Mbps Upload]

Tech Debt | Migrate to V2

Migrate to Gatsby V2

Resolve any dependency issues, including auditing node modules and resolving peer dependencies.

Content | Update social links

These are found in the menu and footer.

Need to create accounts and link these up correctly. If not wanted then the icons/links need removing.

Projects page

Use GraphQL to grab the data and populate the page with project items.

The same process used in the index page can be re-used here.

Tech Debt | No menu hover state for project pages

This is down to there not being the correct page nodes created for project pages with a parent of projects.

If the pages were l3digital.co.uk/projects/<project_page> then we could use the partiallyActive prop to identify projects as the parent, enhancing the menu.

UX | Removal of personal info

Based on current situation of having a main employment, if the site went live detailing who was in the team it may look bad.

Remove?

Tech Debt | Review tooling

The tooling used to develop and deploy the website should be reviewed.

Suggestions for other tooling options, or to add further tooling.

Bug | All pages missing layout wrapper

As previously missed from the index page.

V2 has significant migration changes, one of which is that pages aren't automatically wrapped with the layout/index.

Simply need to import and wrap all returned renders with Layout

Bug | Dividers not showing

Dividers are not appearing on Safari browsers.

These dividers use inline SVG, where this could be the reason that they are not appearing.

It could be mark-up, or XML parsing, or the simple reason Safari browsers doesn't support these SVGs.

UI | Improve look of information sections

Typically informational sections use a base colour background and show copy and an image. A suggestion would be to create some shapes or change the background for these sections so that it splits the content and looks more pleasant.

Home page has an example of where this could be applied.

Tech Debt | Audit node modules

This may require bumping the node and npm versions in the engines object of package.json

You can then run npm audit for more details

Update README

Add any missing explanations for new users and the package scripts that haven't been detailed.

Bug | Mobile | showing wrong header on load

When viewing on mobile (iPhone XR), upon load the dynamic header meant for desktop only loads. As you scroll, the mobile header then renders.

I would suspect that the screen width for mobile browsers isn't working correctly?

UI | Med-Large screen width, Images too big

When viewing a page such as projects or about-us, if the screen width is 737px-979px then the image widths are 100%. Images at this size consume too much of the page and isn't a great UX.

UX | Smarter return button on Projects

When accessing projects and specifically individual pages. The back button only goes back to '/projects' but if we know the from location we can return the user properly to the previous page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.