Skip to content

Commit

Permalink
airdcpp-extension 2.0.0-beta, ESM updates
Browse files Browse the repository at this point in the history
  • Loading branch information
maksis committed Sep 18, 2024
1 parent df55b79 commit c554c33
Show file tree
Hide file tree
Showing 14 changed files with 2,323 additions and 634 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ coverage
.DS_Store
.idea
/dist
/devtools/settings.js
/devtools/settings.mjs
/devtools/settings
/devtools/logs
/*.log
Expand Down
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "node",
"request": "launch",
"console": "integratedTerminal",
"program": "${workspaceRoot}\\devtools\\dev-server.js",
"program": "${workspaceRoot}\\devtools\\dev-server.mjs",
"protocol": "inspector",
"cwd": "${workspaceRoot}",
"outFiles": [ "${workspaceRoot}/dist/*.js" ],
Expand All @@ -19,7 +19,7 @@
"type": "node",
"request": "launch",
"console": "integratedTerminal",
"program": "${workspaceRoot}\\devtools\\dev-server.js",
"program": "${workspaceRoot}\\devtools\\dev-server.mjs",
"cwd": "${workspaceRoot}",
"outFiles": [ "${workspaceRoot}/dist/*.js" ],
"preLaunchTask": "webpack:prof",
Expand All @@ -35,7 +35,7 @@
"type": "node",
"request": "launch",
"console": "integratedTerminal",
"program": "${workspaceRoot}\\devtools\\dev-server.js",
"program": "${workspaceRoot}\\devtools\\dev-server.mjs",
"cwd": "${workspaceRoot}",
"outFiles": [ "${workspaceRoot}/dist/*.js" ],
"preLaunchTask": "webpack:prof",
Expand Down
22 changes: 0 additions & 22 deletions devtools/dev-server.js

This file was deleted.

30 changes: 30 additions & 0 deletions devtools/dev-server.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import fs from 'fs';
import path from 'path';

import { RemoteExtension } from 'airdcpp-extension';

import { fileURLToPath } from 'url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const extensionConfig = {
packageInfo: JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf8')),
dataPath: __dirname,
nameSuffix: '-dev',
};

import settings from './settings.mjs';

import(process.argv[2] || '../dist/main.js').then(entry => {
// See https://github.com/airdcpp-web/airdcpp-extension-js for usage information
RemoteExtension(
entry.default,
!process.env.PROFILING ? settings : {
...settings,
logLevel: 'error', // Avoid spam while profiling...
},
extensionConfig
);
})

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
// API settings
url: 'ws://localhost:5600/api/v1/',
username: 'myusername',
Expand Down
2 changes: 1 addition & 1 deletion devtools/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ webpack(webpackConfig).watch(1000, function(err, stats) {
if (!started) {
started = true;

const serverPath = path.resolve(__dirname, 'dev-server.js');
const serverPath = path.resolve(__dirname, 'dev-server.mjs');
nodemon({
execMap: {
js: 'node --inspect'
Expand Down
7 changes: 6 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
// Sync object
const config = {
transform: {
'^.+\\.ts$': 'ts-jest'
'^.+\\.ts$': 'ts-jest',
// "node_modules/node-fetch/.+\\.(j|t)sx?$": "ts-jest"
},
moduleDirectories: ['src', 'node_modules'],
testEnvironment: 'node',
moduleFileExtensions: [
'js',
'ts',
'json'
],
transformIgnorePatterns: [
'<rootDir>\/node_modules\/(?!node\\-fetch)\/'
],
moduleNameMapper: {
'(src/.*)$': '<rootDir>/$1'
},
Expand Down
Loading

0 comments on commit c554c33

Please sign in to comment.