mirror of
https://github.com/standardnotes/app
synced 2026-10-16 00:13:46 -04:00
* feat: Adds new i18n package and locale resolver * feat: Adds locale service * i18n(weekly-mr): Upgrade translations from crowdin (e1e05408). * feat: Adds copy plugin pattern * feat: Adds experimental feature flag and preferences section * feat: Adds injector and mobx store * feat: Adds boot flow * feat: Adds locale preference * Revert "i18n(weekly-mr): Upgrade translations from crowdin (e1e05408)." This reverts commit0f30f5840f. * i18n(weekly-mr): Upgrade translations from crowdin (fa494166). * Revert "i18n(weekly-mr): Upgrade translations from crowdin (fa494166)." This reverts commite1bd950995. * i18n(weekly-mr): Upgrade translations from crowdin (fa494166). * feat: Adds language selector and re-renders strings on locale update * feat: Adds error toast when loading language fails * feat: Localize date time strings * feat: Add fixes for specific string re-renders * feat: Localize dates that are pulled from models * feat: Fixes localization for snjs strings * feat: Add desktop localization * feat: Add mobile localization * fix: Fixes strings not re-rendering on locale change * feat: Fixes toggle and reloading behavior * feat: Update setting copy * feat: Adds spotlight modal * feat: Adds internal feature flag * feat: Fix modal styling * feat: Updates copy * feat: Loads persisted locale before app boot * fix: Avoids redundant desktop locale syncs and restores date-at-time format * feat: Improves service code * chore: Adds shared type * chore: Improves spotlight code * chore: Improves date handling code * chore: Small code tweaks * chore: Revert unrelated changes * fix: Fixes regressions * fix: Fixes regressions * fix: Fixes regressions * Revert "i18n(weekly-mr): Upgrade translations from crowdin (fa494166)." This reverts commitbbcc72cdde. * i18n(weekly-mr): Upgrade translations from crowdin (0927732f). * chore: Code and toggle animation improvements * chore: Add controller tests * chore: fixes eslint errors --------- Co-authored-by: L10n bot <service_account_73c4205ebb9a547d11aa5c7b26226660@noreply.gitlab.protontech.ch>
148 lines
4.8 KiB
JavaScript
148 lines
4.8 KiB
JavaScript
/* eslint-disable */
|
|
const path = require('path')
|
|
const webpack = require('webpack')
|
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
|
const CircularDependencyPlugin = require('circular-dependency-plugin')
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
const mergeWithEnvDefaults = require('./web.webpack-defaults')
|
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
|
const clipperHtmlTemplate = require('./clipper.htmlTemplate')
|
|
require('dotenv').config()
|
|
|
|
module.exports = (env) => {
|
|
mergeWithEnvDefaults(env)
|
|
|
|
const copyPluginPatterns = [
|
|
{ from: 'locales', to: 'locales' },
|
|
{ from: 'src/favicon', to: 'favicon' },
|
|
{ from: 'src/vendor', to: 'dist' },
|
|
{ from: 'src/404.html' },
|
|
{ from: 'src/422.html' },
|
|
{ from: 'src/500.html' },
|
|
{ from: 'src/index.html' },
|
|
{ from: 'src/manifest.webmanifest' },
|
|
{ from: 'src/robots.txt' },
|
|
{ from: 'src/.well-known', to: '.well-known' },
|
|
]
|
|
|
|
if (process.env.BUILD_TARGET !== 'clipper') {
|
|
copyPluginPatterns.push({ from: 'src/components', to: 'components' })
|
|
}
|
|
|
|
return {
|
|
entry: './src/javascripts/index.ts',
|
|
output: {
|
|
filename: process.env.BUILD_TARGET === 'clipper' ? './[name].bundle.js' : './app.js',
|
|
},
|
|
optimization:
|
|
process.env.BUILD_TARGET === 'clipper'
|
|
? {
|
|
splitChunks: {
|
|
chunks: 'all',
|
|
},
|
|
}
|
|
: {},
|
|
plugins: [
|
|
new CircularDependencyPlugin({
|
|
// exclude detection of files based on a RegExp
|
|
exclude: /a\.js|node_modules/,
|
|
// include specific files based on a RegExp
|
|
include: /app\/assets\/javascripts/,
|
|
// add errors to webpack instead of warnings
|
|
failOnError: true,
|
|
// allow import cycles that include an asyncronous import,
|
|
// e.g. via import(/* webpackMode: "weak" */ './file.js')
|
|
allowAsyncCycles: false,
|
|
// set the current working directory for displaying module paths
|
|
cwd: process.cwd(),
|
|
}),
|
|
new webpack.DefinePlugin({
|
|
__WEB_VERSION__: JSON.stringify(require('./package.json').version),
|
|
__VERSION__: JSON.stringify(require('../snjs/package.json').version),
|
|
}),
|
|
new MiniCssExtractPlugin({
|
|
// Options similar to the same options in webpackOptions.output
|
|
filename: './app.css',
|
|
ignoreOrder: true, // Enable to remove warnings about conflicting order
|
|
}),
|
|
new CopyWebpackPlugin({
|
|
patterns: copyPluginPatterns,
|
|
}),
|
|
].concat(
|
|
process.env.BUILD_TARGET === 'clipper'
|
|
? [
|
|
new HtmlWebpackPlugin({
|
|
filename: 'popup.html',
|
|
inject: false,
|
|
templateContent: clipperHtmlTemplate,
|
|
}),
|
|
]
|
|
: [],
|
|
),
|
|
resolve: {
|
|
extensions: ['.ts', '.tsx', '.js'],
|
|
fallback: {
|
|
crypto: false,
|
|
path: false,
|
|
url: false,
|
|
fs: false,
|
|
},
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src/javascripts'),
|
|
'@Controllers': path.resolve(__dirname, 'src/javascripts/controllers'),
|
|
'@Services': path.resolve(__dirname, 'src/javascripts/services'),
|
|
'@Lib': path.resolve(__dirname, '../snjs/lib'),
|
|
'@standardnotes/snjs': path.resolve(__dirname, '../snjs/lib'),
|
|
'@standardnotes/i18n': path.resolve(__dirname, '../i18n/src'),
|
|
'@standardnotes/utils': path.resolve(__dirname, '../utils/src'),
|
|
'@standardnotes/services': path.resolve(__dirname, '../services/src'),
|
|
'@standardnotes/features': path.resolve(__dirname, '../features/src'),
|
|
ttag: path.resolve(__dirname, '../../node_modules/ttag'),
|
|
},
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
test: /\.worker\.tsx?$/,
|
|
loader: 'worker-loader',
|
|
options: {
|
|
inline: 'fallback',
|
|
},
|
|
},
|
|
{
|
|
test: /\.(js|tsx?)$/,
|
|
/**
|
|
* Exclude all node_modules, except for those we need to run through our babel rules because
|
|
* they may contain class properties and other ES6+ syntax.
|
|
*/
|
|
exclude:
|
|
/node_modules\/(?!(@standardnotes\/common|@standardnotes\/domain-core|webextension-polyfill|yoga-layout))/,
|
|
use: [
|
|
'babel-loader',
|
|
{
|
|
loader: 'ts-loader',
|
|
options: {
|
|
transpileOnly: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.s?css$/,
|
|
use: [
|
|
{
|
|
loader: MiniCssExtractPlugin.loader,
|
|
options: {
|
|
publicPath: '../', // The base assets directory in relation to the stylesheets
|
|
},
|
|
},
|
|
'css-loader',
|
|
'sass-loader',
|
|
'postcss-loader',
|
|
],
|
|
},
|
|
],
|
|
},
|
|
}
|
|
}
|