├── chapter11-tools ├── npm │ ├── myScript.js │ ├── src │ │ ├── image │ │ │ └── spinner.gif │ │ ├── js │ │ │ ├── spinner.js │ │ │ └── main.js │ │ └── css │ │ │ └── main.css │ ├── package.json │ ├── README.md │ ├── data │ │ ├── latest.json │ │ └── top.json │ └── index.html ├── babel │ ├── myScript.js │ ├── src │ │ ├── image │ │ │ └── spinner.gif │ │ ├── js │ │ │ ├── spinner.js │ │ │ ├── polyfill │ │ │ │ └── append.js │ │ │ └── main.js │ │ └── css │ │ │ └── main.css │ ├── babel.config.json │ ├── webpack.config.js │ ├── README.md │ ├── webpack.dev.config.js │ ├── data │ │ ├── latest.json │ │ └── top.json │ ├── package.json │ ├── webpack.prod.config.js │ └── index.html ├── bundler │ ├── myScript.js │ ├── src │ │ ├── image │ │ │ └── spinner.gif │ │ ├── js │ │ │ ├── spinner.js │ │ │ └── main.js │ │ └── css │ │ │ └── main.css │ ├── webpack.config.js │ ├── README.md │ ├── webpack.dev.config.js │ ├── package.json │ ├── data │ │ ├── latest.json │ │ └── top.json │ ├── webpack.prod.config.js │ └── index.html ├── lint │ ├── myScript.js │ ├── src │ │ ├── scss │ │ │ ├── index.scss │ │ │ ├── _vars.scss │ │ │ ├── _spinner.scss │ │ │ ├── _base.scss │ │ │ ├── _flex.scss │ │ │ └── _main.scss │ │ ├── image │ │ │ └── spinner.gif │ │ ├── js │ │ │ ├── spinner.js │ │ │ ├── polyfill │ │ │ │ └── append.js │ │ │ └── main.js │ │ └── css │ │ │ └── main.css │ ├── .prettierrc │ ├── babel.config.json │ ├── webpack.config.js │ ├── .eslintrc.js │ ├── .stylelintrc.js │ ├── README.md │ ├── webpack.dev.config.js │ ├── data │ │ ├── latest.json │ │ └── top.json │ ├── webpack.prod.config.js │ ├── package.json │ └── index.html └── sass │ ├── myScript.js │ ├── src │ ├── scss │ │ ├── index.scss │ │ ├── _vars.scss │ │ ├── _spinner.scss │ │ ├── _base.scss │ │ ├── _flex.scss │ │ └── _main.scss │ ├── image │ │ └── spinner.gif │ ├── js │ │ ├── spinner.js │ │ ├── polyfill │ │ │ └── append.js │ │ └── main.js │ └── css │ │ └── main.css │ ├── babel.config.json │ ├── webpack.config.js │ ├── README.md │ ├── webpack.dev.config.js │ ├── data │ ├── latest.json │ └── top.json │ ├── package.json │ ├── webpack.prod.config.js │ └── index.html ├── chapter13-test ├── .storybook │ ├── preview.js │ └── main.js ├── test │ ├── jest-setup.js │ ├── unit │ │ ├── __snapshots__ │ │ │ ├── button.spec.js.snap │ │ │ ├── memoItem.spec.js.snap │ │ │ └── memoInputArea.spec.js.snap │ │ ├── dom.spec.js │ │ ├── memoItem.spec.js │ │ ├── memoInputArea.spec.js │ │ └── button.spec.js │ ├── integration │ │ ├── __snapshots__ │ │ │ └── memoList.spec.js.snap │ │ └── memoList.spec.js │ ├── __snapshots__ │ │ └── snapshotMethod.spec.js.snap │ └── snapshotMethod.spec.js ├── cypress.json ├── src │ ├── util │ │ └── dom.js │ ├── index.js │ ├── constant │ │ └── errorCode.js │ ├── stories │ │ ├── memoInputArea.stories.js │ │ ├── memoItem.stories.js │ │ ├── memo.stories.js │ │ └── button.stories.js │ ├── memo.js │ ├── memoList.js │ ├── button.js │ ├── memoItem.js │ └── memoInputArea.js ├── babel.config.js ├── cypress │ ├── fixtures │ │ └── example.json │ ├── support │ │ ├── index.js │ │ └── commands.js │ ├── plugins │ │ └── index.js │ └── integration │ │ └── memo.spec.js ├── index.html ├── jest.config.js ├── webpack.config.js ├── Readme.md └── package.json ├── chapter10-board ├── src │ ├── image │ │ └── spinner.gif │ ├── js │ │ ├── spinner.js │ │ └── main.js │ └── css │ │ └── main.css ├── README.md ├── data │ ├── latest.json │ └── top.json └── index.html ├── chapter12-debug ├── js │ ├── index.js │ ├── card.js │ ├── modal.js │ ├── response.js │ └── frameworkCard.js ├── webpack.config.js ├── package.json ├── index.html ├── Readme.md └── css │ └── style.css ├── README.md └── .gitignore /chapter11-tools/npm/myScript.js: -------------------------------------------------------------------------------- 1 | console.log('hello javascript'); -------------------------------------------------------------------------------- /chapter11-tools/babel/myScript.js: -------------------------------------------------------------------------------- 1 | console.log('hello javascript'); -------------------------------------------------------------------------------- /chapter11-tools/bundler/myScript.js: -------------------------------------------------------------------------------- 1 | console.log('hello javascript'); -------------------------------------------------------------------------------- /chapter11-tools/lint/myScript.js: -------------------------------------------------------------------------------- 1 | console.log('hello javascript'); -------------------------------------------------------------------------------- /chapter11-tools/sass/myScript.js: -------------------------------------------------------------------------------- 1 | console.log('hello javascript'); -------------------------------------------------------------------------------- /chapter13-test/.storybook/preview.js: -------------------------------------------------------------------------------- 1 | export const parameters = {}; 2 | -------------------------------------------------------------------------------- /chapter13-test/test/jest-setup.js: -------------------------------------------------------------------------------- 1 | import "@testing-library/jest-dom"; 2 | -------------------------------------------------------------------------------- /chapter13-test/cypress.json: -------------------------------------------------------------------------------- 1 | { 2 | "baseUrl": "http://localhost:8000", 3 | "video": false 4 | } 5 | -------------------------------------------------------------------------------- /chapter11-tools/lint/src/scss/index.scss: -------------------------------------------------------------------------------- 1 | @use 'vars'; 2 | @use 'spinner'; 3 | @use 'flex'; 4 | @use 'base'; 5 | @use 'main'; 6 | -------------------------------------------------------------------------------- /chapter11-tools/sass/src/scss/index.scss: -------------------------------------------------------------------------------- 1 | @use 'vars'; 2 | @use 'spinner'; 3 | @use 'flex'; 4 | @use 'base'; 5 | @use 'main'; 6 | -------------------------------------------------------------------------------- /chapter13-test/src/util/dom.js: -------------------------------------------------------------------------------- 1 | export function addClass(el, ...classNames) { 2 | el.classList.add(...classNames); 3 | } 4 | -------------------------------------------------------------------------------- /chapter10-board/src/image/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjpublic/Front-end/master/chapter10-board/src/image/spinner.gif -------------------------------------------------------------------------------- /chapter11-tools/npm/src/image/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjpublic/Front-end/master/chapter11-tools/npm/src/image/spinner.gif -------------------------------------------------------------------------------- /chapter11-tools/babel/src/image/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjpublic/Front-end/master/chapter11-tools/babel/src/image/spinner.gif -------------------------------------------------------------------------------- /chapter11-tools/lint/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "printWidth": 100, 4 | "tabWidth": 2, 5 | "useTabs": false 6 | } 7 | -------------------------------------------------------------------------------- /chapter11-tools/lint/src/image/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjpublic/Front-end/master/chapter11-tools/lint/src/image/spinner.gif -------------------------------------------------------------------------------- /chapter11-tools/sass/src/image/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjpublic/Front-end/master/chapter11-tools/sass/src/image/spinner.gif -------------------------------------------------------------------------------- /chapter11-tools/bundler/src/image/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bjpublic/Front-end/master/chapter11-tools/bundler/src/image/spinner.gif -------------------------------------------------------------------------------- /chapter11-tools/lint/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [["@babel/preset-env", { 3 | "useBuiltIns": "usage", 4 | "corejs":3 5 | }]] 6 | } 7 | -------------------------------------------------------------------------------- /chapter11-tools/sass/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [["@babel/preset-env", { 3 | "useBuiltIns": "usage", 4 | "corejs":3 5 | }]] 6 | } 7 | -------------------------------------------------------------------------------- /chapter11-tools/babel/babel.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [["@babel/preset-env", { 3 | "useBuiltIns": "usage", 4 | "corejs":3 5 | }]] 6 | } 7 | -------------------------------------------------------------------------------- /chapter13-test/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['@babel/preset-env'], 3 | plugins: [['@babel/plugin-proposal-class-properties', { loose: true }]], 4 | }; -------------------------------------------------------------------------------- /chapter13-test/test/unit/__snapshots__/button.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`button 컴포넌트 button 요소는 스냅샷과 일치해야 한다. 1`] = ` 7 | `; 8 | -------------------------------------------------------------------------------- /chapter13-test/src/constant/errorCode.js: -------------------------------------------------------------------------------- 1 | export const errorCode = { 2 | TOO_LONG: "TOO_LONG", 3 | TOO_SHORT: "TOO_SHORT", 4 | }; 5 | 6 | export const errorMessage = { 7 | TOO_LONG: "글은 50자 이하로 입력해야 합니다.", 8 | TOO_SHORT: "글을 작성해주세요!", 9 | }; 10 | -------------------------------------------------------------------------------- /chapter11-tools/lint/src/scss/_spinner.scss: -------------------------------------------------------------------------------- 1 | @use 'flex'; 2 | 3 | .spinner-area { 4 | @include flex.flexbox; 5 | @include flex.justify-content(center); 6 | @include flex.align-items(center); 7 | 8 | height: 400px; 9 | 10 | img { 11 | width: 50px; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter11-tools/lint/webpack.config.js: -------------------------------------------------------------------------------- 1 | const developmentConfig = require('./webpack.dev.config'); 2 | const productionConfig = require('./webpack.prod.config'); 3 | 4 | module.exports = (env, { mode }) => { 5 | return mode === 'production' ? productionConfig : developmentConfig; 6 | }; 7 | -------------------------------------------------------------------------------- /chapter11-tools/sass/src/scss/_spinner.scss: -------------------------------------------------------------------------------- 1 | @use 'flex'; 2 | 3 | .spinner-area { 4 | @include flex.flexbox; 5 | @include flex.justify-content(center); 6 | @include flex.align-items(center); 7 | 8 | height: 400px; 9 | 10 | img { 11 | width: 50px; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /chapter11-tools/sass/webpack.config.js: -------------------------------------------------------------------------------- 1 | const developmentConfig = require('./webpack.dev.config'); 2 | const productionConfig = require('./webpack.prod.config'); 3 | 4 | module.exports = (env, { mode }) => { 5 | return mode === 'production' ? productionConfig : developmentConfig; 6 | }; 7 | -------------------------------------------------------------------------------- /chapter11-tools/babel/webpack.config.js: -------------------------------------------------------------------------------- 1 | const developmentConfig = require('./webpack.dev.config'); 2 | const productionConfig = require('./webpack.prod.config'); 3 | 4 | module.exports = (env, { mode }) => { 5 | return mode === 'production' ? productionConfig : developmentConfig; 6 | }; 7 | -------------------------------------------------------------------------------- /chapter11-tools/bundler/webpack.config.js: -------------------------------------------------------------------------------- 1 | const developmentConfig = require('./webpack.dev.config'); 2 | const productionConfig = require('./webpack.prod.config'); 3 | 4 | module.exports = (env, { mode }) => { 5 | return mode === 'production' ? productionConfig : developmentConfig; 6 | }; 7 | -------------------------------------------------------------------------------- /chapter11-tools/lint/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | node: true, 4 | es6: true, 5 | }, 6 | parserOptions: { 7 | ecmaVersion: 6, 8 | sourceType: 'module', 9 | }, 10 | plugins: ['prettier'], 11 | extends: ['plugin:prettier/recommended'], 12 | }; 13 | -------------------------------------------------------------------------------- /chapter11-tools/lint/src/scss/_base.scss: -------------------------------------------------------------------------------- 1 | * { 2 | padding: 0; 3 | margin: 0; 4 | box-sizing: border-box; 5 | list-style: none; 6 | } 7 | 8 | body { 9 | background: #002b36; 10 | font-family: sans-serif; 11 | } 12 | 13 | a { 14 | color: inherit; 15 | text-decoration: none; 16 | } 17 | -------------------------------------------------------------------------------- /chapter11-tools/sass/src/scss/_base.scss: -------------------------------------------------------------------------------- 1 | * { 2 | padding: 0; 3 | margin: 0; 4 | box-sizing: border-box; 5 | list-style: none; 6 | } 7 | 8 | body { 9 | background: #002b36; 10 | font-family: sans-serif; 11 | } 12 | 13 | a { 14 | color: inherit; 15 | text-decoration: none; 16 | } 17 | -------------------------------------------------------------------------------- /chapter10-board/src/js/spinner.js: -------------------------------------------------------------------------------- 1 | export function createSpinner(parent) { 2 | const spinnerAreaEl = parent.querySelector('.spinner-area'); 3 | const imageEl = document.createElement('img'); 4 | imageEl.alt = 'spinner'; 5 | imageEl.src = './src/image/spinner.gif'; 6 | 7 | spinnerAreaEl.append(imageEl); 8 | } 9 | -------------------------------------------------------------------------------- /chapter11-tools/npm/src/js/spinner.js: -------------------------------------------------------------------------------- 1 | export function createSpinner(parent) { 2 | const spinnerAreaEl = parent.querySelector('.spinner-area'); 3 | const imageEl = document.createElement('img'); 4 | imageEl.alt = 'spinner'; 5 | imageEl.src = './src/image/spinner.gif'; 6 | 7 | spinnerAreaEl.append(imageEl); 8 | } 9 | -------------------------------------------------------------------------------- /chapter11-tools/npm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter11-tools", 3 | "version": "1.0.0", 4 | "description": "development tools example - npm, webpack, babel, scss, lint", 5 | "scripts": { 6 | "my-script": "node ./myScript.js" 7 | }, 8 | "author": "jaesung lee, jung han", 9 | "license": "ISC" 10 | } 11 | -------------------------------------------------------------------------------- /chapter12-debug/js/index.js: -------------------------------------------------------------------------------- 1 | import { response } from "./response"; 2 | import { makeFrameworkModel, renderCard, bindCardEvent } from "./card"; 3 | 4 | import 'bootstrap/dist/css/bootstrap.min.css'; 5 | import '../css/style.css'; 6 | 7 | const frontEndFrameworkCards = makeFrameworkModel(response); 8 | 9 | renderCard(frontEndFrameworkCards); -------------------------------------------------------------------------------- /chapter10-board/README.md: -------------------------------------------------------------------------------- 1 | # chapter10-board 2 | 3 | 10장 게시판 만들기 예제 4 | 5 | > 편의를 위해 모든 예제에서 개발 IDE는 VS Code를 사용한다고 가정합니다. 6 | 7 | ## 실행 방법 8 | 9 | VS Code의 Live Server extension를 사용하여 index.html 파일을 실행합니다. 10 | 11 | ![liveserver](https://user-images.githubusercontent.com/37766175/136686654-a4310f89-625e-456b-b1d5-5258bfa57c59.png) 12 | -------------------------------------------------------------------------------- /chapter11-tools/bundler/src/js/spinner.js: -------------------------------------------------------------------------------- 1 | import spinner from '../image/spinner.gif'; 2 | 3 | export function createSpinner(parent) { 4 | const spinnerAreaEl = parent.querySelector('.spinner-area'); 5 | const imageEl = document.createElement('img'); 6 | imageEl.alt = 'spinner'; 7 | imageEl.src = spinner; 8 | 9 | spinnerAreaEl.append(imageEl); 10 | } -------------------------------------------------------------------------------- /chapter11-tools/babel/src/js/spinner.js: -------------------------------------------------------------------------------- 1 | import spinner from '../image/spinner.gif'; 2 | 3 | export function createSpinner(parent) { 4 | const spinnerAreaEl = parent.querySelector('.spinner-area'); 5 | const imageEl = document.createElement('img'); 6 | imageEl.alt = 'spinner'; 7 | imageEl.src = spinner; 8 | 9 | spinnerAreaEl.append(imageEl); 10 | } 11 | -------------------------------------------------------------------------------- /chapter11-tools/lint/src/js/spinner.js: -------------------------------------------------------------------------------- 1 | import spinner from '../image/spinner.gif'; 2 | 3 | export function createSpinner(parent) { 4 | const spinnerAreaEl = parent.querySelector('.spinner-area'); 5 | const imageEl = document.createElement('img'); 6 | imageEl.alt = 'spinner'; 7 | imageEl.src = spinner; 8 | 9 | spinnerAreaEl.append(imageEl); 10 | } 11 | -------------------------------------------------------------------------------- /chapter11-tools/sass/src/js/spinner.js: -------------------------------------------------------------------------------- 1 | import spinner from '../image/spinner.gif'; 2 | 3 | export function createSpinner(parent) { 4 | const spinnerAreaEl = parent.querySelector('.spinner-area'); 5 | const imageEl = document.createElement('img'); 6 | imageEl.alt = 'spinner'; 7 | imageEl.src = spinner; 8 | 9 | spinnerAreaEl.append(imageEl); 10 | } 11 | -------------------------------------------------------------------------------- /chapter13-test/test/unit/dom.spec.js: -------------------------------------------------------------------------------- 1 | import { addClass } from "../../src/util/dom"; 2 | 3 | describe("dom util", () => { 4 | it("addClass 함수는 전달된 요소에 class를 추가해야 한다.", () => { 5 | const el = document.createElement("div"); 6 | 7 | addClass(el, "my-class1", "my-class2"); 8 | 9 | expect(el).toHaveClass("my-class1", "my-class2"); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /chapter11-tools/lint/.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['stylelint-scss', 'stylelint-prettier'], 3 | extends: ['stylelint-config-standard', 'stylelint-config-prettier'], 4 | rules: { 5 | 'prettier/prettier': true, 6 | 'at-rule-no-unknown': null, 7 | 'scss/at-rule-no-unknown': true, 8 | 'no-descending-specificity': null, 9 | }, 10 | }; 11 | -------------------------------------------------------------------------------- /chapter12-debug/js/card.js: -------------------------------------------------------------------------------- 1 | import FrameworkCard from "./frameworkCard"; 2 | 3 | export function makeFrameworkModel(res) { 4 | return res.map((frameworkInfo) => new FrameworkCard(frameworkInfo)); 5 | } 6 | 7 | export function renderCard(cards) { 8 | const el = document.getElementById("card-area"); 9 | 10 | cards.forEach((card) => { 11 | el.appendChild(card.makeCardElement()); 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /chapter13-test/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Document 7 | 8 | 9 | 10 |
11 |
12 |
13 |

Memo

14 |
15 |
16 |
17 |
18 | 19 | -------------------------------------------------------------------------------- /chapter13-test/test/unit/__snapshots__/memoItem.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`MemoItem memoItem 요소는 스냅샷과 일치해야 한다. 1`] = ` 4 |
  • 7 | 10 | item content 11 | 12 | 18 |
  • 19 | `; 20 | -------------------------------------------------------------------------------- /chapter13-test/test/snapshotMethod.spec.js: -------------------------------------------------------------------------------- 1 | function getHelloButtonHtml() { 2 | return ""; 3 | } 4 | 5 | describe("snapshot 메서드 테스트", () => { 6 | it("toMatchInlineSnapshot()은 파일 내부에 스냅샷을 기록한다.", () => { 7 | expect(getHelloButtonHtml()).toMatchInlineSnapshot(` 8 | 11 | `); 12 | }); 13 | 14 | it("toMatchSnapshot()은 파일 외부에 스냅샷을 기록한다.", () => { 15 | expect(getHelloButtonHtml()).toMatchSnapshot(); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /chapter12-debug/webpack.config.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 2 | 3 | module.exports = { 4 | entry: './js/index.js', 5 | plugins: [new HtmlWebpackPlugin({ template: 'index.html' })], 6 | module: { 7 | rules: [ 8 | { 9 | test: /\.css$/, 10 | use: ['style-loader', 'css-loader'], 11 | }, 12 | ], 13 | }, 14 | devtool: 'eval-source-map', 15 | devServer: { 16 | host: '0.0.0.0', 17 | port: 8000, 18 | stats: 'errors-warnings', 19 | }, 20 | }; 21 | -------------------------------------------------------------------------------- /chapter13-test/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | transformIgnorePatterns: ["/node_modules/"], 3 | transform: { 4 | "^.+\\.js?$": "babel-jest", 5 | }, 6 | testMatch: ["**/test/**/*.spec.js"], 7 | testEnvironment: "jsdom", 8 | snapshotSerializers: ["jest-serializer-html"], 9 | watchPathIgnorePatterns: [ 10 | "/.storybook", 11 | "/.stories", 12 | "/node_modules/", 13 | "/cypress", 14 | ], 15 | setupFilesAfterEnv: ["/test/jest-setup.js"], 16 | }; 17 | -------------------------------------------------------------------------------- /chapter11-tools/npm/README.md: -------------------------------------------------------------------------------- 1 | # chapter11-tools 2 | 3 | 11장 npm 환경 적용 4 | 5 | node.js 환경에서의 npm으로 의존성을 관리하는 방법과 스크립트를 실행하는 방법을 알아보는 단계입니다. 6 | 7 | > 편의를 위해 모든 예제에서 개발 IDE는 VS Code를 사용한다고 가정합니다. 8 | 9 | ## 실행 방법 10 | 11 | VS Code의 Live Server extension를 사용하여 index.html 파일을 실행합니다. 12 | 13 | ![liveserver](https://user-images.githubusercontent.com/37766175/136686654-a4310f89-625e-456b-b1d5-5258bfa57c59.png) 14 | 15 | ### 커스텀 명령어 실행 16 | 17 | 아래 명령어는 `/chapter11-tools/bundler` 경로에서 실행해야 합니다. 18 | 19 | ```sh 20 | npm run my-script 21 | ``` 22 | -------------------------------------------------------------------------------- /chapter12-debug/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "chapter12-debug", 3 | "version": "1.0.0", 4 | "description": "12장 디버깅 예제", 5 | "scripts": { 6 | "start": "webpack serve" 7 | }, 8 | "author": "", 9 | "license": "ISC", 10 | "devDependencies": { 11 | "css-loader": "^5.0.1", 12 | "html-webpack-plugin": "^4.5.1", 13 | "style-loader": "^2.0.0", 14 | "webpack": "^5.17.0", 15 | "webpack-cli": "^4.4.0", 16 | "webpack-dev-server": "^3.11.2" 17 | }, 18 | "dependencies": { 19 | "bootstrap": "^4.6.0" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /chapter11-tools/bundler/README.md: -------------------------------------------------------------------------------- 1 | # chapter11-tools 2 | 3 | 11장 bundler(webpack) 적용 4 | 5 | webpack 번들러를 적용하여 개발 서버를 띄우고 빌드하는 방법을 알아보는 단계입니다. 6 | 7 | > 편의를 위해 모든 예제에서 개발 IDE는 VS Code를 사용한다고 가정합니다. 8 | 9 | ## 실행 방법 10 | 11 | 아래 명령어는 `/chapter11-tools/bundler` 경로에서 실행해야 합니다. 12 | 13 | ### 의존성 설치 14 | 15 | ```sh 16 | npm ci 17 | // or 18 | npm install 19 | ``` 20 | 21 | ### 개발 서버 실행 22 | 23 | ```sh 24 | npm run serve 25 | ``` 26 | 27 | ### 빌드 28 | 29 | 1. 개발 모드 빌드 30 | 31 | ```sh 32 | npm run build:dev 33 | ``` 34 | 35 | 2. 프로덕션 모드 빌드 36 | 37 | ```sh 38 | npm run build:prod 39 | ``` 40 | -------------------------------------------------------------------------------- /chapter11-tools/babel/README.md: -------------------------------------------------------------------------------- 1 | # chapter11-tools 2 | 3 | 11장 babel 적용 4 | 5 | babel을 적용하여 트랜스파일하는 방법을 알아보는 단계입니다. 6 | 7 | > 편의를 위해 모든 예제에서 개발 IDE는 VS Code를 사용한다고 가정합니다. 8 | 9 | ## 실행 방법 10 | 11 | 아래 명령어는 `/chapter11-tools/babel` 경로에서 실행해야 합니다. 12 | 13 | ### 의존성 설치 14 | 15 | ```sh 16 | npm ci 17 | // or 18 | npm install 19 | ``` 20 | 21 | ### 개발 서버 실행 22 | 23 | ```sh 24 | npm run serve 25 | ``` 26 | 27 | ### 빌드 28 | 29 | 1. 개발 모드 빌드 30 | 31 | ```sh 32 | npm run build:dev 33 | ``` 34 | 35 | 2. 프로덕션 모드 빌드 36 | 37 | ```sh 38 | npm run build:prod 39 | ``` 40 | 41 | ### 예제 트랜스파일 42 | 43 | ```sh 44 | npm run transpile 45 | ``` 46 | -------------------------------------------------------------------------------- /chapter13-test/src/stories/memoInputArea.stories.js: -------------------------------------------------------------------------------- 1 | import MemoInputArea from "../memoInputArea"; 2 | import { MINIMAL_VIEWPORTS } from "@storybook/addon-viewport"; 3 | import "bootstrap/dist/css/bootstrap.min.css"; 4 | 5 | export default { 6 | title: "MemoInputArea Component", 7 | viewport: { 8 | viewports: MINIMAL_VIEWPORTS, 9 | }, 10 | }; 11 | 12 | function createContainer() { 13 | const el = document.createElement("div"); 14 | el.style.width = "100%"; 15 | 16 | return el; 17 | } 18 | 19 | export const basic = () => { 20 | const el = createContainer(); 21 | const memoInputArea = new MemoInputArea(el, { addMemoItem: () => {} }); 22 | 23 | return el; 24 | }; 25 | -------------------------------------------------------------------------------- /chapter11-tools/bundler/webpack.dev.config.js: -------------------------------------------------------------------------------- 1 | const HtmlWebpackPlugin = require('html-webpack-plugin'); 2 | 3 | module.exports = { 4 | mode: 'development', 5 | entry: './src/js/main.js', 6 | plugins: [new HtmlWebpackPlugin({ template: 'index.html' })], 7 | module: { 8 | rules: [ 9 | { 10 | test: /\.css$/, 11 | use: ['style-loader', 'css-loader'], 12 | }, 13 | { 14 | test: /\.(png|jpg|gif)$/i, 15 | use: ['file-loader'], 16 | }, 17 | ], 18 | }, 19 | devtool: 'eval-source-map', 20 | devServer: { 21 | host: '0.0.0.0', 22 | port: 8000, 23 | stats: 'errors-warnings', 24 | open: true, 25 | }, 26 | }; 27 | -------------------------------------------------------------------------------- /chapter13-test/test/unit/__snapshots__/memoInputArea.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`memoInputArea MemoInputArea 요소는 스냅샷과 일치해야 한다. 1`] = ` 4 |
    7 |
    10 |