bootstrap 5 & angular 15 WIP

This commit is contained in:
Eugene Pankov 2023-02-05 18:58:58 +01:00
parent 153d11cfe2
commit a793c44b94
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
22 changed files with 727 additions and 554 deletions

View File

@ -1,15 +1,3 @@
parser: '@typescript-eslint/parser'
parserOptions:
project:
- tsconfig.json
- '*/tsconfig.typings.json'
extends:
- 'plugin:@typescript-eslint/all'
- plugin:import/recommended
- plugin:import/typescript
plugins:
- '@typescript-eslint'
- 'import'
settings:
import/resolver:
typescript: true
@ -19,126 +7,145 @@ env:
es6: true
node: true
commonjs: true
rules:
'@typescript-eslint/semi':
- error
- never
'@typescript-eslint/indent':
- error
- 4
'@typescript-eslint/explicit-member-accessibility':
- error
- accessibility: no-public
overrides:
parameterProperties: explicit
'@typescript-eslint/no-require-imports': off
'@typescript-eslint/no-parameter-properties': off
'@typescript-eslint/explicit-function-return-type': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-magic-numbers': off
'@typescript-eslint/member-delimiter-style': off
'@typescript-eslint/promise-function-async': off
'@typescript-eslint/require-array-sort-compare': off
'@typescript-eslint/no-floating-promises': off
'@typescript-eslint/prefer-readonly': off
'@typescript-eslint/require-await': off
'@typescript-eslint/strict-boolean-expressions': off
'@typescript-eslint/no-misused-promises':
- error
- checksVoidReturn: false
'@typescript-eslint/typedef': off
'@typescript-eslint/consistent-type-imports': off
'@typescript-eslint/sort-type-union-intersection-members': off
'@typescript-eslint/no-use-before-define':
- error
- classes: false
no-duplicate-imports: error
array-bracket-spacing:
- error
- never
block-scoped-var: error
brace-style: off
'@typescript-eslint/brace-style':
- error
- 1tbs
- allowSingleLine: true
computed-property-spacing:
- error
- never
comma-dangle: off
'@typescript-eslint/comma-dangle':
- error
- always-multiline
curly: error
eol-last: error
eqeqeq:
- error
- smart
max-depth:
- 1
- 5
max-statements:
- 1
- 80
no-multiple-empty-lines: error
no-mixed-spaces-and-tabs: error
no-trailing-spaces: error
'@typescript-eslint/no-unused-vars':
overrides:
- files: '*.mjs'
plugins:
- 'import'
- files: '*.ts'
parser: '@typescript-eslint/parser'
parserOptions:
project:
- tsconfig.json
- '*/tsconfig.typings.json'
extends:
- 'plugin:@typescript-eslint/all'
- plugin:import/recommended
- plugin:import/typescript
plugins:
- '@typescript-eslint'
- 'import'
rules:
'@typescript-eslint/semi':
- error
- vars: all
args: after-used
argsIgnorePattern: ^_
no-undef: error
no-var: error
object-curly-spacing: off
'@typescript-eslint/object-curly-spacing':
- error
- always
quote-props:
- warn
- as-needed
- keywords: true
numbers: true
quotes: off
'@typescript-eslint/quotes':
- error
- single
- allowTemplateLiterals: true
'@typescript-eslint/no-confusing-void-expression':
- error
- ignoreArrowShorthand: true
'@typescript-eslint/no-non-null-assertion': off
'@typescript-eslint/no-unnecessary-condition':
- error
- allowConstantLoopConditions: true
'@typescript-eslint/restrict-template-expressions': off
'@typescript-eslint/prefer-readonly-parameter-types': off
'@typescript-eslint/no-unsafe-member-access': off
'@typescript-eslint/no-unsafe-call': off
'@typescript-eslint/no-unsafe-return': off
'@typescript-eslint/no-unsafe-assignment': off
'@typescript-eslint/naming-convention': off
'@typescript-eslint/lines-between-class-members':
- error
- exceptAfterSingleLine: true
'@typescript-eslint/dot-notation': off
'@typescript-eslint/no-implicit-any-catch': off
'@typescript-eslint/member-ordering': off
'@typescript-eslint/no-var-requires': off
'@typescript-eslint/no-unsafe-argument': off
'@typescript-eslint/restrict-plus-operands': off
'@typescript-eslint/space-infix-ops': off
'@typescript-eslint/no-type-alias':
- error
- allowAliases: in-unions-and-intersections
allowLiterals: always
allowCallbacks: always
'@typescript-eslint/sort-type-constituents': off
'@typescript-eslint/parameter-properties':
- error
- prefer: parameter-property
'import/no-named-as-default-member': off
'@typescript-eslint/consistent-type-exports': off
'@typescript-eslint/consistent-generic-constructors': off
'keyword-spacing': off
'@typescript-eslint/keyword-spacing': off
- never
'@typescript-eslint/indent':
- error
- 4
'@typescript-eslint/explicit-member-accessibility':
- error
- accessibility: no-public
overrides:
parameterProperties: explicit
'@typescript-eslint/no-require-imports': off
'@typescript-eslint/no-parameter-properties': off
'@typescript-eslint/explicit-function-return-type': off
'@typescript-eslint/no-explicit-any': off
'@typescript-eslint/no-magic-numbers': off
'@typescript-eslint/member-delimiter-style': off
'@typescript-eslint/promise-function-async': off
'@typescript-eslint/require-array-sort-compare': off
'@typescript-eslint/no-floating-promises': off
'@typescript-eslint/prefer-readonly': off
'@typescript-eslint/require-await': off
'@typescript-eslint/strict-boolean-expressions': off
'@typescript-eslint/no-misused-promises':
- error
- checksVoidReturn: false
'@typescript-eslint/typedef': off
'@typescript-eslint/consistent-type-imports': off
'@typescript-eslint/sort-type-union-intersection-members': off
'@typescript-eslint/no-use-before-define':
- error
- classes: false
no-duplicate-imports: error
array-bracket-spacing:
- error
- never
block-scoped-var: error
brace-style: off
'@typescript-eslint/brace-style':
- error
- 1tbs
- allowSingleLine: true
computed-property-spacing:
- error
- never
comma-dangle: off
'@typescript-eslint/comma-dangle':
- error
- always-multiline
curly: error
eol-last: error
eqeqeq:
- error
- smart
max-depth:
- 1
- 5
max-statements:
- 1
- 80
no-multiple-empty-lines: error
no-mixed-spaces-and-tabs: error
no-trailing-spaces: error
'@typescript-eslint/no-unused-vars':
- error
- vars: all
args: after-used
argsIgnorePattern: ^_
no-undef: error
no-var: error
object-curly-spacing: off
'@typescript-eslint/object-curly-spacing':
- error
- always
quote-props:
- warn
- as-needed
- keywords: true
numbers: true
quotes: off
'@typescript-eslint/quotes':
- error
- single
- allowTemplateLiterals: true
'@typescript-eslint/no-confusing-void-expression':
- error
- ignoreArrowShorthand: true
'@typescript-eslint/no-non-null-assertion': off
'@typescript-eslint/no-unnecessary-condition':
- error
- allowConstantLoopConditions: true
'@typescript-eslint/restrict-template-expressions': off
'@typescript-eslint/prefer-readonly-parameter-types': off
'@typescript-eslint/no-unsafe-member-access': off
'@typescript-eslint/no-unsafe-call': off
'@typescript-eslint/no-unsafe-return': off
'@typescript-eslint/no-unsafe-assignment': off
'@typescript-eslint/naming-convention': off
'@typescript-eslint/lines-between-class-members':
- error
- exceptAfterSingleLine: true
'@typescript-eslint/dot-notation': off
'@typescript-eslint/no-implicit-any-catch': off
'@typescript-eslint/member-ordering': off
'@typescript-eslint/no-var-requires': off
'@typescript-eslint/no-unsafe-argument': off
'@typescript-eslint/restrict-plus-operands': off
'@typescript-eslint/space-infix-ops': off
'@typescript-eslint/no-type-alias':
- error
- allowAliases: in-unions-and-intersections
allowLiterals: always
allowCallbacks: always
'@typescript-eslint/sort-type-constituents': off
'@typescript-eslint/parameter-properties':
- error
- prefer: parameter-property
'import/no-named-as-default-member': off
'@typescript-eslint/consistent-type-exports': off
'@typescript-eslint/consistent-generic-constructors': off
'keyword-spacing': off
'@typescript-eslint/keyword-spacing': off

View File

@ -47,7 +47,7 @@
"@types/mz": "2.7.4",
"@types/node": "18.7.23",
"atomically": "^1.7.0",
"ngx-filesize": "^2.0.16"
"ngx-filesize": "^3.0.1"
},
"peerDependencies": {
"tabby-community-color-schemes": "*",

View File

@ -6,5 +6,4 @@ import '@fortawesome/fontawesome-free/css/solid.css'
import '@fortawesome/fontawesome-free/css/brands.css'
import '@fortawesome/fontawesome-free/css/regular.css'
import '@fortawesome/fontawesome-free/css/fontawesome.css'
import 'ngx-toastr/toastr.css'
import './preload.scss'

View File

@ -1,3 +1,5 @@
// TODO test toastr
app-root {
background: #1D272D;
}

View File

@ -1,8 +1,9 @@
const path = require('path')
const webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
import * as path from 'path'
import wp from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
module.exports = {
const config = {
name: 'tabby-main',
target: 'electron-main',
entry: {
@ -55,13 +56,15 @@ module.exports = {
'yargs/yargs': 'commonjs yargs/yargs',
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.DefinePlugin({
new wp.optimize.ModuleConcatenationPlugin(),
new wp.DefinePlugin({
'process.type': '"main"',
}),
],
}
if (process.env.BUNDLE_ANALYZER) {
module.exports.plugins.push(new BundleAnalyzerPlugin())
config.plugins.push(new BundleAnalyzerPlugin())
}
export default () => config

View File

@ -1,7 +1,9 @@
const path = require('path')
const webpack = require('webpack')
import * as path from 'path'
import wp from 'webpack'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
import linkerPlugin from '@angular/compiler-cli/linker/babel'
module.exports = {
export default () => ({
name: 'tabby',
target: 'node',
entry: {
@ -28,6 +30,17 @@ module.exports = {
},
module: {
rules: [
{
test: /\.(m?)js$/,
loader: 'babel-loader',
options: {
compact: false,
plugins: [linkerPlugin],
},
resolve: {
fullySpecified: false,
},
},
{
test: /\.ts$/,
use: {
@ -56,9 +69,9 @@ module.exports = {
path: 'commonjs path',
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.DefinePlugin({
new wp.optimize.ModuleConcatenationPlugin(),
new wp.DefinePlugin({
'process.type': '"renderer"',
}),
],
}
})

View File

@ -1094,11 +1094,6 @@ figgy-pudding@^3.4.1, figgy-pudding@^3.5.1:
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
integrity sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==
"filesize@>= 4.0.0":
version "6.3.0"
resolved "https://registry.yarnpkg.com/filesize/-/filesize-6.3.0.tgz#dff53cfb3f104c9e422f346d53be8dbcc971bf11"
integrity sha512-ytx0ruGpDHKWVoiui6+BY/QMNngtDQ/pJaFwfBpQif0J63+E8DLdFyqS3NkKQn7vIruUEpoGD9JUJSg7Kp+I0g==
fill-range@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"
@ -2261,13 +2256,12 @@ native-process-working-directory@^1.0.2:
dependencies:
node-addon-api "^3.1.0"
ngx-filesize@^2.0.16:
version "2.0.16"
resolved "https://registry.yarnpkg.com/ngx-filesize/-/ngx-filesize-2.0.16.tgz#fdaba04170edb6cfcdf7be932783cf913b03f016"
integrity sha512-VdaCirE7hSyfQh8ZEmhzNEhbddiTYUHF4V6OX+KyTmnQSVx4hp9kmzDX5YlkIlmClI6wI+LZmH9/q7XS3fsMPA==
ngx-filesize@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/ngx-filesize/-/ngx-filesize-3.0.1.tgz#620933ae181a1128905404e43b26abb99accba90"
integrity sha512-792I4fiG9EEPYjGib2+YTYAzfWIlccfy8uXNSXFFepuAntoS+eijLwnl0m7ajcQuNgbTtwEf9VmYIPN8mS3jqQ==
dependencies:
filesize ">= 4.0.0"
tslib "^2.0.0"
tslib "^2.3.0"
nice-try@^1.0.4:
version "1.0.5"
@ -3717,11 +3711,16 @@ tough-cookie@~2.5.0:
psl "^1.1.28"
punycode "^2.1.1"
tslib@^2.0.0, tslib@^2.1.0:
tslib@^2.1.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
tslib@^2.3.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.5.0.tgz#42bfed86f5787aeb41d031866c8f402429e0fddf"
integrity sha512-336iVw3rtn2BUK7ORdIAHTyxHGRIHVReokCR3XjbckJMK7ms8FysBfhLR8IXnAgy7T0PTPNBWKiH514FOW/WSg==
tunnel-agent@^0.6.0:
version "0.6.0"
resolved "https://registry.yarnpkg.com/tunnel-agent/-/tunnel-agent-0.6.0.tgz"

View File

@ -1,17 +1,18 @@
{
"devDependencies": {
"@angular/animations": "^12.0.0",
"@angular/cdk": "^12.2.9",
"@angular/common": "^12.0.0",
"@angular/compiler": "^12.0.0",
"@angular/compiler-cli": "^12.0.0",
"@angular/core": "^12.0.0",
"@angular/forms": "^12.0.0",
"@angular/platform-browser": "^12.0.0",
"@angular/platform-browser-dynamic": "^12.0.0",
"@angular/animations": "^15.1.3",
"@angular/cdk": "^15.1.3",
"@angular/common": "^15.1.3",
"@angular/compiler": "^15.1.3",
"@angular/compiler-cli": "^15.1.3",
"@angular/core": "^15.1.3",
"@angular/forms": "^15.1.3",
"@angular/platform-browser": "^15.1.3",
"@angular/platform-browser-dynamic": "^15.1.3",
"@biesbjerg/ngx-translate-extract-marker": "^1.0.0",
"@fortawesome/fontawesome-free": "^6.2.0",
"@ng-bootstrap/ng-bootstrap": "^10.0.0",
"@ng-bootstrap/ng-bootstrap": "^14.0.1",
"@popperjs/core": "^2.11.6",
"@sentry/cli": "^1.74.3",
"@sentry/electron": "^2.5.4",
"@tabby-gang/to-string-loader": "^1.1.7-beta.2",
@ -27,13 +28,14 @@
"@typescript-eslint/parser": "^5.45.0",
"apply-loader": "2.0.0",
"axios": "^0.27.2",
"babel-loader": "^9.1.2",
"browserify-sign": "^4.2.1",
"clone-deep": "^4.0.1",
"compare-versions": "^5",
"core-js": "^3.21.1",
"core-js-pure": "^3.21.1",
"cross-env": "7.0.3",
"css-loader": "^6.7.1",
"css-loader": "^6.7.3",
"deep-equal": "2.0.5",
"electron": "21.3.1",
"electron-builder": "^24.0.0-alpha.1",
@ -52,7 +54,7 @@
"lru-cache": "^6.0.0",
"macos-release": "^3.1.0",
"ngx-sortablejs": "^11.1.0",
"ngx-toastr": "^14.0.0",
"ngx-toastr": "^16.0.2",
"node-abi": "^3.25.0",
"npmlog": "6.0.2",
"npx": "^10.2.2",
@ -66,28 +68,29 @@
"pug-static-loader": "2.0.0",
"raw-loader": "4.0.2",
"sass": "^1.58.0",
"sass-loader": "^12.6.0",
"sass-loader": "^13.2.0",
"shell-quote": "^1.7.4",
"shelljs": "0.8.5",
"slugify": "^1.6.5",
"sortablejs": "^1.15.0",
"source-code-pro": "^2.38.0",
"source-map-loader": "^3.0.1",
"source-map-loader": "^4.0.1",
"source-sans-pro": "3.6.0",
"ssh2": "Eugeny/ssh2#9de907d62907d6d45debdcc0ed8dda5b7b19dc7c",
"style-loader": "^3.3.1",
"svg-inline-loader": "^0.8.2",
"thenby": "^1.3.4",
"ts-loader": "^9.4.2",
"tslib": "^2.4.0",
"tsimportlib": "^0.0.3",
"tslib": "^2.5.0",
"typedoc": "^0.22.18",
"typescript": "^4.3.5",
"typescript": "^4.9.5",
"utils-decorators": "^1.10.4",
"val-loader": "4.0.0",
"val-loader": "5.0.1",
"webpack": "^5.75.0",
"webpack-bundle-analyzer": "^4.7.0",
"webpack-cli": "^5.0.0",
"yaml-loader": "0.6.0",
"webpack-cli": "^5.0.1",
"yaml-loader": "0.8.0",
"zone.js": "^0.11.5"
},
"resolutions": {
@ -110,5 +113,6 @@
"i18n:extract": "node scripts/i18n-extract.js",
"i18n:push": "crowdin push"
},
"type": "module",
"private": true
}

View File

@ -1,7 +1,7 @@
#!/usr/bin/env node
const sh = require('shelljs')
const vars = require('./vars')
const log = require('npmlog')
import sh from 'shelljs'
import * as vars from './vars.mjs'
import log from 'npmlog'
log.info('patch')
sh.exec(`yarn patch-package`, { fatal: true })

View File

@ -1,53 +1,55 @@
const path = require('path')
const fs = require('fs')
const semver = require('semver')
const childProcess = require('child_process')
import * as path from 'path'
import * as fs from 'fs'
import * as semver from 'semver'
import * as childProcess from 'child_process'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const electronInfo = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../node_modules/electron/package.json')))
exports.version = childProcess.execSync('git describe --tags', { encoding:'utf-8' })
exports.version = exports.version.substring(1).trim()
exports.version = exports.version.replace('-', '-c')
export let version = childProcess.execSync('git describe --tags', { encoding:'utf-8' })
version = version.substring(1).trim()
version = version.replace('-', '-c')
if (exports.version.includes('-c')) {
exports.version = semver.inc(exports.version, 'prepatch').replace('-0', `-nightly.${process.env.REV ?? 0}`)
if (version.includes('-c')) {
version = semver.inc(version, 'prepatch').replace('-0', `-nightly.${process.env.REV ?? 0}`)
}
exports.builtinPlugins = [
export const builtinPlugins = [
'tabby-core',
'tabby-settings',
'tabby-terminal',
'tabby-web',
'tabby-community-color-schemes',
'tabby-ssh',
'tabby-serial',
'tabby-telnet',
'tabby-electron',
'tabby-local',
'tabby-plugin-manager',
'tabby-linkifier',
// 'tabby-settings',
// 'tabby-terminal',
// 'tabby-web',
// 'tabby-community-color-schemes',
// 'tabby-ssh',
// 'tabby-serial',
// 'tabby-telnet',
// 'tabby-electron',
// 'tabby-local',
// 'tabby-plugin-manager',
// 'tabby-linkifier',
]
exports.packagesWithDocs = [
export const packagesWithDocs = [
['.', 'tabby-core'],
['terminal', 'tabby-terminal'],
['local', 'tabby-local'],
['settings', 'tabby-settings'],
]
exports.allPackages = [
...exports.builtinPlugins,
export const allPackages = [
...builtinPlugins,
'web',
'tabby-web-demo',
]
exports.bundledModules = [
export const bundledModules = [
'@angular',
'@ng-bootstrap',
]
exports.electronVersion = electronInfo.version
export const electronVersion = electronInfo.version
exports.keygenConfig = {
export const keygenConfig = {
provider: 'keygen',
account: 'a06315f2-1031-47c6-9181-e92a20ec815e',
channel: 'stable',
@ -70,6 +72,6 @@ exports.keygenConfig = {
}[process.platform],
}
if (!exports.keygenConfig.product) {
if (!keygenConfig.product) {
throw new Error(`Unrecognized platform ${process.platform}/${process.env.ARCH ?? process.arch}`)
}

View File

@ -24,7 +24,6 @@
"js-yaml": "^4.0.0",
"messageformat": "^2.3.0",
"mixpanel": "^0.17.0",
"ngx-filesize": "^2.0.16",
"ngx-perfect-scrollbar": "^10.1.0",
"ngx-translate-messageformat-compiler": "^4.11.0",
"readable-stream": "4.2.0",

View File

@ -1,5 +0,0 @@
const config = require('../webpack.plugin.config')
module.exports = config({
name: 'core',
dirname: __dirname,
})

View File

@ -0,0 +1,8 @@
import * as path from 'path'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
import config from '../webpack.plugin.config.mjs'
export default () => config({
name: 'core',
dirname: __dirname,
})

View File

@ -9,7 +9,7 @@ import { SettingsTabProvider } from '../api'
export class SettingsTabBodyComponent {
@Input() provider: SettingsTabProvider
@ViewChild('placeholder', { read: ViewContainerRef }) placeholder: ViewContainerRef
component: ComponentRef<Component>
component: ComponentRef<unknown>
constructor (private componentFactoryResolver: ComponentFactoryResolver) { }

View File

@ -666,9 +666,9 @@ export class BaseTerminalTabComponent<P extends BaseTerminalProfile> extends Bas
let wheelDeltaY = 0
if ('wheelDeltaY' in event) {
wheelDeltaY = (event as WheelEvent)['wheelDeltaY']
wheelDeltaY = (event as unknown as WheelEvent)['wheelDeltaY']
} else {
wheelDeltaY = (event as WheelEvent).deltaY
wheelDeltaY = (event as unknown as WheelEvent).deltaY
}
if (event.altKey) {

View File

@ -4,7 +4,6 @@ import '@fortawesome/fontawesome-free/css/solid.css'
import '@fortawesome/fontawesome-free/css/brands.css'
import '@fortawesome/fontawesome-free/css/regular.css'
import '@fortawesome/fontawesome-free/css/fontawesome.css'
import 'ngx-toastr/toastr.css'
import '../app/src/preload.scss'
// Required before other imports

View File

@ -1,4 +1,5 @@
const path = require('path')
import * as path from 'path'
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const externals = {}
for (const key of [
@ -20,7 +21,7 @@ for (const key of [
externals[key] = `commonjs ${key}`
}
module.exports = {
const config = {
name: 'tabby-web-entry',
target: 'web',
entry: {
@ -70,3 +71,5 @@ module.exports = {
},
externals,
}
export default config

View File

@ -1,14 +0,0 @@
const log = require('npmlog')
const { builtinPlugins } = require('./scripts/vars')
const paths = [
'./app/webpack.config.js',
'./app/webpack.main.config.js',
'./web/webpack.config.js',
'./tabby-web-demo/webpack.config.js',
...builtinPlugins.map(x => `./${x}/webpack.config.js`),
]
paths.forEach(x => log.info(`Using config: ${x}`))
module.exports = paths.map(x => require(x))

15
webpack.config.mjs Normal file
View File

@ -0,0 +1,15 @@
import log from 'npmlog'
import { builtinPlugins } from './scripts/vars.mjs'
const paths = [
'./app/webpack.config.mjs',
'./app/webpack.config.main.mjs',
// './web/webpack.config.mjs',
// './tabby-web-demo/webpack.config.mjs',
...builtinPlugins.map(x => `./${x}/webpack.config.mjs`),
]
paths.forEach(x => log.info(`Using config: ${x}`))
const config = await Promise.all(paths.map(x => import(x).then(x => x.default())))
export default () => config

View File

@ -1,25 +1,27 @@
const path = require('path')
const webpack = require('webpack')
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
import * as path from 'path'
import wp from 'webpack'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
const bundleAnalyzer = new BundleAnalyzerPlugin({
analyzerPort: 0,
})
module.exports = options => {
import linkerPlugin from '@angular/compiler-cli/linker/babel'
export default options => {
const sourceMapOptions = {
exclude: [/node_modules/, /vendor/],
filename: '[file].map',
moduleFilenameTemplate: `webpack-tabby-${options.name}:///[resource-path]`,
}
let SourceMapDevToolPlugin = webpack.SourceMapDevToolPlugin
let devtoolPlugin = wp.SourceMapDevToolPlugin
if (process.env.CI) {
sourceMapOptions.append = '\n//# sourceMappingURL=../../../app.asar.unpacked/assets/webpack/[url]'
}
if (process.platform === 'win32' && process.env.TABBY_DEV) {
SourceMapDevToolPlugin = webpack.EvalSourceMapDevToolPlugin
devtoolPlugin = wp.EvalSourceMapDevToolPlugin
}
const isDev = !!process.env.TABBY_DEV
@ -53,6 +55,17 @@ module.exports = options => {
module: {
rules: [
...options.rules ?? [],
{
test: /\.mjs$/,
loader: 'babel-loader',
options: {
compact: false,
plugins: [linkerPlugin],
},
resolve: {
fullySpecified: false,
},
},
{
test: /\.js$/,
enforce: 'pre',
@ -84,7 +97,7 @@ module.exports = options => {
{ test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader'], exclude: /(theme.*|component)\.scss/ },
{ test: /\.css$/, use: ['@tabby-gang/to-string-loader', 'css-loader'], include: /component\.css/ },
{ test: /\.css$/, use: ['style-loader', 'css-loader'], exclude: /component\.css/ },
{ test: /\.yaml$/, use: ['json-loader', 'yaml-loader'] },
{ test: /\.yaml$/, use: ['yaml-loader'] },
{ test: /\.svg/, use: ['svg-inline-loader'] },
{
test: /\.(eot|otf|woff|woff2|ogg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
@ -134,7 +147,7 @@ module.exports = options => {
...options.externals || [],
],
plugins: [
new SourceMapDevToolPlugin(sourceMapOptions),
new devtoolPlugin(sourceMapOptions),
],
}
if (process.env.PLUGIN_BUNDLE_ANALYZER === options.name) {

744
yarn.lock

File diff suppressed because it is too large Load Diff