東京Node学園 13時限目 「増え続けるmetafileが生む問題とchest.js」 http://nodejs.connpass.com/event/6763/
Too Many Metafilesandchest.js@watilde
View Slide
@author• @watilde• npm publish / month• beeplay, tvm, jsss• Bootstrap / Ratchet / Flight / Node <3
• PHP@work
Main Subject"Too many metafiles"
Front End Development Tools
tool name file namenpm• package.json• .npmrc• node_modulesjshint• .jshintrc• .jshintignoreGrunt • Gruntfile.jsgulp • gulpfile.jseditorconfig • .editorconfigbower• bower.json• .bowerrccomponent.io • component.json etc…have some metafiles:
Tripling Each Year0123567892012 2013 2014Number of metafiles I use frequently
Next Year: 27 Files!?0510152025302012 2013 2014 2015Number of metafiles I use frequentlyJust kidding XD(maybe…)
4 Problems• Ugly root directory• Init process growing increasingly complex• Need a "Package Manager" manager• Too many different types of commands
• Ugly root directory• Init process growing increasingly complex• Need a "Package Manager" manager• Too many different types of commands4 ProblemsThese are resolved by the current version of chest.js
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/
Init process growingincreasingly complex• Most users of these front end developmenttools are web designers• Many of them don’t like terminal• Have to run many commands;(
Symbolic Link + .gitignore$ ls ./.meta- package.json- bower.json!$ ln -s .meta/* ./!$ cat .gitignore./package.json./bower.json
npm run-scripts// package.json"scripts": {"install": "ln -s .meta/* ./","postinstall": "bower install"},https://www.npmjs.org/doc/scripts.html
Easier
http://chestjs.com/Enter chest.js
Getting started
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/
Install chest command$ npm install -g chest$ chest!@see ‘chest usage’
Put metafiles in the chest$ chest put .editorconfig .travis.yml Gruntfile.jspackage.json power_assert.js!$ ls.chest .git/ .gitignore CONTRIBUTING.md README.md bin/ lib/ spec/ src/
Show list$ chest list.editorconfig .travis.ymlbower.jsonGruntfile.jspackage.jsonpower_assert.js
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/
Support install$ chest install!run npm installrun bower install
Open & Install in postinstall$ cat package.jsonɾɾɾ"scripts": {"postinstall": "chest boost"},ɾɾɾ
What’s next?
• Ugly root directory• Init process growing increasingly complex• Need a "Package Manager" manager• Too many different types of commands4 ProblemsWill resolve these in future versions of chest.js
Need a "Package Manager" manager•Version, Name, Description, etc•Currently when updating one metafile, youhave to changes all the others manually•Ideally, chest.js will manage this info with onebase file
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
chest.json{name: ‘node-gakuen’,description: ‘A school for node lovers’,version: ‘4.13.6’,scripts: {build: {usage: ‘build all file’,run: ‘grunt build’}}}
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’}}}
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’}}}
http://chestjs.com/< Thanks!Any questions?