-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
1,291 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.0.36 | ||
0.0.38 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { ESLint } from 'eslint'; | ||
declare class CodeLinter { | ||
private eslint; | ||
private projectRoot; | ||
constructor(projectRoot: string); | ||
/** | ||
* Runs ESLint on the specified files or directories. | ||
* @param targetFiles Array of file or directory paths to lint. | ||
* @returns A promise that resolves with the linting results. | ||
*/ | ||
lintFiles(targetFiles: string[]): Promise<ESLint.LintResult[]>; | ||
} | ||
export default CodeLinter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"use strict"; | ||
// class/CodeLinter.ts | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Copyright 2023 Scape Agency BV | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ============================================================================ | ||
// Import | ||
// ============================================================================ | ||
var eslint_1 = require("eslint"); | ||
// ============================================================================ | ||
// Classes | ||
// ============================================================================ | ||
class CodeLinter { | ||
constructor(projectRoot) { | ||
this.projectRoot = projectRoot; | ||
this.eslint = new eslint_1.ESLint({ cwd: projectRoot }); | ||
} | ||
/** | ||
* Runs ESLint on the specified files or directories. | ||
* @param targetFiles Array of file or directory paths to lint. | ||
* @returns A promise that resolves with the linting results. | ||
*/ | ||
async lintFiles(targetFiles) { | ||
try { | ||
const results = await this.eslint.lintFiles(targetFiles); | ||
await eslint_1.ESLint.outputFixes(results); | ||
const formatter = await this.eslint.loadFormatter('stylish'); | ||
const resultText = formatter.format(results); | ||
console.log(resultText); | ||
return results; | ||
} | ||
catch (error) { | ||
console.error('Error occurred while linting:', error); | ||
throw error; | ||
} | ||
} | ||
} | ||
// ============================================================================ | ||
// Export | ||
// ============================================================================ | ||
exports.default = CodeLinter; | ||
// import CodeLinter from './CodeLinter'; | ||
// const linter = new CodeLinter(process.cwd()); | ||
// linter.lintFiles(['src/**/*.ts']) | ||
// .then(results => { | ||
// console.log('Linting completed. Results:', results); | ||
// }) | ||
// .catch(error => { | ||
// console.error('Linting error:', error); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare class DocumentationGenerator { | ||
private sourcePath; | ||
private outputPath; | ||
private generatorCommand; | ||
constructor(sourcePath: string, outputPath: string, generatorCommand: string); | ||
/** | ||
* Generates documentation based on the provided configuration. | ||
* @returns A promise that resolves when the documentation generation is complete. | ||
*/ | ||
generate(): Promise<void>; | ||
} | ||
export default DocumentationGenerator; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"use strict"; | ||
// class/DocumentationGenerator.ts | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Copyright 2023 Scape Agency BV | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ============================================================================ | ||
// Import | ||
// ============================================================================ | ||
var child_process_1 = require("child_process"); | ||
var util_1 = __importDefault(require("util")); | ||
const execAsync = util_1.default.promisify(child_process_1.exec); | ||
// ============================================================================ | ||
// Classes | ||
// ============================================================================ | ||
class DocumentationGenerator { | ||
constructor(sourcePath, outputPath, generatorCommand) { | ||
this.sourcePath = sourcePath; | ||
this.outputPath = outputPath; | ||
this.generatorCommand = generatorCommand; | ||
} | ||
/** | ||
* Generates documentation based on the provided configuration. | ||
* @returns A promise that resolves when the documentation generation is complete. | ||
*/ | ||
async generate() { | ||
try { | ||
// Here, you can add any pre-generation logic if necessary | ||
// Execute the documentation generation command | ||
const { stdout, stderr } = await execAsync(`${this.generatorCommand} -c ${this.sourcePath} -o ${this.outputPath}`); | ||
if (stderr) { | ||
throw new Error(`Documentation generation failed: ${stderr}`); | ||
} | ||
console.log(stdout); | ||
console.log('Documentation generated successfully.'); | ||
// Here, you can add any post-generation logic if necessary | ||
} | ||
catch (error) { | ||
console.error('Error occurred while generating documentation:', error); | ||
throw error; | ||
} | ||
} | ||
} | ||
// ============================================================================ | ||
// Export | ||
// ============================================================================ | ||
exports.default = DocumentationGenerator; | ||
// Usage Example | ||
// To use the DocumentationGenerator class, you would instantiate it with the path to your source files, the output directory for the documentation, and the command for your documentation tool. For instance, using JSDoc: | ||
// import DocumentationGenerator from './DocumentationGenerator'; | ||
// const sourcePath = './src'; | ||
// const outputPath = './docs'; | ||
// const generatorCommand = 'jsdoc'; // Ensure JSDoc is installed and available in your environment | ||
// const docGenerator = new DocumentationGenerator(sourcePath, outputPath, generatorCommand); | ||
// docGenerator.generate() | ||
// .then(() => console.log('Documentation generation completed.')) | ||
// .catch(error => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
declare class TestRunner { | ||
private testCommand; | ||
constructor(testCommand: string); | ||
/** | ||
* Runs the tests using the specified test command. | ||
* @returns A promise that resolves with the test results. | ||
*/ | ||
runTests(): Promise<string>; | ||
} | ||
export default TestRunner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"use strict"; | ||
// class/TestRunner.ts | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Copyright 2023 Scape Agency BV | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ============================================================================ | ||
// Import | ||
// ============================================================================ | ||
var child_process_1 = require("child_process"); | ||
var util_1 = __importDefault(require("util")); | ||
const execAsync = util_1.default.promisify(child_process_1.exec); | ||
// ============================================================================ | ||
// Classes | ||
// ============================================================================ | ||
class TestRunner { | ||
constructor(testCommand) { | ||
this.testCommand = testCommand; | ||
} | ||
/** | ||
* Runs the tests using the specified test command. | ||
* @returns A promise that resolves with the test results. | ||
*/ | ||
async runTests() { | ||
try { | ||
const { stdout, stderr } = await execAsync(this.testCommand); | ||
if (stderr) { | ||
throw new Error(stderr); | ||
} | ||
return stdout; | ||
} | ||
catch (error) { | ||
console.error('Error occurred while running tests:', error); | ||
throw error; | ||
} | ||
} | ||
} | ||
// ============================================================================ | ||
// Export | ||
// ============================================================================ | ||
exports.default = TestRunner; | ||
// Usage Example | ||
// Here's an example of how you might use the TestRunner class in a project: | ||
// import TestRunner from './TestRunner'; | ||
// const runner = new TestRunner('npm test'); // Replace 'npm test' with your actual test command | ||
// runner.runTests() | ||
// .then(results => { | ||
// console.log('Test Results:', results); | ||
// }) | ||
// .catch(error => { | ||
// console.error('Test Runner Error:', error); | ||
// }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import semver from 'semver'; | ||
declare class VersionManager { | ||
private currentVersion; | ||
constructor(currentVersion: string); | ||
updateVersion(releaseType: semver.ReleaseType): Promise<string>; | ||
generateChangelog(): Promise<void>; | ||
createGitTag(): Promise<void>; | ||
} | ||
export default VersionManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
"use strict"; | ||
// class/VersionManager.ts | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Copyright 2023 Scape Agency BV | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ============================================================================ | ||
// Import | ||
// ============================================================================ | ||
var semver_1 = __importDefault(require("semver")); | ||
var child_process_1 = require("child_process"); | ||
var util_1 = __importDefault(require("util")); | ||
const execAsync = util_1.default.promisify(child_process_1.exec); | ||
// ============================================================================ | ||
// Classes | ||
// ============================================================================ | ||
class VersionManager { | ||
constructor(currentVersion) { | ||
if (!semver_1.default.valid(currentVersion)) { | ||
throw new Error('Invalid initial version'); | ||
} | ||
this.currentVersion = currentVersion; | ||
} | ||
async updateVersion(releaseType) { | ||
const newVersion = semver_1.default.inc(this.currentVersion, releaseType); | ||
if (!newVersion) { | ||
throw new Error('Version increment failed'); | ||
} | ||
this.currentVersion = newVersion; | ||
return newVersion; | ||
} | ||
async generateChangelog() { | ||
// Implement changelog generation logic | ||
// This could be as simple as running a script or using a tool like 'conventional-changelog' | ||
console.log('Changelog generation logic goes here'); | ||
} | ||
async createGitTag() { | ||
try { | ||
await execAsync(`git tag v${this.currentVersion}`); | ||
await execAsync('git push --tags'); | ||
console.log(`Tag v${this.currentVersion} created and pushed`); | ||
} | ||
catch (error) { | ||
console.error('Error creating Git tag:', error); | ||
throw error; | ||
} | ||
} | ||
} | ||
exports.default = VersionManager; | ||
// import VersionManager from './VersionManager'; | ||
// const versionManager = new VersionManager('1.0.0'); // Replace '1.0.0' with the current version of your package | ||
// versionManager.updateVersion('minor') // 'major', 'minor', or 'patch' | ||
// .then(newVersion => { | ||
// console.log(`Version updated to: ${newVersion}`); | ||
// return versionManager.generateChangelog(); | ||
// }) | ||
// .then(() => versionManager.createGitTag()) | ||
// .catch(error => console.error(error)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.