mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
switch to ember-cli-moment-shim (#622)
no issue - preparation for using `ember-pikaday` that utilizes `ember-cli-moment-shim` - removes usage of `moment` global - removes custom imports of `moment` and `moment-timezone` libraries
This commit is contained in:
parent
1a093d5324
commit
9487ff9bae
@ -23,7 +23,6 @@ module.exports = {
|
||||
'ember-suave/require-access-in-comments': 'off'
|
||||
},
|
||||
globals: {
|
||||
moment: false,
|
||||
validator: false
|
||||
}
|
||||
};
|
||||
|
@ -3,6 +3,7 @@ import injectService from 'ember-service/inject';
|
||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||
import {formatDate} from 'ghost-admin/utils/date-formatting';
|
||||
import {InvokeActionMixin} from 'ember-invoke-action';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Component.extend(InvokeActionMixin, {
|
||||
tagName: 'span',
|
||||
|
@ -4,13 +4,12 @@ import computed, {alias} from 'ember-computed';
|
||||
import {guidFor} from 'ember-metal/utils';
|
||||
import injectService from 'ember-service/inject';
|
||||
import {htmlSafe} from 'ember-string';
|
||||
|
||||
import {invokeAction} from 'ember-invoke-action';
|
||||
|
||||
import {parseDateString} from 'ghost-admin/utils/date-formatting';
|
||||
import SettingsMenuMixin from 'ghost-admin/mixins/settings-menu-component';
|
||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||
import isNumber from 'ghost-admin/utils/isNumber';
|
||||
import moment from 'moment';
|
||||
|
||||
const {Handlebars} = Ember;
|
||||
|
||||
|
@ -2,6 +2,7 @@ import Component from 'ember-component';
|
||||
import computed, {mapBy} from 'ember-computed';
|
||||
import injectService from 'ember-service/inject';
|
||||
import {invokeAction} from 'ember-invoke-action';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Component.extend({
|
||||
classNames: ['form-group', 'for-select'],
|
||||
|
@ -3,6 +3,7 @@ import Component from 'ember-component';
|
||||
import computed from 'ember-computed';
|
||||
import injectService from 'ember-service/inject';
|
||||
import {htmlSafe} from 'ember-string';
|
||||
import moment from 'moment';
|
||||
|
||||
// ember-cli-shims doesn't export these
|
||||
const {Handlebars} = Ember;
|
||||
|
@ -2,6 +2,7 @@ import Component from 'ember-component';
|
||||
import computed from 'ember-computed';
|
||||
import service from 'ember-service/inject';
|
||||
import {isNotFoundError} from 'ember-ajax/errors';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Component.extend({
|
||||
tagName: '',
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {helper} from 'ember-helper';
|
||||
import moment from 'moment';
|
||||
|
||||
// TODO: this isn't used currently - safe to delete?
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {helper} from 'ember-helper';
|
||||
import moment from 'moment';
|
||||
|
||||
export function timeAgo(params) {
|
||||
if (!params || !params.length) {
|
||||
|
@ -9,15 +9,14 @@ import observer from 'ember-metal/observer';
|
||||
import run from 'ember-runloop';
|
||||
import {isEmberArray} from 'ember-array/utils';
|
||||
import {isBlank} from 'ember-utils';
|
||||
|
||||
import {task, timeout} from 'ember-concurrency';
|
||||
|
||||
import PostModel from 'ghost-admin/models/post';
|
||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||
import {isVersionMismatchError} from 'ghost-admin/services/ajax';
|
||||
import {isInvalidError} from 'ember-ajax/errors';
|
||||
|
||||
import ghostPaths from 'ghost-admin/utils/ghost-paths';
|
||||
import moment from 'moment';
|
||||
|
||||
const {resolve} = RSVP;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
import Ember from 'ember';
|
||||
import computed, {equal, filterBy} from 'ember-computed';
|
||||
import injectService from 'ember-service/inject';
|
||||
import moment from 'moment';
|
||||
|
||||
import Model from 'ember-data/model';
|
||||
import attr from 'ember-data/attr';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Ember from 'ember';
|
||||
import Service from 'ember-service';
|
||||
import run from 'ember-runloop';
|
||||
import moment from 'moment';
|
||||
|
||||
// ember-cli-shims doesn't export Ember.testing
|
||||
const {testing} = Ember;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global moment */
|
||||
import moment from 'moment';
|
||||
import Transform from 'ember-data/transform';
|
||||
|
||||
export default Transform.extend({
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* global moment */
|
||||
import moment from 'moment';
|
||||
import Transform from 'ember-data/transform';
|
||||
|
||||
export default Transform.extend({
|
||||
|
@ -1,3 +1,5 @@
|
||||
import moment from 'moment';
|
||||
|
||||
const parseDateFormats = [
|
||||
'DD MMM YY @ HH:mm', 'DD MMM YY HH:mm',
|
||||
'D MMM YY @ HH:mm', 'D MMM YY HH:mm',
|
||||
|
@ -31,13 +31,13 @@ module.exports = function (environment) {
|
||||
version: require('../package.json').version.match(/^(\d+\.)?(\d+)/)[0]
|
||||
},
|
||||
|
||||
'ember-simple-auth': {
|
||||
'ember-simple-auth': { },
|
||||
|
||||
moment: {
|
||||
includeTimezone: 'all'
|
||||
},
|
||||
|
||||
torii: {
|
||||
|
||||
}
|
||||
torii: { }
|
||||
};
|
||||
|
||||
if (environment === 'development') {
|
||||
|
@ -135,12 +135,6 @@ module.exports = function (defaults) {
|
||||
'mobiledoc-kit': {
|
||||
import: ['dist/amd/mobiledoc-kit.js', 'dist/amd/mobiledoc-kit.map']
|
||||
},
|
||||
moment: {
|
||||
import: ['moment.js']
|
||||
},
|
||||
'moment-timezone': {
|
||||
import: ['builds/moment-timezone-with-data.js']
|
||||
},
|
||||
'password-generator': {
|
||||
import: ['lib/password-generator.js']
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {Response} from 'ember-cli-mirage';
|
||||
import {paginatedResponse} from '../utils';
|
||||
import moment from 'moment';
|
||||
|
||||
export default function mockInvites(server) {
|
||||
server.get('/invites/', paginatedResponse('invites'));
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Factory} from 'ember-cli-mirage';
|
||||
import moment from 'moment';
|
||||
|
||||
export default Factory.extend({
|
||||
token(i) { return `${i}-token`; },
|
||||
|
@ -1,4 +1,5 @@
|
||||
import {Factory, faker} from 'ember-cli-mirage';
|
||||
import moment from 'moment';
|
||||
|
||||
let randomDate = function randomDate(start = moment().subtract(30, 'days').toDate(), end = new Date()) {
|
||||
return new Date(start.getTime() + Math.random() * (end.getTime() - start.getTime()));
|
||||
|
@ -55,6 +55,7 @@
|
||||
"ember-cli-inject-live-reload": "1.6.1",
|
||||
"ember-cli-mirage": "0.2.8",
|
||||
"ember-cli-mocha": "0.13.2",
|
||||
"ember-cli-moment-shim": "3.1.0",
|
||||
"ember-cli-node-assets": "0.2.2",
|
||||
"ember-cli-postcss": "3.2.0",
|
||||
"ember-cli-pretender": "1.0.1",
|
||||
@ -98,8 +99,6 @@
|
||||
"loader.js": "4.2.3",
|
||||
"matchdep": "1.0.1",
|
||||
"mobiledoc-kit": "0.10.15",
|
||||
"moment": "2.17.1",
|
||||
"moment-timezone": "0.5.11",
|
||||
"password-generator": "2.1.0",
|
||||
"postcss-color-function": "3.0.0",
|
||||
"postcss-custom-properties": "5.0.2",
|
||||
|
@ -13,6 +13,8 @@ import Mirage from 'ember-cli-mirage';
|
||||
import sinon from 'sinon';
|
||||
import testSelector from 'ember-test-selectors';
|
||||
import {titleRendered} from '../helpers/editor-helpers';
|
||||
import moment from 'moment';
|
||||
|
||||
describe('Acceptance: Editor', function() {
|
||||
let application;
|
||||
|
||||
|
@ -15,6 +15,7 @@ import {
|
||||
stubSuccessfulOAuthConnect,
|
||||
stubFailedOAuthConnect
|
||||
} from '../helpers/oauth';
|
||||
import moment from 'moment';
|
||||
|
||||
describe('Acceptance: Setup', function () {
|
||||
let application;
|
||||
|
@ -13,6 +13,7 @@ import {errorOverride, errorReset} from '../helpers/adapter-error';
|
||||
import {enableGhostOAuth} from '../helpers/configuration';
|
||||
import {Response} from 'ember-cli-mirage';
|
||||
import testSelector from 'ember-test-selectors';
|
||||
import moment from 'moment';
|
||||
|
||||
describe('Acceptance: Team', function () {
|
||||
let application;
|
||||
|
@ -8,6 +8,7 @@ import {
|
||||
timeAgo
|
||||
} from 'ghost-admin/helpers/gh-format-timeago';
|
||||
import sinon from 'sinon';
|
||||
import moment from 'moment';
|
||||
|
||||
describe('Unit: Helper: gh-format-timeago', function () {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
@ -1391,7 +1391,7 @@ broccoli-source@^1.1.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/broccoli-source/-/broccoli-source-1.1.0.tgz#54f0e82c8b73f46580cbbc4f578f0b32fca8f809"
|
||||
|
||||
broccoli-stew@^1.0.4, broccoli-stew@^1.2.0, broccoli-stew@^1.3.3:
|
||||
broccoli-stew@^1.0.4, broccoli-stew@^1.2.0, broccoli-stew@^1.3.3, broccoli-stew@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/broccoli-stew/-/broccoli-stew-1.4.0.tgz#1bdb0a1804d62a419d190abc26acb3c91878154d"
|
||||
dependencies:
|
||||
@ -2437,6 +2437,20 @@ ember-cli-mocha@0.13.2:
|
||||
mocha "^2.5.3"
|
||||
resolve "^1.1.7"
|
||||
|
||||
ember-cli-moment-shim@3.1.0:
|
||||
version "3.1.0"
|
||||
resolved "https://registry.yarnpkg.com/ember-cli-moment-shim/-/ember-cli-moment-shim-3.1.0.tgz#ec6a39a0dcb4badeaf6dcb74a6c05b0bc576f721"
|
||||
dependencies:
|
||||
broccoli-funnel "^1.1.0"
|
||||
broccoli-merge-trees "^2.0.0"
|
||||
broccoli-stew "^1.4.0"
|
||||
chalk "^1.1.3"
|
||||
ember-cli-babel "^5.1.7"
|
||||
exists-sync "^0.0.4"
|
||||
lodash.defaults "^4.2.0"
|
||||
moment "^2.18.1"
|
||||
moment-timezone "~0.5.11"
|
||||
|
||||
ember-cli-node-assets@0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/ember-cli-node-assets/-/ember-cli-node-assets-0.2.2.tgz#d2d55626e7cc6619f882d7fe55751f9266022708"
|
||||
@ -3412,7 +3426,7 @@ exists-sync@0.0.3:
|
||||
version "0.0.3"
|
||||
resolved "https://registry.yarnpkg.com/exists-sync/-/exists-sync-0.0.3.tgz#b910000bedbb113b378b82f5f5a7638107622dcf"
|
||||
|
||||
exists-sync@0.0.4:
|
||||
exists-sync@0.0.4, exists-sync@^0.0.4:
|
||||
version "0.0.4"
|
||||
resolved "https://registry.yarnpkg.com/exists-sync/-/exists-sync-0.0.4.tgz#9744c2c428cc03b01060db454d4b12f0ef3c8879"
|
||||
|
||||
@ -4844,6 +4858,10 @@ lodash.debounce@^3.1.1:
|
||||
dependencies:
|
||||
lodash._getnative "^3.0.0"
|
||||
|
||||
lodash.defaults@^4.2.0:
|
||||
version "4.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
|
||||
|
||||
lodash.escape@^3.0.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-3.2.0.tgz#995ee0dc18c1b48cc92effae71a10aab5b487698"
|
||||
@ -5286,15 +5304,15 @@ mocha@^2.5.3:
|
||||
supports-color "1.2.0"
|
||||
to-iso-string "0.0.2"
|
||||
|
||||
moment-timezone@0.5.11:
|
||||
version "0.5.11"
|
||||
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.11.tgz#9b76c03d8ef514c7e4249a7bbce649eed39ef29f"
|
||||
moment-timezone@~0.5.11:
|
||||
version "0.5.13"
|
||||
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.13.tgz#99ce5c7d827262eb0f1f702044177f60745d7b90"
|
||||
dependencies:
|
||||
moment ">= 2.6.0"
|
||||
moment ">= 2.9.0"
|
||||
|
||||
moment@2.17.1, "moment@>= 2.6.0":
|
||||
version "2.17.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.17.1.tgz#fed9506063f36b10f066c8b59a144d7faebe1d82"
|
||||
"moment@>= 2.9.0", moment@^2.18.1:
|
||||
version "2.18.1"
|
||||
resolved "https://registry.yarnpkg.com/moment/-/moment-2.18.1.tgz#c36193dd3ce1c2eed2adb7c802dbbc77a81b1c0f"
|
||||
|
||||
morgan@^1.5.2:
|
||||
version "1.8.1"
|
||||
|
Loading…
Reference in New Issue
Block a user