wk

Source Code (Github)

wk is a CLI tool for developing single-page-applications with web components syntax.

usage

Introduction

Documentation and Website is not complete yet

wk is a simple and opinionated CLI tool that imposes a simple approach that (only) uses html, css and javascript for writing web applications.

This CLI has 3 simple commands that is sufficient to

Installation

This CLI tool is available as an executable binary only for linux-x86-64

wget wk.js.org/dist/wk

Goals

Who is this for?

This is an experimental build tool that I use in my own projects, and I don't expect anyone to find this useful and use in their own work.

I have prepared this document for those who really dislikes modern web development and looking for an alternative approach to build web applications.

Since I am biased against modern methods of web development, I tried to get rid of all unnecessary (IMO) frameworks, transpilers, task runners, dependency managers as much as possible and implemented some of their functionality in this CLI in a very minimal way.

Here are the list of the most radical decisions in this web application development method that can show you if this CLI is a good fit for you or not.

1. Imperative over Declarative / Markup and logic separated

Despite writing more code, imperative programming is (IMO) easier to debug and has less hidden behaviour. Not having the full control on rendering makes trivial problems like 'preventing redundant re-renders' a big issue and forces you to either learn the internals of the declarative rendering logic or blindly follow the constantly-changing-best-practice for that specific problem.

Wk also tries to keep markup and logic separated which is impossible for declerative UI programming. Mixing markup and logic requires you to invent a new language or a new syntax (eg: directives in angular/vue and jsx in react). HTML/JS/CSS are already very high level and powerful concepts and adding another language to the web is redundant. There is no need to learn a new programming or markup language since current ones already sufficient to build complex web applications. Since wk does not introduce any runtime itself, only concept that should be understood is the lifecycle callbacks of the standart web components.

2. Manual DOM manipulation

Methods like data binding, virtual DOM are not used in projects developed with wk. Those concepts introduces lots of complexity and mostly ends up writing more code than their manual DOM management counterparts. Hence all dom manipulation is done manually with using methods and properties like querySelector, cloneNode and , innerHTML. In order to develop web apps with this tool you must be proficient with standart Web APIs and manual DOM manipulation techniques. Wk is not a beginner friendly tool and it expects you to know all Web APIs by heart.

3. No 3rd party tool support and not configurable

Wk is especially designed as non-integrable with other popular tools like webpack, grunt, gulp, babel, typescript, sass, eslint, package.json and etc.. If one of these tools are essential for your workflow or if you like configuration files wk is probably not a good tool for you.

CLI Usage

Initializing a project

wk init

Starting development server

wk start

Making a production build

wk build

Documentation

documentation is not complete

A freshly initialized project will have following 5 files

./src/components/web-app/web-app.html
./src/components/web-app/web-app.css
./src/components/web-app/web-app.js
./public/index.html
./jsconfig.json

dont serve the base project folder or public folder yourself for development always use wk start command for development

Style Guide

projects written with wk are encouraged to use following style guide

Changelog

wk is in under active development since 2018 and i have made lots of breaking changes to it, below is the track of all those changes

unfortunately there is no foreseeable date for stable version release yet

Migration Notes 0.4.14 to 0.5.0

July-20-2020

Migration Notes 0.3.0 to 0.3.1

August-26-2019

folder structure is changed with this release (this is a breaking change)

folder name 'com' has an undesired resemblance with Android package names ( eg: com.foo.bar ) i thought having 3 letter base folder names looked cool ( www, src, com) but every developer that tried to use wk, complained with these cryptic namings.

Migration Notes 0.2.22 to 0.3.0

August-18-2019

i have decided to make a breaking change to wk and dropped typescript support

even though i love typescript and typed languages for programming, i had some negative experiences with 'typescript' so far

what is gained by dropping typescript

what is lost by dropping typescript

still, i am not convinced that dropping typescript is a good idea, since wk is still in an experimental stage, i may re-introduce typescript in the future