Skip to content
This repository was archived by the owner on Aug 2, 2019. It is now read-only.

Commit 1cdbeb5

Browse files
committed
upgrade to fc v4, webpack v4
1 parent 3451e9f commit 1cdbeb5

File tree

5 files changed

+47
-41
lines changed

5 files changed

+47
-41
lines changed

index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<html>
33
<head>
44
<meta charset='utf-8' />
5-
<link href='node_modules/fullcalendar/dist/fullcalendar.css' rel='stylesheet' />
6-
<link href='node_modules/fullcalendar-scheduler/dist/scheduler.css' rel='stylesheet' />
7-
<link href='node_modules/fullcalendar/dist/fullcalendar.print.css' rel='stylesheet' media='print' />
8-
<script src='node_modules/jquery/dist/jquery.js'></script>
9-
<script src='node_modules/moment/moment.js'></script>
5+
<link href='node_modules/@fullcalendar/core/main.css' rel='stylesheet' />
6+
<link href='node_modules/@fullcalendar/daygrid/main.css' rel='stylesheet' />
7+
<link href='node_modules/@fullcalendar/timegrid/main.css' rel='stylesheet' />
8+
<link href='node_modules/@fullcalendar/list/main.css' rel='stylesheet' />
9+
<link href='node_modules/@fullcalendar/timeline/main.css' rel='stylesheet' />
1010
<script src='dist/example.js'></script>
1111
<style>
1212

package.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@
88
},
99
"main": "dist/example.js",
1010
"dependencies": {
11-
"fullcalendar": "~3.9.0",
12-
"fullcalendar-scheduler": "^1.9.4",
13-
"jquery": "^3.3.1",
14-
"moment": "^2.23.0"
11+
"@fullcalendar/core": "4.0.0-beta.1",
12+
"@fullcalendar/daygrid": "4.0.0-beta.1",
13+
"@fullcalendar/list": "4.0.0-beta.1",
14+
"@fullcalendar/timegrid": "4.0.0-beta.1",
15+
"@fullcalendar/resource-timeline": "4.0.0-beta.1"
1516
},
1617
"devDependencies": {
17-
"@types/jquery": "^3.3.0",
18-
"awesome-typescript-loader": "^3.4.1",
19-
"source-map-loader": "^0.2.3",
20-
"typescript": "^2.6.2",
21-
"webpack": "^3.10.0"
18+
"ts-loader": "^5.3.3",
19+
"typescript": "^3.2.4",
20+
"webpack": "^4.29.0",
21+
"webpack-cli": "^3.2.1"
2222
},
2323
"scripts": {
2424
"build": "webpack",
2525
"watch": "webpack --watch",
26-
"clean": "rm -rf ./dist"
26+
"clean": "rm -rf dist"
2727
},
2828
"author": "Adam Shaw <[email protected]> (http://arshaw.com/)",
2929
"license": "ISC"

src/example.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
import * as $ from 'jquery';
2-
import 'fullcalendar';
3-
import 'fullcalendar-scheduler';
1+
import { Calendar } from '@fullcalendar/core';
2+
import DayGridPlugin from '@fullcalendar/daygrid';
3+
import ListPlugin from '@fullcalendar/list';
4+
import TimeGridPlugin from '@fullcalendar/timegrid';
5+
import ResourceTimelinePlugin from '@fullcalendar/resource-timeline';
46

5-
$(function() {
6-
let containerEl: JQuery = $('#calendar');
7+
document.addEventListener('DOMContentLoaded', function() {
8+
let calendarEl: HTMLElement = document.getElementById('calendar')!;
79

8-
containerEl.fullCalendar({
10+
let calendar = new Calendar(calendarEl, {
11+
plugins: [ DayGridPlugin, ListPlugin, TimeGridPlugin, ResourceTimelinePlugin ],
912
now: '2018-02-07',
1013
editable: true, // enable draggable events
1114
aspectRatio: 1.8,
@@ -19,7 +22,8 @@ $(function() {
1922
views: {
2023
timelineThreeDays: {
2124
type: 'timeline',
22-
duration: { days: 3 }
25+
duration: { days: 3 },
26+
buttonText: '3 day'
2327
}
2428
},
2529
resourceLabelText: 'Rooms',
@@ -62,4 +66,6 @@ $(function() {
6266
{ id: '5', resourceId: 'f', start: '2018-02-07T00:30:00', end: '2018-02-07T02:30:00', title: 'event 5' }
6367
]
6468
});
69+
70+
calendar.render();
6571
});

tsconfig.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
{
22
"compilerOptions": {
33
"target": "es5",
4-
"module": "commonjs",
4+
"module": "es6",
5+
"moduleResolution": "node",
56
"noImplicitAny": true,
6-
"strict": true
7+
"strict": true,
8+
"sourceMap": true,
9+
"outDir": "dist"
710
},
811
"include": [
9-
"src/**/*.ts"
12+
"src/example.ts"
1013
]
1114
}

webpack.config.js

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,23 @@
11
const path = require('path')
22

33
module.exports = {
4+
mode: 'development',
45
entry: './src/example.ts',
5-
output: {
6-
filename: 'example.js',
7-
path: path.join(__dirname, 'dist')
8-
},
9-
externals: {
10-
// shows how we can rely on browser globals instead of bundling these dependencies,
11-
// in case we want to access jQuery from a CDN or if we want an easy way to
12-
// avoid loading all moment locales: https://github.com/moment/moment/issues/1435
13-
jquery: 'jQuery',
14-
moment: 'moment'
15-
},
16-
devtool: 'sourcemap',
176
resolve: {
18-
extensions: [ '.ts', '.js' ],
7+
extensions: [ '.ts', '.js' ]
198
},
209
module: {
2110
rules: [
22-
{ test: /\.tsx?$/, loader: 'awesome-typescript-loader' },
23-
{ enforce: 'pre', test: /\.js$/, loader: 'source-map-loader' }
11+
{
12+
test: /\.ts$/,
13+
use: 'ts-loader',
14+
exclude: /node_modules/
15+
}
2416
]
25-
}
17+
},
18+
output: {
19+
filename: 'example.js',
20+
path: path.join(__dirname, 'dist')
21+
},
22+
devtool: 'sourcemap'
2623
}

0 commit comments

Comments
 (0)