This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-paramedic.git
The following commit(s) were added to refs/heads/master by this push:
new fb92da6 feat!: remove file-server (#284)
fb92da6 is described below
commit fb92da6fae92a8b20ba41f25e0961db38733b112
Author: エリス <[email protected]>
AuthorDate: Wed Dec 10 13:11:39 2025 +0900
feat!: remove file-server (#284)
---
lib/LocalServer.js | 44 +------------------------------------------
lib/ParamedicConfig.js | 9 ---------
lib/PluginsManager.js | 18 +-----------------
lib/paramedic.js | 13 -------------
main.js | 5 -----
paramedic-plugin/paramedic.js | 4 ----
6 files changed, 2 insertions(+), 91 deletions(-)
diff --git a/lib/LocalServer.js b/lib/LocalServer.js
index cda76ee..bfcc5ff 100644
--- a/lib/LocalServer.js
+++ b/lib/LocalServer.js
@@ -17,16 +17,13 @@
under the License.
*/
-const { spawn } = require('node:child_process');
const http = require('node:http');
const { EventEmitter } = require('node:events');
const WebSocket = require('ws');
-const Q = require('q');
const portChecker = require('tcp-port-used');
-const shell = require('shelljs');
-const { logger, execPromise, utilities } = require('./utils');
+const { logger, utilities } = require('./utils');
/**
* How long (in milliseconds) a client is allowed to go without responding
@@ -51,54 +48,15 @@ const WS_VALID_EVENTS = [
'jasmineDone'
];
-/**
- * TODO: Remove file transfer server from this repo. Should be managed by file
transfer plugin.
- */
class LocalServer extends EventEmitter {
constructor (port) {
super();
this.port = port;
- this.fileTransferServer = { alive: false };
this.httpServer = null;
this.wss = null;
}
- cleanUp () {
- logger.normal('local-server: killing local file transfer server if
it\'s up...');
- if (this.fileTransferServer.alive) {
- this.fileTransferServer.alive = false;
- this.fileTransferServer.process.kill('SIGKILL');
- }
- }
-
- startFileTransferServer (tempPath) {
- process.on('uncaughtException', () => {
- if (this.exiting) return;
- this.exiting = true;
- this.cleanUp();
- });
-
- return Q().then(() => {
- shell.pushd(tempPath);
- logger.normal('local-server: cloning file transfer server');
- return execPromise('git clone
https://github.com/apache/cordova-labs --branch cordova-filetransfer');
- }).then(() => {
- shell.pushd('cordova-labs');
- logger.normal('local-server: installing local file transfer
server');
- return execPromise('npm i');
- }).then(() => {
- logger.normal('local-server: starting local file transfer server');
- this.fileTransferServer.process = spawn('node', ['server.js']);
- this.fileTransferServer.alive = true;
-
- logger.info('local-server: local file transfer server started');
- shell.popd();
- shell.popd();
- return this.fileTransferServer;
- });
- }
-
createSocketListener () {
this.httpServer = http.createServer();
this.wss = new WebSocket.Server({ server: this.httpServer });
diff --git a/lib/ParamedicConfig.js b/lib/ParamedicConfig.js
index 78c10b5..a7bbf5f 100644
--- a/lib/ParamedicConfig.js
+++ b/lib/ParamedicConfig.js
@@ -130,14 +130,6 @@ class ParamedicConfig {
this._config.target = target;
}
- getFileTransferServer () {
- return this._config.fileTransferServer;
- }
-
- setFileTransferServer (server) {
- this._config.fileTransferServer = server;
- }
-
getCli () {
if (this._config.cli) {
return this._config.cli;
@@ -169,7 +161,6 @@ ParamedicConfig.parseFromArguments = function (argv) {
skipMainTests: argv.skipMainTests,
ci: argv.ci,
target: argv.target,
- fileTransferServer: argv.fileTransferServer,
cli: argv.cli
});
};
diff --git a/lib/PluginsManager.js b/lib/PluginsManager.js
index dd31888..490123f 100644
--- a/lib/PluginsManager.js
+++ b/lib/PluginsManager.js
@@ -21,7 +21,6 @@ const path = require('path');
const fs = require('fs');
const { logger, exec, utilities } = require('./utils');
const { PluginInfoProvider } = require('cordova-common');
-const Server = require('./LocalServer');
class PluginsManager {
constructor (appRoot, storedCWD, config) {
@@ -42,22 +41,7 @@ class PluginsManager {
installedPlugins.forEach((plugin) => {
// there is test plugin available
if (fs.existsSync(path.join(plugin.dir, 'tests', 'plugin.xml'))) {
- let additionalArgs = '';
-
- // special handling for cordova-plugin-file-transfer
- if (plugin.id.indexOf('cordova-plugin-file-transfer') >= 0) {
- if (this.config.getFileTransferServer()) {
- // user specified a file transfer server address, so
using it
- additionalArgs += ' --variable
FILETRANSFER_SERVER_ADDRESS=' + this.config.getFileTransferServer();
- } else {
- // no server address specified, starting a local server
- const server = new Server(0);
- const fileServerUrl =
`http://${server.getServerIP(this.config.getPlatformId())}:5001`;
- additionalArgs += ' --variable
FILETRANSFER_SERVER_ADDRESS=' + fileServerUrl;
- }
- }
-
- this.installSinglePlugin(path.join(plugin.dir, 'tests') +
additionalArgs);
+ this.installSinglePlugin(path.join(plugin.dir, 'tests'));
}
});
diff --git a/lib/paramedic.js b/lib/paramedic.js
index 965e247..2dfd104 100644
--- a/lib/paramedic.js
+++ b/lib/paramedic.js
@@ -190,17 +190,6 @@ class ParamedicRunner {
fs.writeFileSync(medicFilePath, medicFileContent);
}
- maybeRunFileTransferServer () {
- return Q().then(() => {
- const plugins = this.config.getPlugins();
- for (let i = 0; i < plugins.length; i++) {
- if (plugins[i].indexOf('cordova-plugin-file-transfer') >= 0 &&
!this.config.getFileTransferServer() && !this.config.isCI()) {
- return
this.server.startFileTransferServer(this.tempFolder.name);
- }
- }
- });
- }
-
runLocalTests () {
logger.warn('... locally');
logger.warn('---------------------------------------------------------');
@@ -217,7 +206,6 @@ class ParamedicRunner {
logger.info('cordova-paramedic: running tests locally');
return Q()
- .then(() => this.maybeRunFileTransferServer())
.then(() => this.getCommandForStartingTests())
.then((command) => {
this.setPermissions();
@@ -353,7 +341,6 @@ class ParamedicRunner {
}
cleanUpProject () {
- this.server && this.server.cleanUp();
if (this.config.shouldCleanUpAfterRun()) {
logger.info('cordova-paramedic: Deleting the application: ' +
this.tempFolder.name);
shell.popd();
diff --git a/main.js b/main.js
index c8ad5b7..f1a94ed 100755
--- a/main.js
+++ b/main.js
@@ -44,7 +44,6 @@ var USAGE = "Error missing args. \n" +
"--cleanUpAfterRun : (optional) cleans up the application after the run\n"
+
"--cli : (optional) A path to Cordova CLI\n" +
"--config : (optional) read configuration from paramedic configuration
file\n" +
- "--fileTransferServer : (optional) (cordova-plugin-file-transfer only) A
server address tests should connect to\n" +
"--justbuild : (optional) just builds the project, without running the
tests \n" +
"--outputDir : (optional) path to save Junit results file & Device logs\n"
+
"--skipMainTests : (optional) Do not run main (cordova-test-framework)
tests\n" +
@@ -112,10 +111,6 @@ if (argv.version) {
paramedicConfig.setTarget(argv.target);
}
- if (argv.fileTransferServer) {
- paramedicConfig.setFileTransferServer(argv.fileTransferServer);
- }
-
if (argv.cli) {
paramedicConfig.setCli(argv.cli);
}
diff --git a/paramedic-plugin/paramedic.js b/paramedic-plugin/paramedic.js
index 79bccfc..ae39108 100644
--- a/paramedic-plugin/paramedic.js
+++ b/paramedic-plugin/paramedic.js
@@ -124,10 +124,6 @@ Paramedic.prototype.loadParamedicServerUrl = function () {
return getMedicConfig().logurl;
};
-Paramedic.prototype.loadParamedicFileServerUrl = function () {
- return getMedicConfig().fileserverurl;
-};
-
cordova.paramedic = new Paramedic();
cordova.paramedic.initialize();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]