Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Too many metafiles and chest.js

Too many metafiles and chest.js

東京Node学園 13時限目
「増え続けるmetafileが生む問題とchest.js」
http://nodejs.connpass.com/event/6763/

Daijiro Wachi

June 24, 2014
Tweet

More Decks by Daijiro Wachi

Other Decks in Programming

Transcript

  1. Too Many Metafiles
    and
    chest.js
    @watilde

    View Slide

  2. @author
    • @watilde

    • npm publish / month

    • beeplay, tvm, jsss

    • Bootstrap / Ratchet / Flight / Node <3

    View Slide

  3. • PHP
    @work

    View Slide

  4. Main Subject
    "Too many metafiles"

    View Slide

  5. Front End

    Development Tools

    View Slide

  6. tool name file name
    npm
    • package.json

    • .npmrc

    • node_modules
    jshint
    • .jshintrc

    • .jshintignore
    Grunt • Gruntfile.js
    gulp • gulpfile.js
    editorconfig • .editorconfig
    bower
    • bower.json

    • .bowerrc
    component.io • component.json etc…
    have some metafiles:

    View Slide

  7. Tripling Each Year
    0
    1
    2
    3
    5
    6
    7
    8
    9
    2012 2013 2014
    Number of metafiles I use frequently

    View Slide

  8. Next Year: 27 Files!?
    0
    5
    10
    15
    20
    25
    30
    2012 2013 2014 2015
    Number of metafiles I use frequently
    Just kidding XD
    (maybe…)

    View Slide

  9. 4 Problems
    • Ugly root directory

    • Init process growing increasingly complex

    • Need a "Package Manager" manager

    • Too many different types of commands

    View Slide

  10. • Ugly root directory

    • Init process growing increasingly complex

    • Need a "Package Manager" manager

    • Too many different types of commands
    4 Problems
    These are resolved by the current version of chest.js

    View Slide

  11. Ugly root directory
    •Routine example:
    $ cd ~/project/
    $ ls
    .editorconfig .git/ .gitignore
    .travis.yml .jshintrc bower.json

    CONTRIBUTING.md Gruntfile.js 

    README.md bin/ lib/ package.json 

    power_assert.js spec/ src/

    View Slide

  12. Init process growing
    increasingly complex
    • Most users of these front end development
    tools are web designers

    • Many of them don’t like terminal

    • Have to run many commands;(

    View Slide

  13. Symbolic Link + .gitignore
    $ ls ./.meta
    - package.json
    - bower.json
    !
    $ ln -s .meta/* ./
    !
    $ cat .gitignore
    ./package.json
    ./bower.json

    View Slide

  14. npm run-scripts
    // package.json
    "scripts": {
    "install": "ln -s .meta/* ./",
    "postinstall": "bower install"
    },
    https://www.npmjs.org/doc/scripts.html

    View Slide

  15. Easier

    View Slide

  16. http://chestjs.com/
    Enter chest.js

    View Slide

  17. Getting started

    View Slide

  18. e.g)

    General example project:
    $ cd ~/project/
    $ ls
    .editorconfig .git/ .gitignore
    .travis.yml .jshintrc bower.json

    CONTRIBUTING.md Gruntfile.js 

    README.md bin/ lib/ package.json 

    power_assert.js spec/ src/

    View Slide

  19. Install chest command
    $ npm install -g chest
    $ chest
    !
    @see ‘chest usage’

    View Slide

  20. Put metafiles in the chest
    $ chest put .editorconfig

    .travis.yml Gruntfile.js
    package.json power_assert.js
    !
    $ ls
    .chest .git/ .gitignore

    CONTRIBUTING.md README.md

    bin/ lib/ spec/ src/

    View Slide

  21. Show list
    $ chest list
    .editorconfig

    .travis.yml
    bower.json
    Gruntfile.js
    package.json
    power_assert.js

    View Slide

  22. Create symbolic link
    $ chest open
    $ ls
    .editorconfig .git/ .gitignore
    .travis.yml .jshintrc bower.json

    CONTRIBUTING.md Gruntfile.js 

    README.md bin/ lib/ package.json 

    power_assert.js spec/ src/

    View Slide

  23. Support install
    $ chest install
    !
    run npm install
    run bower install

    View Slide

  24. Open & Install in postinstall
    $ cat package.json
    ɾɾɾ
    "scripts": {
    "postinstall": "chest boost"
    },
    ɾɾɾ

    View Slide

  25. What’s next?

    View Slide

  26. • Ugly root directory

    • Init process growing increasingly complex

    • Need a "Package Manager" manager

    • Too many different types of commands
    4 Problems
    Will resolve these in future versions of chest.js

    View Slide

  27. Need a

    "Package Manager" manager
    •Version, Name, Description, etc

    •Currently when updating one metafile, you
    have to changes all the others manually

    •Ideally, chest.js will manage this info with one
    base file

    View Slide

  28. Too many

    different types of commands
    •case(grunt || gulp) write usage

    •Others: npm-run-script, make, bash, etc

    •difficult to write usage

    •Challenging to ensure backward

    compatibility for commands

    View Slide

  29. chest.json
    {
    name: ‘node-gakuen’,
    description: ‘A school for node lovers’,
    version: ‘4.13.6’,
    scripts: {
    build: {
    usage: ‘build all file’,
    run: ‘grunt build’
    }
    }
    }

    View Slide

  30. chest.json
    • chest syncɿsync both metainfo
    {
    name: ‘node-gakuen’,
    description: ‘A school for node lovers’,
    version: ‘0.0.1’,
    scripts: {
    build: {
    usage: ‘build all files’,
    run: ‘grunt build’
    }
    }
    }

    View Slide

  31. chest.json
    •chest-run-scriptsɿcommand rapper required usage
    {
    name: ‘node-gakuen’,
    description: ‘A school for node lovers’,
    version: ‘0.0.1’,
    scripts: {
    build: {
    usage: ‘build all file’,
    run: ‘grunt build’
    }
    }
    }

    View Slide

  32. http://chestjs.com/
    < Thanks!
    Any questions?

    View Slide