2
0
Эх сурвалжийг харах

move things to plugin with fullcalendar- prefix

Adam Shaw 7 жил өмнө
parent
commit
db3778f162

+ 6 - 2
composer.json

@@ -35,8 +35,12 @@
         "dist/fullcalendar.min.css",
         "dist/fullcalendar.print.css",
         "dist/fullcalendar.print.min.css",
-        "dist/gcal.js",
-        "dist/gcal.min.js",
+        "dist/fullcalendar-gcal.js",
+        "dist/fullcalendar-gcal.min.js",
+        "dist/fullcalendar-moment.js",
+        "dist/fullcalendar-moment.min.js",
+        "dist/fullcalendar-moment-timezone.js",
+        "dist/fullcalendar-moment-timezone.min.js",
         "dist/locale-all.js",
         "dist/locale/*.js"
       ]

+ 1 - 1
demos/gcal.html

@@ -6,7 +6,7 @@
 <link href='../dist/fullcalendar.print.css' rel='stylesheet' media='print' />
 <script src='../node_modules/superagent/superagent.js'></script>
 <script src='../dist/fullcalendar.js'></script>
-<script src='../dist/gcal.js'></script>
+<script src='../dist/fullcalendar-gcal.js'></script>
 <script>
 
   document.addEventListener('DOMContentLoaded', function() {

+ 13 - 10
karma.config.js

@@ -15,17 +15,26 @@ module.exports = function(config) {
     // list of files / patterns to load in the browser
     files: [
 
-      // dependencies for main lib
+      // dependencies for main lib AND plugin
       'node_modules/superagent/superagent.js',
+      'node_modules/moment/moment.js',
+      'node_modules/moment-timezone/moment-timezone.js',
       'node_modules/jquery/dist/jquery.js',
       'node_modules/components-jqueryui/jquery-ui.js',
       'node_modules/components-jqueryui/themes/cupertino/jquery-ui.css',
 
-      // main lib files
+      // dependencies for tests
+      'node_modules/xhr-mock/dist/xhr-mock.js', // TODO: should include this via require(), but .d.ts problems
+      'node_modules/native-promise-only/lib/npo.src.js',
+      'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
+      'node_modules/jquery-simulate/jquery.simulate.js',
+
+      // main lib AND plugin files
       'dist/fullcalendar.js',
       'dist/fullcalendar.css',
-      'dist/gcal.js',
-      'dist/jquery-ui-draggable.js',
+      'dist/fullcalendar-gcal.js',
+      'dist/fullcalendar-moment.js',
+      'dist/fullcalendar-moment-timezone.js',
       'dist/locale-all.js',
 
       // a way to dump variables into the test environment
@@ -34,12 +43,6 @@ module.exports = function(config) {
       // so plugins can dump files into here and test side effects
       'tmp/test-side-effects/*.js',
 
-      // dependencies for tests
-      'node_modules/xhr-mock/dist/xhr-mock.js', // TODO: should include this via require(), but .d.ts problems
-      'node_modules/native-promise-only/lib/npo.src.js',
-      'node_modules/jasmine-jquery/lib/jasmine-jquery.js',
-      'node_modules/jquery-simulate/jquery.simulate.js',
-
       'tests/automated/base.css',
       'tmp/automated-tests.js',
 

+ 4 - 6
package-lock.json

@@ -6831,18 +6831,16 @@
       }
     },
     "moment": {
-      "version": "2.22.0",
-      "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.0.tgz",
-      "integrity": "sha512-1muXCh8jb1N/gHRbn9VDUBr0GYb8A/aVcHlII9QSB68a50spqEVLIGN6KVmCOnSvJrUhC0edGgKU5ofnGXdYdg==",
-      "dev": true
+      "version": "2.22.2",
+      "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz",
+      "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y="
     },
     "moment-timezone": {
       "version": "0.5.21",
       "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.21.tgz",
       "integrity": "sha512-j96bAh4otsgj3lKydm3K7kdtA3iKf2m6MY2iSYCzCm5a1zmHo1g+aK3068dDEeocLZQIS9kU8bsdQHLqEvgW0A==",
-      "dev": true,
       "requires": {
-        "moment": "2.22.0"
+        "moment": "2.22.2"
       }
     },
     "ms": {

+ 2 - 2
package.json

@@ -22,6 +22,8 @@
   },
   "copyright": "2018 Adam Shaw",
   "dependencies": {
+    "moment": "^2.22.2",
+    "moment-timezone": "^0.5.21",
     "superagent": "^3.8.2"
   },
   "version": "0.0.0",
@@ -63,8 +65,6 @@
     "karma-jasmine": "^1.0.2",
     "karma-sourcemap-loader": "^0.3.7",
     "karma-verbose-reporter": "0.0.6",
-    "moment": "^2.20.1",
-    "moment-timezone": "^0.5.16",
     "native-promise-only": "^0.8.1",
     "node-sass": "^4.8.3",
     "sass-loader": "^6.0.7",

+ 1 - 1
src/datelib/moment-timezone.ts → plugins/moment-timezone/main.ts

@@ -1,6 +1,6 @@
 import * as moment from 'moment'
 import 'moment-timezone'
-import { NamedTimeZoneImpl, registerNamedTimeZoneImpl } from './timezone'
+import { NamedTimeZoneImpl, registerNamedTimeZoneImpl } from 'fullcalendar'
 
 
 class MomentNamedTimeZone extends NamedTimeZoneImpl {

+ 0 - 23
src/datelib/moment.ts

@@ -1,23 +0,0 @@
-import * as moment from 'moment'
-import { VerboseFormattingArg } from './formatting'
-import { registerCmdFormatter } from './formatting-cmd'
-
-// TODO: what about range!!??
-
-registerCmdFormatter('moment', function(cmdStr: string, arg: VerboseFormattingArg) {
-  let mom: moment.Moment
-
-  if (arg.timeZone === 'local') {
-    mom = moment(arg.date.array)
-  } else if (arg.timeZone === 'UTC' || !(moment as any).tz) {
-    mom = moment.utc(arg.date.array)
-  } else {
-    mom = (moment as any).tz(arg.date.array, arg.timeZone)
-  }
-
-  // what about accepting a forced timezone if .tz isn't present?
-
-  mom.locale(arg.localeCodes[0])
-
-  return mom.format(cmdStr)
-})

+ 7 - 1
src/exports.ts

@@ -101,7 +101,13 @@ export {
 } from './datelib/duration'
 export { DateEnv } from './datelib/env'
 export { defineLocale, getLocale, getLocaleCodes } from './datelib/locale'
-export { DateFormatter, createFormatter } from './datelib/formatting'
+export {
+  DateFormatter,
+  createFormatter,
+  VerboseFormattingArg
+} from './datelib/formatting'
+export { NamedTimeZoneImpl, registerNamedTimeZoneImpl } from './datelib/timezone'
+export { registerCmdFormatter } from './datelib/formatting-cmd'
 export { parse as parseMarker } from './datelib/parsing'
 
 export { registerEventSourceDef } from './structs/event-source'

+ 1 - 1
tests/manual/gcal.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   $(document).ready(function() {

+ 1 - 1
tests/manual/issue_221_quick_remove_source.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   var gcalFeed = FullCalendar.gcalFeed("http://www.google.com/calendar/feeds/usa__en%40holiday.calendar.google.com/public/basic");

+ 1 - 1
tests/manual/issue_417_refetchEvents.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   /*

+ 1 - 1
tests/manual/issue_554.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   $(document).ready(function() {

+ 1 - 1
tests/manual/issue_586_refetchEvents.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   $(document).ready(function() {

+ 1 - 1
tests/manual/issue_616.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   $(document).ready(function() {

+ 1 - 1
tests/manual/issue_679.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   $(document).ready(function() {

+ 1 - 1
tests/manual/methods.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   var cal, staticEvents;

+ 1 - 1
tests/manual/sources.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   var cal;

+ 1 - 1
tests/manual/sources_new.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
 /*

+ 1 - 1
tests/manual/triggers.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   /*

+ 1 - 1
tests/manual/triggers_view.html

@@ -6,7 +6,7 @@
 <script src='../../node_modules/jquery/dist/jquery.js'></script>
 <script src='../../node_modules/moment/moment.js'></script>
 <script src='../../dist/fullcalendar.js'></script>
-<script src='../../dist/gcal.js'></script>
+<script src='../../dist/fullcalendar-gcal.js'></script>
 <script>
 
   var date = new Date();

+ 4 - 1
webpack.config.js

@@ -13,7 +13,9 @@ const MODULES = {
   'dist/fullcalendar': './src/main.ts',
   'dist/fullcalendar.css': './src/main.scss',
   'dist/fullcalendar.print.css': './src/common/print.scss',
-  'dist/gcal': './plugins/gcal/main.ts',
+  'dist/fullcalendar-gcal': './plugins/gcal/main.ts',
+  'dist/fullcalendar-moment': './plugins/moment/main.ts',
+  'dist/fullcalendar-moment-timezone': './plugins/moment-timezone/main.ts',
   'tmp/automated-tests': './tests/automated/index'
 }
 
@@ -28,6 +30,7 @@ module.exports = {
 
   externals: {
     moment: 'moment',
+    'moment-timezone': 'moment-timezone',
     superagent: 'superagent',
 
     // for plugins that might need jQuery