@qualified/ccc-files
Advanced tools
Comparing version 0.1.0 to 0.2.0
@@ -1,3 +0,3 @@ | ||
import { ClassicCodeChallengeInput, FileWithSource } from "./types"; | ||
export declare const toFiles: (input: ClassicCodeChallengeInput) => FileWithSource[]; | ||
import { ClassicCodeChallenge, FileWithSource } from "./types"; | ||
export declare const toFiles: (ccc: ClassicCodeChallenge) => FileWithSource[]; | ||
//# sourceMappingURL=facade.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.toFiles = void 0; | ||
const csharp_1 = require("./csharp"); | ||
const dart_1 = require("./dart"); | ||
const java_1 = require("./java"); | ||
const javascript_1 = require("./javascript"); | ||
const python_1 = require("./python"); | ||
const ruby_1 = require("./ruby"); | ||
const typescript_1 = require("./typescript"); | ||
const mappers = { | ||
csharp: csharp_1.toFiles, | ||
dart: dart_1.toFiles, | ||
java: java_1.toFiles, | ||
javascript: javascript_1.toFiles, | ||
python: python_1.toFiles, | ||
ruby: ruby_1.toFiles, | ||
typescript: typescript_1.toFiles, | ||
}; | ||
const toFiles = (input) => { | ||
const language = input.language; | ||
const toFiles = (ccc) => { | ||
const language = ccc.language; | ||
if (!mappers.hasOwnProperty(language)) { | ||
throw new Error("Unknown language: " + language); | ||
} | ||
return mappers[language](input); | ||
return mappers[language](ccc); | ||
}; | ||
exports.toFiles = toFiles; | ||
//# sourceMappingURL=facade.js.map |
@@ -1,3 +0,3 @@ | ||
export { ClassicCodeChallengeInput, ClassicCodeChallengeLanguageInput, FileWithSource, } from "./types"; | ||
export { ClassicCodeChallenge, FileWithSource } from "./types"; | ||
export { toFiles } from "./facade"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,4 @@ | ||
export { toFiles } from "./junit"; | ||
export { toFiles } from "./facade"; | ||
export { getClassName } from "./utils"; | ||
export { toFiles as junit } from "./junit"; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getClassName = exports.toFiles = void 0; | ||
var junit_1 = require("./junit"); | ||
Object.defineProperty(exports, "toFiles", { enumerable: true, get: function () { return junit_1.toFiles; } }); | ||
exports.junit = exports.getClassName = exports.toFiles = void 0; | ||
var facade_1 = require("./facade"); | ||
Object.defineProperty(exports, "toFiles", { enumerable: true, get: function () { return facade_1.toFiles; } }); | ||
var utils_1 = require("./utils"); | ||
Object.defineProperty(exports, "getClassName", { enumerable: true, get: function () { return utils_1.getClassName; } }); | ||
var junit_1 = require("./junit"); | ||
Object.defineProperty(exports, "junit", { enumerable: true, get: function () { return junit_1.toFiles; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -1,3 +0,3 @@ | ||
import { ClassicCodeChallengeLanguageInput, FileWithSource } from "../types"; | ||
export declare const toFiles: ({ solution, tests: tests, preloaded: preloaded, }: ClassicCodeChallengeLanguageInput) => FileWithSource[]; | ||
import { ClassicCodeChallenge, FileWithSource } from "../types"; | ||
export declare const toFiles: ({ solution, tests, preloaded, }: Omit<ClassicCodeChallenge, "language" | "testFramework">) => FileWithSource[]; | ||
//# sourceMappingURL=junit.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
const getPath = (code) => (0, utils_1.getClassName)(code).replace(/\./g, "/"); | ||
const toFiles = ({ solution, tests: tests, preloaded: preloaded, }) => { | ||
const toFiles = ({ solution, tests, preloaded, }) => { | ||
const testsPath = getPath(tests); | ||
@@ -9,0 +9,0 @@ const solutionPath = getPath(solution); |
export declare type FileWithSource = { | ||
path: string; | ||
contents: string; | ||
source: "solution" | "tests" | "preloaded"; | ||
source: "solution" | "tests" | "preloaded" | "generated"; | ||
}; | ||
export declare type ClassicCodeChallengeInput = { | ||
export declare type ClassicCodeChallenge = { | ||
preloaded?: string; | ||
@@ -13,5 +13,4 @@ solution: string; | ||
testFramework: string; | ||
preset?: string; | ||
}; | ||
/** Input type for language specific mappers. */ | ||
export declare type ClassicCodeChallengeLanguageInput = Omit<ClassicCodeChallengeInput, "language">; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@qualified/ccc-files", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Provides a function to map ClassicCodeChallenge fields to files", | ||
@@ -34,3 +34,3 @@ "author": "kazk", | ||
}, | ||
"readme": "# @qualified/ccc-files\n\nProvides a function to map ClassicCodeChallenge fields to files.\n\n```typescript\ntype FileWithSource = {\n path: string;\n contents: string;\n source: \"solution\" | \"tests\" | \"preloaded\";\n};\n\ntype ClassicCodeChallengeInput = {\n preloaded?: string;\n solution: string;\n tests: string;\n language: string;\n languageVersion?: string;\n testFramework: string;\n};\n\nconst toFiles: (input: ClassicCodeChallengeInput) => FileWithSource[];\n```\n\n## Supported Languages\n\n- Java\n\n## Usage\n\n```typescript\nimport { toFiles } from \"@qualified/ccc-files\";\n\nconst preloaded = `\npackage example;\n\npublic class Preloaded {}\n`;\nconst solution = `\npackage example;\n\npublic class Example {}\n`;\nconst tests = `\npackage example;\n\nclass ExampleTests {}\n`;\n\ntoFiles({\n preloaded,\n solution,\n tests,\n language: \"java\",\n languageVersion: \"17\",\n testFramework: \"junit\",\n});\n```\n\n```javascript\n[\n {\n path: \"src/test/java/example/ExampleTests.java\",\n contents: \"...\",\n source: \"tests\",\n },\n {\n path: \"src/main/java/example/Example.java\",\n contents: \"...\",\n source: \"solution\",\n },\n {\n path: \"src/main/java/example/Preloaded.java\",\n contents: \"...\",\n source: \"preloaded\",\n },\n];\n```\n" | ||
"readme": "# @qualified/ccc-files\n\nProvides a function to map ClassicCodeChallenge fields to files.\n\n```typescript\ntype FileWithSource = {\n path: string;\n contents: string;\n source: \"solution\" | \"tests\" | \"preloaded\" | \"generated\";\n};\n\ntype ClassicCodeChallenge = {\n preloaded?: string;\n solution: string;\n tests: string;\n language: string;\n languageVersion?: string;\n testFramework: string;\n preset?: string;\n};\n\nconst toFiles: (ccc: ClassicCodeChallenge) => FileWithSource[];\n```\n\n## Supported Languages\n\n- C#\n- Dart\n- Java\n- JavaScript\n- Python\n- Ruby\n- TypeScript\n\n## Usage\n\n```typescript\nimport { toFiles } from \"@qualified/ccc-files\";\n\nconst preloaded = `\npackage example;\n\npublic class Preloaded {}\n`;\nconst solution = `\npackage example;\n\npublic class Example {}\n`;\nconst tests = `\npackage example;\n\nclass ExampleTests {}\n`;\n\ntoFiles({\n preloaded,\n solution,\n tests,\n language: \"java\",\n languageVersion: \"17\",\n testFramework: \"junit\",\n});\n```\n\n```javascript\n[\n {\n path: \"src/test/java/example/ExampleTests.java\",\n contents: \"...\",\n source: \"tests\",\n },\n {\n path: \"src/main/java/example/Example.java\",\n contents: \"...\",\n source: \"solution\",\n },\n {\n path: \"src/main/java/example/Preloaded.java\",\n contents: \"...\",\n source: \"preloaded\",\n },\n];\n```\n" | ||
} |
@@ -9,6 +9,6 @@ # @qualified/ccc-files | ||
contents: string; | ||
source: "solution" | "tests" | "preloaded"; | ||
source: "solution" | "tests" | "preloaded" | "generated"; | ||
}; | ||
type ClassicCodeChallengeInput = { | ||
type ClassicCodeChallenge = { | ||
preloaded?: string; | ||
@@ -20,5 +20,6 @@ solution: string; | ||
testFramework: string; | ||
preset?: string; | ||
}; | ||
const toFiles: (input: ClassicCodeChallengeInput) => FileWithSource[]; | ||
const toFiles: (ccc: ClassicCodeChallenge) => FileWithSource[]; | ||
``` | ||
@@ -28,3 +29,9 @@ | ||
- C# | ||
- Dart | ||
- Java | ||
- JavaScript | ||
- Python | ||
- Ruby | ||
- TypeScript | ||
@@ -31,0 +38,0 @@ ## Usage |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
37747
84
496
85
1