Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop unsupported locales from moment #42521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { waitFor } from "@testing-library/react";
import moment from "moment"; // eslint-disable-line no-restricted-imports -- deprecated usage
import moment from "moment-timezone"; // eslint-disable-line no-restricted-imports -- deprecated usage

import {
setupCollectionByIdEndpoint,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/metabase/static-viz/lib/format.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NumberLike, StringLike } from "@visx/scale";
import moment from "moment"; // eslint-disable-line no-restricted-imports -- deprecated usage
import type { Moment } from "moment-timezone"; // eslint-disable-line no-restricted-imports -- deprecated usage
import moment from "moment-timezone"; // eslint-disable-line no-restricted-imports -- deprecated usage

import {
formatDateTimeWithUnit,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import moment from "moment"; // eslint-disable-line no-restricted-imports -- deprecated usage
import moment from "moment-timezone"; // eslint-disable-line no-restricted-imports -- deprecated usage
import { t } from "ttag";
import _ from "underscore";

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@
"mochawesome-merge": "^4.2.1",
"mochawesome-report-generator": "^6.2.0",
"mockdate": "^2.0.2",
"moment-locales-webpack-plugin": "^1.2.0",
"mutationobserver-shim": "^0.3.7",
"mysql2": "^3.9.7",
"node-polyfill-webpack-plugin": "2.0.1",
Expand Down
34 changes: 34 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
const WebpackNotifierPlugin = require("webpack-notifier");
const ReactRefreshPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
const MomentLocalesPlugin = require("moment-locales-webpack-plugin");

const fs = require("fs");
const path = require("path");
Expand Down Expand Up @@ -228,6 +229,39 @@ const config = (module.exports = {
},

plugins: [
// strip locales, except supported at
// https://www.metabase.com/docs/latest/configuring-metabase/localization
new MomentLocalesPlugin({
localesToKeep: [
"sq",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"ar",
"bg",
"ca",
"zh-cn",
"cs",
"nl",
"fa",
"fi",
"fr",
"de",
"id",
"it",
"ja",
"ko",
"lv",
"nb",
"pl",
"pt",
"ru",
"sr",
"sk",
"es",
"sv",
"tr",
"uk",
"vi",
],
}),
// Extracts initial CSS into a standard stylesheet that can be loaded in parallel with JavaScript
new MiniCssExtractPlugin({
filename: devMode ? "[name].css" : "[name].[contenthash].css",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15564,6 +15564,11 @@ lodash.debounce@^4.0.8:
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==

lodash.difference@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.difference/-/lodash.difference-4.5.0.tgz#9ccb4e505d486b91651345772885a2df27fd017c"
integrity sha512-dS2j+W26TQ7taQBGN8Lbbq04ssV3emRw4NY58WErlTO29pIqS0HmoT5aJ9+TUQ1N3G+JOZSji4eugsWwGp9yPA==

lodash.get@^3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-3.7.0.tgz#3ce68ae2c91683b281cc5394128303cbf75e691f"
Expand Down Expand Up @@ -16882,6 +16887,13 @@ mockdate@^2.0.2:
resolved "https://registry.yarnpkg.com/mockdate/-/mockdate-2.0.5.tgz#70c6abf9ed4b2dae65c81dfc170dd1a5cec53620"
integrity sha512-ST0PnThzWKcgSLyc+ugLVql45PvESt3Ul/wrdV/OPc/6Pr8dbLAIJsN1cIp41FLzbN+srVTNIRn+5Cju0nyV6A==

moment-locales-webpack-plugin@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/moment-locales-webpack-plugin/-/moment-locales-webpack-plugin-1.2.0.tgz#9af83876a44053706b868ceece5119584d10d7aa"
integrity sha512-QAi5v0OlPUP7GXviKMtxnpBAo8WmTHrUNN7iciAhNOEAd9evCOvuN0g1N7ThIg3q11GLCkjY1zQ2saRcf/43nQ==
dependencies:
lodash.difference "^4.5.0"

moment-timezone@^0.5.38:
version "0.5.38"
resolved "https://registry.yarnpkg.com/moment-timezone/-/moment-timezone-0.5.38.tgz#9674a5397b8be7c13de820fd387d8afa0f725aad"
Expand Down