Background

The official website of YUI is not available and it might not be coming back. Here are some alternatives.

Build YUI

Preparation

Install Node.js and other tools globally:

npm -g install grunt-cli
npm -g install shifter
npm -g install yogi
npm -g install phantomjs

Building Steps

Get the source from git.

git clone https://github.com/yui/yui3.git

Install required modules locally. Sometimes some modules failed to install. If so, then install them one by one.

npm install
 
npm install grunt

One of the commands below can be used to build the library:

grunt release
 
grunt build
 
yogi build
 
cd src && shifter --walk

The first one grunt release will create release directory. This directory contains the few kinds of builds in which YUI deploys.

The third one yogi build just builds the tree.

The second one grunt build runs yogi build and npm i.

The last one shifter is used to rebuild the entire YUI src tree.

Bugs Fix

Errors

There are some errors while building in my machine.

1. error in cpr module.

Running "npm-copy" task
Copying to build dir: /usr/local/www/static/vendor/yui3/build-npm
**Fatal error: Path must be a string. Received undefined**

This is caused by cpr module (it could be in node_modules or node_modules/grunt-yui-contrib/node_modules).

Modify the createFiles function in the cpr/lib/index.js:

var from = files.pop(),
    to = options.toHash[from];
if (!from) {
    return check();
}
var dir = path.dirname(to);

2. error in yogi about grover module.

yogi [bail] grover is not installed :(
Fatal error: yogi test exited with code: 1

Copy the grover module into yogi module:

cp -R node_modules/grover node_modules/yogi/node_modules/

3. error in yuitest module.

Two different errors related to yuitest:

Found a local install of YUITest, remove it please..

local yogi yuitest can not be found, you may need to reinstall yogi..

Remove the yuitest in node_modules/.bin and create a symbol link for yuitest in node_modules/yogi/node_modules/.bin.

rm node_modules/.bin/yuitest
 
cd node_modules/yogi/node_modules/.bin
ln -s ../../../yuitest/cli.js yuitest

4. error in unit test.

In src/yql/tests/unit/assets/yql-tests.js, all the unit tests such as test_query, test_https and so on are failing.

The API from Yahoo (http://query.yahooapis.com/v1/public/yql) is not available anymore. So, the query with the YQLRequest object cannot succeed.

We can delete those testings.

In src/yui/tests/unit/assets/object-test.js, one assert is incorrect:

Assert.areSame(0, Y.Object.size('foo'));

The value should be 3.

Results

Unfortunately, I cannot build the library successfully yet after all these modifications.

The building process is stuck in:

yogi [info] yuitest tests complete
Starting Grover on 302 files with PhantomJS@2.1.1
Running 15 concurrent tests at a time.
Using a 120 second timeout per test.

It cannot continue. The release directory is not generated. But a directory named build-npm is generated.

Using YUIDoc

We can also use YUIDoc to generate API docs for YUI.

Create a yuidoc.json file like:

{
    "name": "YUI API documentation version",
    "description": "YUI API documentation generated by YUIDoc",
    "version": "3.18.1",
    "url": "https://github.com/yui/yui3",
    "options": {
        "linkNatives": "true",
        "outdir": "./api",
        "paths": "."
    }
}

outdir is output directory and paths is directory of the library.

Generate the documentation or run it as a server:

yuidoc .
 
yuidoc . --server [port]

After this, the API documentation in HTML format are generated in the output directory.

API dirs

API pages

Alternatives

Other alternatives online:

  1. http://yssl.org/lib/yui/docs/
  2. http://yssl.org/lib/yui/api/
  3. https://web.archive.org/web/20140902233923/http://www.yuilibrary.com/

References

  1. YUI 3: The Yahoo User Interface Library at GitHub
  2. YUIDoc: YUI Javascript Documentation Tool at GitHub
  3. YUI Developer Workflow
  4. Using YUIDoc


blog comments powered by Disqus

Published

06 September 2020

Tags