Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
一休.comにおけるfrontend開発
Search
yusuke sasajima
March 29, 2016
1.3k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
一休.comにおけるfrontend開発
yusuke sasajima
March 29, 2016
More Decks by yusuke sasajima
See All by yusuke sasajima
一休.com を支えるデータ分析基盤
zimathon
3
6.3k
SQLアンチパターン勉強会 #2
zimathon
0
400
Featured
See All Featured
Navigating Team Friction
lara
192
16k
How to build a perfect <img>
jonoalderson
1
6.1k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.5k
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
690
ラッコキーワード サービス紹介資料
rakko
1
5.1M
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
450
How to make the Groovebox
asonas
2
2.5k
Deep Space Network (abreviated)
tonyrice
0
350
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
Code Review Best Practice
trishagee
74
20k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Transcript
Ұٳ.comʹ͓͚Δϑϩϯ τΤϯυ։ൃʢϞμϯฤʣ גࣜձࣾҰٳ ౡ༞հ @zimathon
ΞδΣϯμ • WebForms => .NET MVCͷҠߦ • ϑϩϯτΤϯυपΓͷٕज़ͷಋೖʹ͍ͭͯ • TypescriptΛ࠾༻ͨ͠ཧ༝
• ͦͷޙͲ͏ͳ͔ͬͨ • ৽͍ٕ͠ज़ΛεϜʔζʹಋೖ͢Δʹ
ࣗݾհ • ౡ ༞հ (@zimathon) • ॓ധࣄۀຊ෦ɹγεςϜ։ൃ෦ • Engineering Manager
WebForms => .NET MVC
෦తʹϦχϡʔΞϧ • ೝূαʔϏε • ձһೝূपΓ͚ͩΛΓग़ͯ͠ɺMVCԽ • Outboundʢւ֎ϗςϧ༧αΠτʣ • ৽αʔϏεʢ͜͏͍͏ͷద༻͍͢͠ʣ
৽͘͠࠾༻ٕͨ͠ज़ • Typescript • ࠷ۙ1.8.7ʹ͋͛·ͨ͠ • Sass/Compass • bower •
gulp
ΫϥΠΞϯτڥߏஙํ๏ • batϑΝΠϧͰߏங • Ұٳͷ։ൃڥ࡞࣌ʹɺ୭͕͠Ұ࣮ ߦ͢ΔbatϑΝΠϧ • choco, npm ʹΑΓΠϯετʔϧ͞Ε·͢
• node.js, gulp, Typescript, sass, etc…
࣮ࡍͷbatϑΝΠϧʢҰ෦ʣ @call npm -g list | findstr /I "
[email protected]
" >
nul 2>&1 @if errorlevel 1 ( %LOGGER% "### Installing TypeScript with npm." @call npm install -g
[email protected]
>> %LOGFILE% 2>&1 ) else ( %LOGGER% "### typescript is installed." ) @call npm -g list | findstr /I "gulp" > nul 2>&1 @if errorlevel 1 ( %LOGGER% "### Installing gulp with npm." @call npm install -g gulp >> %LOGFILE% 2>&1 ) else ( %LOGGER% "### gulp is installed." ) @call npm -g list | findstr /I "
[email protected]
" > nul 2>&1 @if errorlevel 1 ( %LOGGER% "### Installing bower with npm." @call npm install -g
[email protected]
>> %LOGFILE% 2>&1 ) else ( %LOGGER% "### bower is installed." )
Lintಋೖ • TypeScript Lint • Scss Lint • ΄΅σϑΥϧτͷઃఆͰӡ༻͍ͯ͠·͢
bower.json { "name": "Ikyu", "dependencies": { "jquery": "~1.11.3", "underscore": "~1.8.3",
"js-sha256" : "~0.3.0" } }
TypeScriptͷϏϧυʢൈਮʣ var gulp = require('gulp'); var typescript = require('gulp-typescript'); var
uglify = require('gulp-uglify'); var sourcemaps = require('gulp-sourcemaps'); var plumber = require('gulp-plumber'); var notify = require('gulp-notify'); exports.createGulpTask = function (subDir, taskName) { return function () { gulp.src([INPUT_ROOT_DIR + subDir + taskName + '.ts']) .pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')})) .pipe(sourcemaps.init()) .pipe(typescript(createTypeScriptConfig(taskName + '.js'))) .js .pipe(uglify()) .pipe(sourcemaps.write('.', { sourceRoot: INPUT_ROOT_DIR })) .pipe(gulp.dest(OUTPUT_ROOT_DIR + subDir)); } }
SassͷϏϧυʢൈਮʣ var gulp = require('gulp'); var compass = require('gulp-compass'); var
plumber = require('gulp-plumber'); var notify = require('gulp-notify'); exports.createGulpTask = function (subDir, taskName) { return function(){ gulp.src(INPUT_ROOT_DIR + subDir + taskName + '.scss') .pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')})) .pipe(compass({ config_file: INPUT_ROOT_DIR + 'config.rb', comments: false, css: OUTPUT_ROOT_DIR, sass: INPUT_ROOT_DIR })); } }
࠷ۙͷํੑ • bowerΛ֎͍ͨ͠ • ຊʹඞཁͳநԽϨΠϠʔͳͷ͔ • ϑϩϯτͷϥΠϒϥϦnpmʹἧ͖ͬͯͨ • TypescriptΛطଘͷαʔϏεʹల։͍͖ͯͨ͠ ͍
ϑϩϯτΤϯυपΓͷٕज़ͷ ಋೖʹ͍ͭͯ
None
Γ͍͕ͨͭҾͬுΔελΠϧ • ͋Ε͍Ε͍ͨɺ͜ΕΓ͍ͨΛ࣮ݱ͢Δҝʹ ओಋతʹಈ͘ • νʔϜͱͯ͠։ൃΛਐΊΔҎ্ɺಓࢣͱ͠ ͯؤுΔ • શମͷҙࢥܾఆʹؔͯ͠Λ࣋ͭ
TypescriptΛ࠾༻ͨ͠ཧ༝
Google TrendsΑΓ
ݱঢ়ͷ՝ • ॓ധαΠτϦϓϨΠεͯ͠ɺ6͕ܦա • ൃੜͨ͠՝ • ࠶ར༻͞Εͳ͍ؔʢྨࣅ͕ؔଟ͍ʣ • Ͳ͔͜Βࢀর͞Ε͍ͯΔ͔Θ͔Βͳ͍jsϑΝΠϧ •
1ϖʔδͰࢀর͢ΔjsϑΝΠϧ͕ଟ͗͢Δ • jqueryґଘʢjqueryϥΠϒϥϦଟਿʣ • ΈΜͳ͖উखʹೖΕͯ͠·ͬͯɺԿ͕ਖ਼͍͠ͷ͔Θ͔Βͳ͍ • ࠞࡏ͢Δjqueryͷόʔδϣϯ • lint͕ྲྀͤͳ͍ɻɻɻ
۩ମతͳΞΫγϣϯΛͯ͜͠ ͳ͔ͬͨ
࣮ࡍͷϖʔδͰࢀর͢Δjs
࣮ࡍͷϖʔδͰࢀর͢Δjs
ʊਓਓਓʊ ʼɹ27%ɹʻ ʉY^Yʉ
Α͋͘Δձ ৽ਓʮ͜ͷjsͬͯͳΜͰ͜͜ͰಡΈࠐ·ΕͯΔΜ Ͱ͚ͨͬ͠ʁʯ ϕςϥϯʮͦΕͲ͔͜ΒΑΕͯͳ͍Αʯ ৽ਓʮͳΔ΄Ͳɻ(͡Ό͋ফͯ͘͠ΕΑʂʣʯ
ͳͥTypescript͔ʁ • ࣾͷϑϩϯτΤϯυྗͷ࣮ • ͦΕ΄Ͳߴ͍ͷͰͳ͍ • babelͳͲΛಋೖͯ͠ɺՌ͖ͨͯͬͪ͠Γӡ༻Ͱ͖Δ͔Ͳ ͏͔ • ݴޠʹΑΔ੍ΛͨͤΔ͖
• ܕʹΑΔνΣοΫ • ׳Ε͍ͯΔΫϥεϕʔεͰॻ͚Δ
• Visual Studioͱͷ૬ੑ • VisualStudioCode͍͍͘͢͝Ͱ͢ΑͶʂ • Ϟδϡʔϧ࠶ར༻͍͢͠ • ES6ޓͷॻ͖ํʹͳΔ ͳͥTypescript͔ʁ
TypeScriptΛಋೖͯ͠ى͖ͨ ͜ͱ
ೝূαʔϏε
TypeScript͕ͦͦਁಁ͠ͳ͍ • letͱvar ͷ͍͚ • functionΩʔϫʔυͱΞϩʔγϯλοΫεʹΑΔڍ ಈͷҧ͍ • ܧঝ͖͢෦Ͱܧঝ͠ͳ͍ •
Ͳ͏ͯ͠ݱঢ়ͷjavascriptʹҾͬுΒΕͯ͠·͏
lintͰൃੜͨ͠Τϥʔ͕Θ͔Γͮ Β͍ Error: public\ts\member\xxx.ts(42,56): error TS2345: Argument of type 'JQuery'
is not assignable to parameter of type '(index: number, value: number) => string[]'. toString()ͷఆٛ࿙Ε
ES5ʹݶఆͰ͖ΔڥͰແ͔ͬͨ • ϦϦʔε࣌ͷIEͷαϙʔτόʔδϣϯ • 8Ҏ߱ • ೝূαʔϏεͷϦϦʔεʹΑͬͯαϙʔτ͕ଧͪফ͞Ε ͕ͨɺप͞Εͣ • ϦϦʔεޙɺࠞཚ
• Ϣʔβʔ͔Βͷ͍߹Θͤ͋Γ
গͣͭ͠શମʹਁಁ • ͩΜͩΜ׳Ε͖ͯͨ • ઌۦऀ͕1ਓ͍ͨͷͰɺͦͷϝϯόʔ͕νʔ ϜΛϦʔυ • ࠓ·Ͱͷjavascriptͷ՝ղܾΛ࣮ײ • ϞδϡʔϧԽɺܧঝ
etc
Outbound ʢւ֎༧αʔϏεʣ
.tsͷத͕ੜjs • TypeScriptΛಋೖͨ͠ཧ༝͕ɺɺɺ • σβΠφʔ͕.tsϑΝΠϧΛ࡞ • αʔϏεͷϩʔϯνΛ༏ઌͯ͠ɺٕज़తͳڭ ҭΛߦ͏͕࣌ؒແ͔ͬͨ
Ϧʔυ͢Δਓେࣄʂ • ͲΜͳٕज़Ͱಋೖ͢Δ͚ͩͰ͏·͍͔͘ ͳ͍ • ઌۦऀ͕νʔϜશମʹ͛ΔΑ͏ʹಈ͘͜ͱ • ͍ํΛ͑Δ • ࢥΛ͑Δ
ࠓޙͷΞΫγϣϯ
ࢦ͍ͯ͠Δํ
TypescriptΛಋೖ͢Δ • طଘγεςϜʢ॓ധɺϨετϥϯʣͰTypescriptΛ͏ • .jsΛ.tsʹมߋ͢Δ • ·ͣTypescript Λར༻Ͱ͖ΔڥΛ͑Δ • গͣͭ͠෦ॲཧΛTypescriptʹஔ͖͍͑ͯ͘
• ཧ۶ΑΓʮྑ͘ͳͬͨʯͱ͍͏࣮ײ
jslintΛ࣮ߦ͢Δ function checkOffCoupon(msg) { var input = document.getElementById("<%= x.ClientID %>").value;
var apply = window.document.aspnetForm.elements["<%= Me.b.CdName %>"].value; if (input != '') { if (apply == '') { if (window.document.aspnetForm.elements["<%= Me.b.StatusName %>"].value == "<%= CodeMasterFlg.False %>") { msg = msg + \n"; } else { msg = msg + \n"; } } else if (input != apply) { msg = msg + \n"; } } return msg; }
jslintΛ࣮ߦ͢Δ function checkOffCoupon(msg) { var input = document.getElementById("<%= x.ClientID %>").value;
var apply = window.document.aspnetForm.elements["<%= Me.b.CdName %>"].value; if (input != '') { if (apply == '') { if (window.document.aspnetForm.elements["<%= Me.b.StatusName %>"].value == "<%= CodeMasterFlg.False %>") { msg = msg + \n"; } else { msg = msg + \n"; } } else if (input != apply) { msg = msg + \n"; } } return msg; } ୯७ʹͦͷ··Ͱͷ࣮ߦ͍͠
jslintΛ࣮ߦ͢Δ • ݱঢ়Ͱ͖Δ͜ͱ • αʔόαΠυίϯτϩʔϧͷ෦จࣈྻʹஔ • কདྷతʹ • มͱϩδοΫΛ͢Δ •
jsϩδοΫ͚ͩ lint Ͱ͖ΔΑ͏ʹ͢Δ
·ͱΊ • ٕज़తͳղܾΛߦ͏ʹ • Ϧʔυ͢Δਓ͕େࣄ • ୈೋɺୈࡾͷαϙʔτ͕ग़ͯ͘Εগͣͭ͠νʔ Ϝʹ͕Δ • Λ์ஔ͠ͳ͍
• ͙ͬͱࣃΛ৯͍റͬͯɺͷલͷΛղܾ͢Δ
None
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠