@dodona/dolos
Advanced tools
Comparing version 1.4.0 to 1.5.0
#!/usr/bin/env node | ||
export { FileView } from "./cli/views/fileView"; | ||
export {}; | ||
//# sourceMappingURL=cli.d.ts.map |
@@ -23,3 +23,2 @@ #!/usr/bin/env node | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FileView = void 0; | ||
const Utils = __importStar(require("./lib/util/utils")); | ||
@@ -30,4 +29,2 @@ const commander_1 = require("commander"); | ||
const path = __importStar(require("path")); | ||
var fileView_1 = require("./cli/views/fileView"); | ||
Object.defineProperty(exports, "FileView", { enumerable: true, get: function () { return fileView_1.FileView; } }); | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
@@ -34,0 +31,0 @@ const pkg = require("../package.json"); |
@@ -9,2 +9,3 @@ import { Command } from "commander"; | ||
port: number; | ||
host: string; | ||
outputFormat: string; | ||
@@ -11,0 +12,0 @@ outputDestination: string; |
@@ -24,2 +24,3 @@ "use strict"; | ||
const utils_1 = require("../../lib/util/utils"); | ||
const server_1 = require("../server"); | ||
const terminalView_1 = require("../views/terminalView"); | ||
@@ -60,3 +61,4 @@ const fileView_1 = require("../views/fileView"); | ||
"terminal/console, csv, html/web.", "terminal"), "terminal") | ||
.option("-p, --port <port>", Utils.indent("Specifies on which port --output-format=web should be served.", "3000"), "3000") | ||
.option("-p, --port <port>", Utils.indent("Specifies on which port the webserver should be served.", server_1.DEFAULT_PORT), x => parseInt(x)) | ||
.option("-H, --host <host>", Utils.indent("Specifies on which host --output-format=web should be served.", server_1.DEFAULT_HOST)) | ||
.option("-o, --output-destination <path>", Utils.indent("Path where to write the output report to. " + | ||
@@ -63,0 +65,0 @@ "This has no effect when the output format is set to 'terminal'.")) |
@@ -5,3 +5,4 @@ import { Command } from "commander"; | ||
open: boolean; | ||
port: number; | ||
port?: number; | ||
host?: string; | ||
verbose: boolean; | ||
@@ -8,0 +9,0 @@ } |
@@ -34,3 +34,4 @@ "use strict"; | ||
.option("--no-open", Utils.indent("Do not open the web page in your browser once it is ready.")) | ||
.option("-p --port <port>", Utils.indent("TCP port to host the webserver on."), x => parseInt(x), server_1.DEFAULT_PORT) | ||
.option("-p --port <port>", Utils.indent("Specifies on which port the webserver should be served.", server_1.DEFAULT_PORT), x => parseInt(x)) | ||
.option("-H --host <host>", Utils.indent("Specifies on which host the webserver should be served.", server_1.DEFAULT_HOST)) | ||
.action((reportDir, options) => serve(reportDir, { ...options, ...program.opts() })); | ||
@@ -37,0 +38,0 @@ } |
export declare const DEFAULT_PORT = 3000; | ||
export declare const DEFAULT_HOST = "localhost"; | ||
export interface Options { | ||
port?: number; | ||
host?: string; | ||
open?: boolean; | ||
@@ -5,0 +7,0 @@ } |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DEFAULT_PORT = void 0; | ||
exports.DEFAULT_HOST = exports.DEFAULT_PORT = void 0; | ||
const utils_1 = require("../lib/util/utils"); | ||
@@ -27,4 +27,6 @@ const express_1 = __importDefault(require("express")); | ||
exports.DEFAULT_PORT = 3000; | ||
exports.DEFAULT_HOST = "localhost"; | ||
async function runServer(reportDir, options) { | ||
const port = options.port || exports.DEFAULT_PORT; | ||
const host = options.host || exports.DEFAULT_HOST; | ||
const openInBrowser = options.open == undefined ? true : options.open; | ||
@@ -43,4 +45,4 @@ const app = (0, express_1.default)(); | ||
}); | ||
server.listen(port, "localhost"); | ||
const url = `http://localhost:${port}`; | ||
server.listen(port, host); | ||
const url = `http://${host}:${port}`; | ||
await serverStarted; | ||
@@ -47,0 +49,0 @@ console.log(`Dolos is available on ${url}`); |
@@ -19,5 +19,5 @@ /// <reference types="node" /> | ||
writeMetadata(out: Writable): void; | ||
writeToDirectory(): Promise<string>; | ||
writeToDirectory(writeFragments?: boolean): Promise<string>; | ||
show(): Promise<void>; | ||
} | ||
//# sourceMappingURL=fileView.d.ts.map |
@@ -84,3 +84,4 @@ "use strict"; | ||
"content": f => f.content, | ||
"ast": f => f.ast.join(" "), | ||
"ast": f => JSON.stringify(f.ast), | ||
"mapping": f => JSON.stringify(f.mapping), | ||
"extra": f => JSON.stringify(f.extra) | ||
@@ -94,5 +95,6 @@ }); | ||
"value": ([, v]) => v, | ||
"type": ([, v]) => typeof v | ||
}); | ||
} | ||
async writeToDirectory() { | ||
async writeToDirectory(writeFragments = false) { | ||
const dirName = this.outputDestination; | ||
@@ -105,10 +107,12 @@ await fs_1.promises.mkdir(dirName, { recursive: true }); | ||
console.log("Pairs written."); | ||
await fs_1.promises.mkdir(`${dirName}/fragments`); | ||
for (const pair of this.report.scoredPairs) { | ||
const id = pair.pair.id; | ||
const file = await fs_1.promises.open(`${dirName}/fragments/${id}.json`, "w"); | ||
await this.writeFragments(file, pair.pair); | ||
await file.close(); | ||
if (writeFragments) { | ||
await fs_1.promises.mkdir(`${dirName}/fragments`); | ||
for (const pair of this.report.scoredPairs) { | ||
const id = pair.pair.id; | ||
const file = await fs_1.promises.open(`${dirName}/fragments/${id}.json`, "w"); | ||
await this.writeFragments(file, pair.pair); | ||
await file.close(); | ||
} | ||
console.log("Fragments written"); | ||
} | ||
console.log("Fragments written"); | ||
this.writekgrams((0, fs_1.createWriteStream)(`${dirName}/kgrams.csv`)); | ||
@@ -122,3 +126,3 @@ console.log("kgrams written."); | ||
async show() { | ||
await this.writeToDirectory(); | ||
await this.writeToDirectory(true); | ||
} | ||
@@ -125,0 +129,0 @@ } |
{ | ||
"name": "@dodona/dolos", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Code similarity detection based on the Winnowing algorithm", | ||
"main": "dist/cli.js", | ||
"main": "dist/index.js", | ||
"bin": { | ||
@@ -39,6 +39,7 @@ "dolos": "dist/cli.js" | ||
"ts-node": "^10.2.1", | ||
"typescript": "^4.3.2" | ||
"typescript": "^4.5.5" | ||
}, | ||
"dependencies": { | ||
"@dodona/dolos-lib": "1.4.0", | ||
"@dodona/dolos-lib": "1.5.0", | ||
"@dodona/dolos-web": "1.5.0", | ||
"chalk": "^4.1.1", | ||
@@ -59,5 +60,2 @@ "cliui": "^7.0.4", | ||
}, | ||
"optionalDependencies": { | ||
"@dodona/dolos-web": "1.4.0" | ||
}, | ||
"bugs": { | ||
@@ -64,0 +62,0 @@ "url": "https://github.com/dodona-edu/dolos/issues" |
@@ -35,3 +35,3 @@ # Dolos | ||
The analysis results are available in machine readable CSV files and Dolos can be integrated as a | ||
[JavaScript library](https://www.npmjs.com/package/@dodona/dolos) in other applications empowering | ||
[JavaScript library](https://www.npmjs.com/package/@dodona/dolos-lib) in other applications empowering | ||
users to integrate plagiarism detection in their personal workflow. | ||
@@ -38,0 +38,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
43324
23
887
1
+ Added@dodona/dolos-web@1.5.0
+ Added@dodona/dolos-lib@1.5.0(transitive)
+ Added@dodona/dolos-web@1.5.0(transitive)
- Removed@dodona/dolos-lib@1.4.0(transitive)
- Removed@dodona/dolos-web@1.4.0(transitive)
Updated@dodona/dolos-lib@1.5.0