GithubHelp home page GithubHelp logo

kottans / framework-2021 Goto Github PK

View Code? Open in Web Editor NEW
28.0 9.0 9.0 677 KB

A custom framework empowered Weather App

Home Page: https://kottans.org/framework-2021/

JavaScript 71.39% HTML 28.61%
fe-framework weather-app kottans

framework-2021's Introduction

Framework

A gradual FE JS framework development.

End game

Have a web app as a practical implementation of an application backed with a basic FE framework.

Framework features:

  • components with props
  • html-like syntax
  • app state management
  • event handling
  • async network requests

Out of scope:

  • reconciliation
  • app state persistency between sessions
  • everything else :)

Development

Make sure you have Node.js installed on your machine.

npm install to install dependencies. Ignore npm audit warnings. If any changes appear on package-lock.json just commit those.

npm start to launch dev server, app would be served at http://localhost:1234/

npm run lint to lint and prettify your code

The project implements a pre-commit hook that launches staged files linting. If your IDE reports a commit failure then run npm run lint and/or npm run lint:staged and fix reported issues. Note that .eslintrc.js allows console.error and console.warn.

npm run build to build production distribution package

npm run deploy to publish built app

framework-2021's People

Contributors

amashoshyna avatar oleksiyrudenko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

framework-2021's Issues

Add components with props, htmlx (v1.2)

Pre-requisites:

  • Template literals & tagged letrals: write your own template parser:
    • simple interpolation
    • every param transformed (strings are enclosed in qoutes, numerics are multiplied, objects/arrays stringified, functions => FuncName())
  • Data Structures: write your own DOM tree and HTML renderer
  • RegExp: write your own HTML parser (HTML string => tree)

Task:

  • Function calls => HTMLX
  • Each function => component with props

Setup dev env

  • .gitignore
  • .editorconfig
  • eslint config
  • prettier config
  • package.json (with npm)
  • builder (with HMR/watch)

Homework assignment v1.0.x => 1.1.x; Preps to v1.2

Complete the items below taking the item group priority into consideration

P0 - must have
P1 - nice to have; put aside for a while when any task of a higher priority arrives (e.g. next homework in the course)
P2 - you will really ramp your skills up if you do; put aside when any task of a higher priority arrives (e.g. next homework in the course)

v1.0.x => v1.1.x

Preps to v1.2

dev env: Change app deployment script to use gh-pages

Issue 1

Problem:
a8e06ad (currently on dev) brings back push-dir as a publishing script.
Alternative deployment package gh-pages is already listed among dev dependencies.

Desired outcome:
gh-pages is used as a publishing method.

Suggested approach:
package.json: change deploy script so that it runs gh-pages -d dist

Issue 2

Problem:
a8e06ad (currently on dev) brings back shell interpretation of glob passed to npx prettier.

Desired outcome:
npx prettier glob is quoted and therefore interpreted by prettier, not shell.

Suggested approach:
package.json: change prettify script so that it runs npx prettier --write \"**/*.{js,css,md,html}\"

Homework assignment v1.1.x => v1.2.x; Preps to v1.3.x

Complete the items below

P0 - must have
P1 - nice to have; put aside for a while when any task of a higher priority arrives (e.g. next homework in the course)
P2 - you will really ramp your skills up if you do; put aside when any task of a higher priority arrives (e.g. next homework in the course)

v1.1.x => v1.2

  • P0: split your code base into modules (components, data/API, framework)
  • P0: migrate to JSX
  • P1: make your app looking nice with a touch of visual design / css-styling

parcelJS v1.12.4 incompatible with nodeJS v14+

Problem

Under windows 10, NodeJS v14+, with parcel-bundler v1.12.4 as a dev dependency npm run start results in D:\dev\OR\kottans\framework-2021\index.js: Invalid Version: undefined
error.

It's a known issue.

Solution

Pin parcel-bundler version as 1.12.3 in dev-dependecies

Add component functions (v1.0)

Components:

  • App
  • Search by city
  • Temperature units switch (F/C)
  • Today's weather
  • 5 days forecast

Framework.render

Static data (3 cities, todays weather, 5 days forecast)

css-in-js

Source: https://codesandbox.io/s/pedantic-wilson-41ip7?file=/src/index.ts:0-442

//@ts-expect-error
import kebabCase from "kebab-case";

const styles = {
  color: "blue",
  fontFamily: "comic sans ms",
  fontSize: "42px"
};

Object.defineProperty(styles, "toString", {
  value: function (this: string) {
    return Object.keys(this)
      .map((key) => `${kebabCase(key)}:${this[key]}`)
      .join(";");
  },
  writable: false
});

document.getElementById("app").innerHTML = `
  <div style="${styles}">Hello world</div>
`;

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.