Browse Source

fix: rspack build

DarkPhoenix2704 3 weeks ago
parent
commit
e9a76e2567
No known key found for this signature in database
GPG Key ID: 3F76B10622A07849
  1. 75
      packages/nocodb/docker/rspack.config.js
  2. 51
      packages/nocodb/docker/webpack.config.js
  3. 41
      packages/nocodb/package.json
  4. 6
      packages/nocodb/rspack.dev.config.js
  5. 1596
      pnpm-lock.yaml

75
packages/nocodb/docker/rspack.config.js

@ -0,0 +1,75 @@
const path = require('path');
const { rspack } = require('@rspack/core');
const { resolveTsAliases } = require('../build-utils/resolveTsAliases');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: './src/run/dockerEntry.ts',
module: {
rules: [
{
test: /\.node$/,
loader: 'node-loader',
options: {
name: '[path][name].[ext]',
},
},
{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: 'builtin:swc-loader',
options: {
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: true,
dynamicImport: true,
},
transform: {
legacyDecorator: true,
decoratorMetadata: true,
},
target: 'es2017',
},
module: {
type: 'commonjs',
},
},
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.json'],
alias: resolveTsAliases(path.resolve('tsconfig.json')),
},
output: {
path: require('path').resolve('./docker'),
filename: 'main.js',
library: 'libs',
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this",
},
optimization: {
minimize: true, //Update this to true or false
minimizer: [
new rspack.SwcJsMinimizerRspackPlugin({
minimizerOptions: {
compress: {
keep_classnames: true,
},
},
}),
],
nodeEnv: false,
},
externals: [nodeExternals()],
plugins: [
new rspack.EnvironmentPlugin({
EE: true,
}),
],
target: 'node',
node: {
__dirname: false,
},
};

51
packages/nocodb/docker/webpack.config.js

@ -1,51 +0,0 @@
const path = require('path');
const nodeExternals = require('webpack-node-externals');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const { resolveTsAliases } = require('../build-utils/resolveTsAliases');
module.exports = {
entry: './src/run/dockerEntry.ts',
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.json'],
alias: resolveTsAliases(path.resolve('tsconfig.json')),
},
output: {
path: require('path').resolve('./docker'),
filename: 'main.js',
library: 'libs',
libraryTarget: 'umd',
globalObject: "typeof self !== 'undefined' ? self : this",
},
optimization: {
minimize: true, //Update this to true or false
minimizer: [
new TerserPlugin({
terserOptions: {
keep_classnames: true,
},
}),
],
nodeEnv: false,
},
externals: [nodeExternals()],
plugins: [new webpack.EnvironmentPlugin(['EE'])],
target: 'node',
node: {
__dirname: false,
},
};

41
packages/nocodb/package.json

@ -21,8 +21,8 @@
"license": "AGPL-3.0-or-later",
"scripts": {
"build": "pnpm run docker:build",
"build:obfuscate": "EE=true webpack --config webpack.config.js",
"build:cli:module": "EE=true webpack --config webpack.cli.config.js",
"build:obfuscate": "EE=true rspack --config rspack.config.js",
"build:cli:module": "EE=true rspack --config rspack.cli.config.js",
"obfuscate:build:publish": "pnpm run build:obfuscate && pnpm publish .",
"registerIntegrations": "node build-utils/registerIntegrations.js",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
@ -32,19 +32,19 @@
"test": "jest --runInBand --forceExit",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r @swc-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"watch:run": "cross-env NC_DISABLE_TELE=true NODE_ENV=development EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:mysql": "cross-env NC_DISABLE_TELE=true NODE_ENV=development EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunMysql --log-error --project tsconfig.json\"",
"watch:run:pg": "cross-env NC_DISABLE_TELE=true NODE_ENV=development EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG --log-error --project tsconfig.json\"",
"watch:run:playwright:mysql": "rm -f ./test_noco.db; cross-env DB_TYPE=mysql NC_DB=\"mysql2://localhost:3306?u=root&p=password&d=pw_ncdb\" PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright:pg": "rm -f ./test_noco.db; cross-env DB_TYPE=pg NC_DB=\"pg://localhost:5432?u=postgres&p=password&d=pw_ncdb\" PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright": "rm -f ./test_*.db; cross-env DB_TYPE=sqlite DATABASE_URL=sqlite:./test_noco.db PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true EE=true NC_SNAPSHOT_WINDOW_SEC=3 nodemon -e ts,js -w ./src -x \"ts-node src/run/testDocker --log-error --project tsconfig.json\"",
"watch:run:playwright:quick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NODE_ENV=test DATABASE_URL=sqlite:./test_noco.db NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/docker --log-error --project tsconfig.json\"",
"watch:run:playwright:pg:cyquick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NODE_ENV=test NC_DISABLE_TELE=true EE=true nodemon -e ts,js -w ./src -x \"ts-node src/run/dockerRunPG_CyQuick.ts --log-error --project tsconfig.json\"",
"test:unit": "cross-env EE=false NODE_ENV=test TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"test:unit:pg": "cp tests/unit/.pg.env tests/unit/.env; cross-env NODE_ENV=test EE=false TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha -r ts-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"docker:build": "EE=\"true-xc-test\" webpack --config docker/webpack.config.js"
"watch:run": "cross-env NODE_ENV=development NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/docker",
"watch:run:mysql": "cross-env NODE_ENV=development NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/dockerRunMysql",
"watch:run:pg": "cross-env NODE_ENV=development NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/dockerRunPG",
"watch:run:playwright": "rm -f ./test_*.db; cross-env DB_TYPE=sqlite DATABASE_URL=sqlite:./test_noco.db PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true NC_SNAPSHOT_WINDOW_SEC=3 rspack serve --config rspack.dev.config.js --entry src/run/testDocker",
"watch:run:playwright:mysql": "rm -f ./test_noco.db; cross-env DB_TYPE=mysql NC_DB=\"mysql2://localhost:3306?u=root&p=password&d=pw_ncdb\" PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/testDocker",
"watch:run:playwright:pg": "rm -f ./test_noco.db; cross-env DB_TYPE=pg NC_DB=\"pg://localhost:5432?u=postgres&p=password&d=pw_ncdb\" PLAYWRIGHT_TEST=true NODE_ENV=test NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/testDocke",
"watch:run:playwright:quick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NODE_ENV=test DATABASE_URL=sqlite:./test_noco.db NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/docker",
"watch:run:playwright:pg:cyquick": "rm -f ./test_noco.db; cp ../../tests/playwright/fixtures/noco_0_91_7.db ./test_noco.db; cross-env NODE_ENV=test NC_DISABLE_TELE=true rspack serve --config rspack.dev.config.js --entry src/run/dockerRunPG_CyQuick.ts",
"test:unit": "cross-env NODE_ENV=test TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha --require @swc-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"test:unit:pg": "cp tests/unit/.pg.env tests/unit/.env; cross-env NODE_ENV=test TS_NODE_PROJECT=./tests/unit/tsconfig.json mocha --require @swc-node/register tests/unit/index.test.ts --recursive --timeout 300000 --exit --delay",
"docker:build": "EE=\"true-xc-test\" rspack --config docker/rspack.config.js"
},
"dependencies": {
"@aws-sdk/client-kafka": "^3.620.0",
@ -165,6 +165,9 @@
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.8",
"@nestjsplus/dyn-schematics": "^1.0.12",
"@rspack/cli": "^1.1.1",
"@rspack/core": "^1.1.1",
"@swc-node/register": "^1.10.9",
"@types/content-disposition": "^0.5.8",
"@types/ejs": "^3.1.5",
"@types/express": "^4.17.21",
@ -178,7 +181,6 @@
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"chai": "^4.4.1",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.3",
"eslint": "^8.56.0",
"eslint-config-prettier": "^8.10.0",
@ -186,17 +188,16 @@
"eslint-plugin-functional": "^5.0.8",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^4.2.1",
"fork-ts-checker-webpack-plugin": "^9.0.2",
"jest": "29.7.0",
"mocha": "^10.3.0",
"node-loader": "^2.1.0",
"nodemon": "^3.0.3",
"prettier": "^2.8.8",
"source-map-support": "^0.5.21",
"run-script-webpack-plugin": "^0.2.0",
"supertest": "^6.3.4",
"ts-jest": "29.1.2",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3",
"webpack-cli": "^5.1.4"
"typescript": "^5.3.3"
}
}

6
packages/nocodb/rspack.dev.config.js

@ -1,7 +1,8 @@
const { join } = require('path');
const { join, resolve } = require('path');
const { rspack } = require('@rspack/core');
const NodeExternals = require('webpack-node-externals');
const { RunScriptWebpackPlugin } = require('run-script-webpack-plugin');
const {resolveTsAliases} = require("./build-utils/resolveTsAliases");
// const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
const baseDevConfig = {
@ -71,6 +72,9 @@ const baseDevConfig = {
],
resolve: {
extensions: ['.tsx', '.ts', '.js', '.json', '.node'],
alias: {
...resolveTsAliases(resolve('tsconfig.json')),
},
},
optimization: {
minimize: false,

1596
pnpm-lock.yaml

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save