Skip to content

Commit

Permalink
v0.0.38
Browse files Browse the repository at this point in the history
  • Loading branch information
vanvianen committed Jan 5, 2024
1 parent 4d7053c commit caf84b3
Show file tree
Hide file tree
Showing 30 changed files with 1,291 additions and 124 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
0.0.36
0.0.38
13 changes: 13 additions & 0 deletions dist/js/class/CodeLinter.d.ts
@@ -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;
58 changes: 58 additions & 0 deletions dist/js/class/CodeLinter.js
@@ -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);
// });
12 changes: 12 additions & 0 deletions dist/js/class/DocumentationGenerator.d.ts
@@ -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;
67 changes: 67 additions & 0 deletions dist/js/class/DocumentationGenerator.js
@@ -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));
2 changes: 1 addition & 1 deletion dist/js/class/FontGenerator.d.ts
Expand Up @@ -12,6 +12,6 @@ declare class FontGenerator {
* @param {svgSprite.Config} customConfig - Optional custom configuration object for svg-sprite.
*/
constructor(customConfig?: any);
generateFonts(sourceDirectory: string, outputDiectory: string): Promise<void>;
generateFonts(sourceDirectory: string, outputDiectory: string, options?: {}): Promise<void>;
}
export default FontGenerator;
5 changes: 3 additions & 2 deletions dist/js/class/FontGenerator.js
Expand Up @@ -38,12 +38,13 @@ class FontGenerator {
...customConfig
};
}
async generateFonts(sourceDirectory, outputDiectory) {
async generateFonts(sourceDirectory, outputDiectory, options) {
const config = {
...this.config,
// RunnerMandatoryOptions
inputDir: sourceDirectory, // (required)
outputDir: outputDiectory
outputDir: outputDiectory, // (required)
...options
};
try {
await (0, fantasticon_1.generateFonts)(config);
Expand Down
10 changes: 10 additions & 0 deletions dist/js/class/TestRunner.d.ts
@@ -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;
62 changes: 62 additions & 0 deletions dist/js/class/TestRunner.js
@@ -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);
// });
9 changes: 9 additions & 0 deletions dist/js/class/VersionManager.d.ts
@@ -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;
68 changes: 68 additions & 0 deletions dist/js/class/VersionManager.js
@@ -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));
6 changes: 5 additions & 1 deletion dist/js/index.d.ts
Expand Up @@ -8,6 +8,7 @@ import FilenameExtractor from './class/FilenameExtractor';
import FontGenerator from './class/FontGenerator.js';
import PackageCreator from './class/PackageCreator.js';
import StyleProcessor from "./class/StyleProcessor.js";
import VersionManager from './class/VersionManager.js';
import VersionWriter from './class/VersionWriter.js';
import TypeScriptCompiler from './class/TypeScriptCompiler.js';
import JavaScriptMinifier from './class/JavaScriptMinifier.js';
Expand All @@ -18,7 +19,10 @@ import SvgReader from './class/SvgReader.js';
import SvgToPngConverter from './class/SvgToPngConverter.js';
import SvgSpriteGenerator from "./class/SvgSpriteGenerator.js";
import SvgPackager from "./class/SvgPackager.js";
import TestRunner from './class/TestRunner.js';
import DocumentationGenerator from './class/DocumentationGenerator.js';
import CodeLinter from './class/CodeLinter.js';
import gl_installer from './function/gl_installer';
import cleanDirectory from './function/clean_directory';
import readPackageJson from "./function/readPackageJson.js";
export { DirectoryScanner, DirectoryCleaner, DirectoryCopier, DirectoryCreator, FileCopier, FileRenamer, FilenameExtractor, FontGenerator, PackageCreator, StyleProcessor, VersionWriter, TypeScriptCompiler, JavaScriptMinifier, NpmCommandRunner, StylizedLogger, TemplateWriter, SvgReader, SvgToPngConverter, SvgSpriteGenerator, SvgPackager, gl_installer, cleanDirectory, readPackageJson, };
export { DirectoryScanner, DirectoryCleaner, DirectoryCopier, DirectoryCreator, FileCopier, FileRenamer, FilenameExtractor, FontGenerator, PackageCreator, StyleProcessor, VersionWriter, VersionManager, TypeScriptCompiler, JavaScriptMinifier, NpmCommandRunner, StylizedLogger, TemplateWriter, TestRunner, DocumentationGenerator, CodeLinter, SvgReader, SvgToPngConverter, SvgSpriteGenerator, SvgPackager, gl_installer, cleanDirectory, readPackageJson, };
10 changes: 9 additions & 1 deletion dist/js/index.js
Expand Up @@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.readPackageJson = exports.cleanDirectory = exports.gl_installer = exports.SvgPackager = exports.SvgSpriteGenerator = exports.SvgToPngConverter = exports.SvgReader = exports.TemplateWriter = exports.StylizedLogger = exports.NpmCommandRunner = exports.JavaScriptMinifier = exports.TypeScriptCompiler = exports.VersionWriter = exports.StyleProcessor = exports.PackageCreator = exports.FontGenerator = exports.FilenameExtractor = exports.FileRenamer = exports.FileCopier = exports.DirectoryCreator = exports.DirectoryCopier = exports.DirectoryCleaner = exports.DirectoryScanner = void 0;
exports.readPackageJson = exports.cleanDirectory = exports.gl_installer = exports.SvgPackager = exports.SvgSpriteGenerator = exports.SvgToPngConverter = exports.SvgReader = exports.CodeLinter = exports.DocumentationGenerator = exports.TestRunner = exports.TemplateWriter = exports.StylizedLogger = exports.NpmCommandRunner = exports.JavaScriptMinifier = exports.TypeScriptCompiler = exports.VersionManager = exports.VersionWriter = exports.StyleProcessor = exports.PackageCreator = exports.FontGenerator = exports.FilenameExtractor = exports.FileRenamer = exports.FileCopier = exports.DirectoryCreator = exports.DirectoryCopier = exports.DirectoryCleaner = exports.DirectoryScanner = void 0;
// 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.
Expand Down Expand Up @@ -40,6 +40,8 @@ var PackageCreator_js_1 = __importDefault(require("./class/PackageCreator.js"));
exports.PackageCreator = PackageCreator_js_1.default;
var StyleProcessor_js_1 = __importDefault(require("./class/StyleProcessor.js"));
exports.StyleProcessor = StyleProcessor_js_1.default;
var VersionManager_js_1 = __importDefault(require("./class/VersionManager.js"));
exports.VersionManager = VersionManager_js_1.default;
var VersionWriter_js_1 = __importDefault(require("./class/VersionWriter.js"));
exports.VersionWriter = VersionWriter_js_1.default;
var TypeScriptCompiler_js_1 = __importDefault(require("./class/TypeScriptCompiler.js"));
Expand All @@ -60,6 +62,12 @@ var SvgSpriteGenerator_js_1 = __importDefault(require("./class/SvgSpriteGenerato
exports.SvgSpriteGenerator = SvgSpriteGenerator_js_1.default;
var SvgPackager_js_1 = __importDefault(require("./class/SvgPackager.js"));
exports.SvgPackager = SvgPackager_js_1.default;
var TestRunner_js_1 = __importDefault(require("./class/TestRunner.js"));
exports.TestRunner = TestRunner_js_1.default;
var DocumentationGenerator_js_1 = __importDefault(require("./class/DocumentationGenerator.js"));
exports.DocumentationGenerator = DocumentationGenerator_js_1.default;
var CodeLinter_js_1 = __importDefault(require("./class/CodeLinter.js"));
exports.CodeLinter = CodeLinter_js_1.default;
// Import | Internal Functions
var gl_installer_1 = __importDefault(require("./function/gl_installer"));
exports.gl_installer = gl_installer_1.default;
Expand Down

0 comments on commit caf84b3

Please sign in to comment.