Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🥊 Technical Knockout – The Monorepo for Knockout.js (4.0+)

License

NotificationsYou must be signed in to change notification settings

knockout/tko

Repository files navigation

npm versionJoin the chat at https://gitter.im/knockout/tkoCircle CICoverage StatusJavaScript Style Guide

TKO houses the monorepo ofKnockout.

Getting Started

To install use one of the usual package managers e.g.

  • $yarn add @tko/build.reference
  • $npm install @tko/build.reference

Over CDN

Knockout Build

The Knockout build has some backwards compatibility that is not in the reference build. See the build differences, here:https://tko.io/3to4

It's available as@tko/build.knockout, and over CDN:

Using the Monorepo

CommandEffect
$git clone git@github.com:knockout/tkoClone the repository.
$npm install -g yarnEnsure yarn is globally available
$yarnInstall local node packages and link tko modules
$makeCurrently TKO use a make file
$yarn testRun all tests. See below.
$yarn watchRun all tests and watch for changes. See below.
$yarn buildBuild tko[.module][.es6][.min].js files, where.es6 version has not been transpiled
$lerna publishBump versions and publish to npm registry

Checkoutpackage.json => scripts for more commands that can be executed withyarn {command}.

In each individualpackages/*/ directory, you can also run (presumingrollup andkarma are installed globally):

CommandEffect
$karma COMMAND ../../karma.conf.js [--once]Test the local package, where COMMAND is e.g.start orrun
$rollup -c ../../rollup.config.jsBuild the package into the localdist/

Testing withyarn test andyarn watch

NEW

Start tests with electron:make test

Start tests with headless-chrome:make test-headless

OLD

Theyarn test andyarn watch commands can be used in the root directory, where it will run across all tests, or alternatively in anypackages/*/ directory to run testsspecific to that package.

Optional arguments toyarn test include:

  • --sauce — use Sauce Labs to test a variety of platforms; requires an account at Sauce Labs andSAUCE_USERNAME andSAUCE_ACCESS_KEY to be set in the environment.
  • --noStartConnect — Do not start a new Sauce Connect proxy instance for everytest; requires that Sauce Connect be already running.

visual.html

Note that runningkarma orrollup will create avisual.html file that shows the proportional size of imports into each package.

Objectives

TKO aims to become a base for future versions of Knockout. The objectives include:

  • Modularization into ES6 and separate projects, with compilation using an ES6 compiler likeRollup. This solves several problems with Knockout, including:
    • Some folks want to roll-their-own with e.g. removing components
    • Compilation is now with Closure compiler, which is actually transliterating – meaning thedebug andminified versions have different code paths (mostly in the form of things exposed indebug being missing in theminified version)
    • The compilation of Knockout is just concatenation, leading to difficulties with maintainance, severance, and replacement
  • Documentation inline in the source code. This aims to make it easier to document, by making documentation adjacent to the code about-which it speaks. Also, we aim to have examples in the documentation.
  • A more comprehensive home page. The hope is to have something fun and fancy, and we havea rough prototype.
  • Better setup for plugins. The problems with Knockout include:
    • There's no central, searchable repository for knockout
    • What should be simple plugins (e.g. binding handlers or providers) are complex, including:
      • Built-ins have first-class access to quite a bit of good Knockout code, but plugins generally have second-class access and often have to duplicate Knockout internals
      • Quality plugins have lots of boilerplate for compilation, release, documentation, and testing

Some WSL tricks

Install electron-deps for "make test":

sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \libnotify-dev libasound2-dev libcap-dev \libcups2-dev libxtst-dev \libxss1 libnss3-dev gcc-multilib g++-multilib curl \gperf bison python3-dbusmock openjdk-8-jre

Install Chrome for "make test-headless":

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.debsudo apt -y install ./google-chrome-stable_current_amd64.deb

Next steps

There's anissue for that.

License

MIT license -http://www.opensource.org/licenses/mit-license.php.

Shout Outs

Browser Stack

[8]ページ先頭

©2009-2025 Movatter.jp