chore: merges removal of swc/register

This commit is contained in:
James
2023-01-17 16:51:11 -05:00
7 changed files with 37 additions and 71 deletions

View File

@@ -12,5 +12,5 @@
"test/"
],
"ext": "ts,js,json",
"exec": "node ./test/dev.js"
"exec": "ts-node ./test/dev.ts"
}

View File

@@ -88,7 +88,6 @@
"@faceless-ui/window-info": "^2.0.2",
"@monaco-editor/react": "^4.4.6",
"@swc/core": "^1.3.24",
"@swc/register": "^0.1.10",
"body-parser": "^1.19.0",
"bson-objectid": "^2.0.1",
"compression": "^1.7.4",
@@ -192,7 +191,7 @@
"webpack-hot-middleware": "^2.25.0"
},
"devDependencies": {
"@playwright/test": "^1.23.1",
"@playwright/test": "^1.29.2",
"@release-it/conventional-changelog": "^5.1.1",
"@swc/jest": "^0.2.24",
"@testing-library/jest-dom": "^5.11.4",

View File

@@ -1,7 +1,6 @@
/* eslint-disable import/no-dynamic-require */
/* eslint-disable global-require */
// eslint-disable-next-line import/no-extraneous-dependencies
import swcRegister from '@swc/register';
import path from 'path';
import pino from 'pino';
import Logger from '../utilities/logger';
@@ -15,24 +14,6 @@ const loadConfig = (logger?: pino.Logger): SanitizedConfig => {
const configPath = findConfig();
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
swcRegister({
sourceMaps: 'inline',
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
ignore: [
/node_modules[\\/](?!.pnpm[\\/].*[\\/]node_modules[\\/])(?!payload[\\/]dist[\\/]admin|payload[\\/]components).*/,
],
module: {
type: 'commonjs',
},
});
clientFiles.forEach((ext) => {
require.extensions[ext] = () => null;
});

View File

@@ -1,36 +0,0 @@
const fs = require('fs');
const path = require('path');
const swcRegister = require('@swc/register');
const [testSuiteDir] = process.argv.slice(2);
if (!testSuiteDir) {
console.error('ERROR: You must provide an argument for "testSuiteDir"');
process.exit(1);
}
const configPath = path.resolve(__dirname, testSuiteDir, 'config.ts');
if (!fs.existsSync(configPath)) {
console.error('ERROR: You must pass a valid directory under test/ that contains a config.ts');
process.exit(1);
}
process.env.PAYLOAD_CONFIG_PATH = configPath;
process.env.PAYLOAD_DROP_DATABASE = 'true';
swcRegister({
sourceMaps: 'inline',
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
},
},
module: {
type: 'commonjs',
},
});
require('./devServer');

View File

@@ -1,8 +1,27 @@
import fs from 'fs';
import path from 'path';
import express from 'express';
import { v4 as uuid } from 'uuid';
import payload from '../src';
const [testSuiteDir] = process.argv.slice(2);
if (!testSuiteDir) {
console.error('ERROR: You must provide an argument for "testSuiteDir"');
process.exit(1);
}
const configPath = path.resolve(__dirname, testSuiteDir, 'config.ts');
if (!fs.existsSync(configPath)) {
console.error('ERROR: You must pass a valid directory under test/ that contains a config.ts');
process.exit(1);
}
process.env.PAYLOAD_CONFIG_PATH = configPath;
process.env.PAYLOAD_DROP_DATABASE = 'true';
const expressApp = express();
const startDev = async () => {

View File

@@ -33,6 +33,9 @@
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
},
"ts-node": {
"swc": true,
},
"include": [
"src/"
],

View File

@@ -1797,13 +1797,13 @@
dependencies:
"@octokit/openapi-types" "^14.0.0"
"@playwright/test@^1.23.1":
version "1.29.1"
resolved "https://registry.yarnpkg.com/@playwright/test/-/test-1.29.1.tgz#f2ed4dc143b9c7825a7ad2703b2f1ac4354e1145"
integrity sha512-iQxk2DX5U9wOGV3+/Jh9OHPsw5H3mleUL2S4BgQuwtlAfK3PnKvn38m4Rg9zIViGHVW24opSm99HQm/UFLEy6w==
"@playwright/test@^1.29.2":
version "1.29.2"
resolved "https://registry.npmjs.org/@playwright/test/-/test-1.29.2.tgz#c48184721d0f0b7627a886e2ec42f1efb2be339d"
integrity sha512-+3/GPwOgcoF0xLz/opTnahel1/y42PdcgZ4hs+BZGIUjtmEFSXGg+nFoaH3NSmuc7a6GSFwXDJ5L7VXpqzigNg==
dependencies:
"@types/node" "*"
playwright-core "1.29.1"
playwright-core "1.29.2"
"@pnpm/network.ca-file@^1.0.1":
version "1.0.2"
@@ -1952,7 +1952,7 @@
"@swc/register@^0.1.10":
version "0.1.10"
resolved "https://registry.yarnpkg.com/@swc/register/-/register-0.1.10.tgz#74a20b7559669e03479b05e9e5c6d1524d4d92a2"
resolved "https://registry.npmjs.org/@swc/register/-/register-0.1.10.tgz#74a20b7559669e03479b05e9e5c6d1524d4d92a2"
integrity sha512-6STwH/q4dc3pitXLVkV7sP0Hiy+zBsU2wOF1aXpXR95pnH3RYHKIsDC+gvesfyB7jxNT9OOZgcqOp9RPxVTx9A==
dependencies:
lodash.clonedeep "^4.5.0"
@@ -8081,7 +8081,7 @@ locate-path@^5.0.0:
lodash.clonedeep@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
resolved "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef"
integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==
lodash.get@^4.4.2:
@@ -9377,10 +9377,10 @@ pkg-up@^3.1.0:
dependencies:
find-up "^3.0.0"
playwright-core@1.29.1:
version "1.29.1"
resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.29.1.tgz#9ec15d61c4bd2f386ddf6ce010db53a030345a47"
integrity sha512-20Ai3d+lMkWpI9YZYlxk8gxatfgax5STW8GaMozAHwigLiyiKQrdkt7gaoT9UQR8FIVDg6qVXs9IoZUQrDjIIg==
playwright-core@1.29.2:
version "1.29.2"
resolved "https://registry.npmjs.org/playwright-core/-/playwright-core-1.29.2.tgz#2e8347e7e8522409f22b244e600e703b64022406"
integrity sha512-94QXm4PMgFoHAhlCuoWyaBYKb92yOcGVHdQLoxQ7Wjlc7Flg4aC/jbFW7xMR52OfXMVkWicue4WXE7QEegbIRA==
pluralize@^8.0.0:
version "8.0.0"
@@ -11778,7 +11778,7 @@ ts-essentials@^7.0.1:
ts-node@^10.9.1:
version "10.9.1"
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
resolved "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b"
integrity sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==
dependencies:
"@cspotcode/source-map-support" "^0.8.0"