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