fix(format): Fixed formatting issues across multiple TypeScript files.

This commit is contained in:
Philipp Kunz 2024-06-23 22:57:09 +02:00
parent ae46afdee6
commit b797fca1fc
16 changed files with 66 additions and 39 deletions

View File

@ -1,5 +1,15 @@
# Changelog # Changelog
## 2024-06-23 - 1.9.115 - fix(format)
Fixed formatting issues across multiple TypeScript files.
- Improved code formatting in ts/00_commitinfo_data.ts
- Enhanced formatting consistency in ts/classes.gitzoneconfig.ts and ts/classes.project.ts
- Refined formatting in the gitzone SmartCLI implementation
- Updated code formatting in multiple files within the mod_format directory
- Standardized import and logging formats across project files
## 2024-06-23 - 1.9.114 - fix(mod_commit) ## 2024-06-23 - 1.9.114 - fix(mod_commit)
Remove extra new lines in changelog Remove extra new lines in changelog
@ -68,3 +78,4 @@ fix(dependencies): Updated @git.zone/tsdoc dependency version to ^1.2.2 in packa
fix(mod_commit): Fix variable reassignment issue in changelog writing step fix(mod_commit): Fix variable reassignment issue in changelog writing step
- Fixed an issue with variable reassignment in the changelog writing step. - Fixed an issue with variable reassignment in the changelog writing step.

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/cli', name: '@git.zone/cli',
version: '1.9.114', version: '1.9.115',
description: 'A CLI toolbelt to streamline local development cycles by using various gitzone utilities.' description: 'A CLI toolbelt to streamline local development cycles by using various gitzone utilities.'
} }

View File

@ -17,7 +17,7 @@ export interface IGitzoneConfigData {
license: string; license: string;
projectDomain: string; projectDomain: string;
}; };
copy: {[key: string]: string} copy: { [key: string]: string };
npmciOptions: { npmciOptions: {
npmAccessLevel: 'public' | 'private'; npmAccessLevel: 'public' | 'private';
}; };

View File

@ -1,4 +1,4 @@
import * as plugins from './plugins.js' import * as plugins from './plugins.js';
import * as paths from './paths.js'; import * as paths from './paths.js';
import { GitzoneConfig } from './classes.gitzoneconfig.js'; import { GitzoneConfig } from './classes.gitzoneconfig.js';

View File

@ -15,7 +15,7 @@ export let run = async () => {
await smartupdateInstance.check( await smartupdateInstance.check(
'gitzone', 'gitzone',
projectInfo.npm.version, projectInfo.npm.version,
'http://gitzone.gitlab.io/gitzone/changelog.html' 'http://gitzone.gitlab.io/gitzone/changelog.html',
); );
console.log('---------------------------------------------'); console.log('---------------------------------------------');
gitzoneSmartcli.addVersion(projectInfo.npm.version); gitzoneSmartcli.addVersion(projectInfo.npm.version);

View File

@ -3,4 +3,4 @@ import * as plugins from '../plugins.js';
export const run = async (projectArg: Project) => { export const run = async (projectArg: Project) => {
const gitzoneConfig = await projectArg.gitzoneConfig; const gitzoneConfig = await projectArg.gitzoneConfig;
} };

View File

@ -4,20 +4,21 @@ import { Project } from '../classes.project.js';
import { logger } from '../gitzone.logging.js'; import { logger } from '../gitzone.logging.js';
const incompatibleLicenses: string[] = [ const incompatibleLicenses: string[] = ['AGPL', 'GPL', 'SSPL'];
"AGPL",
"GPL",
"SSPL",
];
export const run = async (projectArg: Project) => { export const run = async (projectArg: Project) => {
const nodeModulesInstalled = await plugins.smartfile.fs.isDirectory(plugins.path.join(paths.cwd, 'node_modules')); const nodeModulesInstalled = await plugins.smartfile.fs.isDirectory(
plugins.path.join(paths.cwd, 'node_modules'),
);
if (!nodeModulesInstalled) { if (!nodeModulesInstalled) {
logger.log('warn', 'No node_modules found. Skipping license check'); logger.log('warn', 'No node_modules found. Skipping license check');
return; return;
} }
const licenseChecker = await plugins.smartlegal.createLicenseChecker(); const licenseChecker = await plugins.smartlegal.createLicenseChecker();
const licenseCheckResult = await licenseChecker.excludeLicenseWithinPath(paths.cwd, incompatibleLicenses); const licenseCheckResult = await licenseChecker.excludeLicenseWithinPath(
paths.cwd,
incompatibleLicenses,
);
if (licenseCheckResult.failingModules.length === 0) { if (licenseCheckResult.failingModules.length === 0) {
logger.log('info', 'Success -> licenses passed!'); logger.log('info', 'Success -> licenses passed!');
} else { } else {

View File

@ -48,7 +48,7 @@ export const run = async (projectArg: Project) => {
plugins.smartobject.smartAdd( plugins.smartobject.smartAdd(
npmextraJson.gitzone, npmextraJson.gitzone,
expectedRepoInformationItem, expectedRepoInformationItem,
cliProvidedValue cliProvidedValue,
); );
} }
} }

View File

@ -12,7 +12,7 @@ const ensureDependency = async (
packageJsonObjectArg: any, packageJsonObjectArg: any,
position: 'dep' | 'devDep' | 'everywhere', position: 'dep' | 'devDep' | 'everywhere',
constraint: 'exclude' | 'include' | 'latest', constraint: 'exclude' | 'include' | 'latest',
dependencyArg: string dependencyArg: string,
) => {}; ) => {};
export const run = async (projectArg: Project) => { export const run = async (projectArg: Project) => {
@ -26,14 +26,13 @@ export const run = async (projectArg: Project) => {
// metadata // metadata
packageJson.repository = { packageJson.repository = {
"type": "git", type: 'git',
"url": `git+https://${gitzoneData.module.githost}/${gitzoneData.module.gitscope}/${gitzoneData.module.gitrepo}.git` url: `git+https://${gitzoneData.module.githost}/${gitzoneData.module.gitscope}/${gitzoneData.module.gitrepo}.git`,
}; };
packageJson.bugs = { (packageJson.bugs = {
"url": `https://${gitzoneData.module.githost}/${gitzoneData.module.gitscope}/${gitzoneData.module.gitrepo}/issues` url: `https://${gitzoneData.module.githost}/${gitzoneData.module.gitscope}/${gitzoneData.module.gitrepo}/issues`,
}, }),
packageJson.homepage = `https://${gitzoneData.module.githost}/${gitzoneData.module.gitscope}/${gitzoneData.module.gitrepo}#readme`; (packageJson.homepage = `https://${gitzoneData.module.githost}/${gitzoneData.module.gitscope}/${gitzoneData.module.gitrepo}#readme`);
// Check for module type // Check for module type
if (!packageJson.type) { if (!packageJson.type) {

View File

@ -43,7 +43,7 @@ const prettierTypeScriptPipestop = plugins.through2.obj(
fileArg.setContentsFromString(formatedFileString); fileArg.setContentsFromString(formatedFileString);
cb(null, fileArg); cb(null, fileArg);
} }
} },
); );
export const run = async (projectArg: Project) => { export const run = async (projectArg: Project) => {

View File

@ -8,7 +8,10 @@ export const run = async () => {
// Check and initialize readme.md if it doesn't exist // Check and initialize readme.md if it doesn't exist
const readmeExists = await plugins.smartfile.fs.fileExists(readmePath); const readmeExists = await plugins.smartfile.fs.fileExists(readmePath);
if (!readmeExists) { if (!readmeExists) {
await plugins.smartfile.fs.toFs('# Project Readme\n\nThis is the initial readme file.', readmePath); await plugins.smartfile.fs.toFs(
'# Project Readme\n\nThis is the initial readme file.',
readmePath,
);
console.log('Initialized readme.md'); console.log('Initialized readme.md');
} else { } else {
console.log('readme.md already exists'); console.log('readme.md already exists');
@ -17,9 +20,12 @@ export const run = async () => {
// Check and initialize readme.hints.md if it doesn't exist // Check and initialize readme.hints.md if it doesn't exist
const readmeHintsExists = await plugins.smartfile.fs.fileExists(readmeHintsPath); const readmeHintsExists = await plugins.smartfile.fs.fileExists(readmeHintsPath);
if (!readmeHintsExists) { if (!readmeHintsExists) {
await plugins.smartfile.fs.toFs('# Project Readme Hints\n\nThis is the initial readme hints file.', readmeHintsPath); await plugins.smartfile.fs.toFs(
'# Project Readme Hints\n\nThis is the initial readme hints file.',
readmeHintsPath,
);
console.log('Initialized readme.hints.md'); console.log('Initialized readme.hints.md');
} else { } else {
console.log('readme.hints.md already exists'); console.log('readme.hints.md already exists');
} }
}; };

View File

@ -10,4 +10,14 @@ import * as smartnpm from '@push.rocks/smartnpm';
import * as smartstream from '@push.rocks/smartstream'; import * as smartstream from '@push.rocks/smartstream';
import * as through2 from 'through2'; import * as through2 from 'through2';
export { lik, smartfile, smartgulp, smartinteract, smartlegal, smartobject, smartnpm, smartstream, through2 }; export {
lik,
smartfile,
smartgulp,
smartinteract,
smartlegal,
smartobject,
smartnpm,
smartstream,
through2,
};

View File

@ -73,7 +73,7 @@ export class Meta {
// write .meta.json to disk // write .meta.json to disk
plugins.smartfile.memory.toFsSync( plugins.smartfile.memory.toFsSync(
JSON.stringify(this.metaRepoData, null, 2), JSON.stringify(this.metaRepoData, null, 2),
this.filePaths.metaJson this.filePaths.metaJson,
); );
// write .gitignore to disk // write .gitignore to disk
plugins.smartfile.memory.toFsSync(await this.generateGitignore(), this.filePaths.gitIgnore); plugins.smartfile.memory.toFsSync(await this.generateGitignore(), this.filePaths.gitIgnore);
@ -104,12 +104,12 @@ export class Meta {
if ( if (
preExistingFolderArg !== '.git' && preExistingFolderArg !== '.git' &&
!Object.keys(projects).find((projectFolder) => !Object.keys(projects).find((projectFolder) =>
projectFolder.startsWith(preExistingFolderArg) projectFolder.startsWith(preExistingFolderArg),
) )
) { ) {
const response = await plugins.smartinteraction.SmartInteract.getCliConfirmation( const response = await plugins.smartinteraction.SmartInteract.getCliConfirmation(
`Do you want to delete superfluous directory >>${preExistingFolderArg}<< ?`, `Do you want to delete superfluous directory >>${preExistingFolderArg}<< ?`,
true true,
); );
if (response) { if (response) {
logger.log('warn', `Deleting >>${preExistingFolderArg}<<!`); logger.log('warn', `Deleting >>${preExistingFolderArg}<<!`);
@ -131,7 +131,7 @@ export class Meta {
logger.log('info', `found ${missingRepos.length} missing repos`); logger.log('info', `found ${missingRepos.length} missing repos`);
for (const missingRepo of missingRepos) { for (const missingRepo of missingRepos) {
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`cd ${this.cwd} && git clone ${this.metaRepoData.projects[missingRepo]} ${missingRepo}` `cd ${this.cwd} && git clone ${this.metaRepoData.projects[missingRepo]} ${missingRepo}`,
); );
} }
@ -140,7 +140,7 @@ export class Meta {
logger.log('info', `persist changes with a git commit`); logger.log('info', `persist changes with a git commit`);
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`cd ${this.cwd} && git add -A && git commit -m "updated structure"` `cd ${this.cwd} && git add -A && git commit -m "updated structure"`,
); );
await this.syncToRemote(); await this.syncToRemote();
@ -166,7 +166,7 @@ export class Meta {
JSON.stringify({ JSON.stringify({
projects: {}, projects: {},
}), }),
this.filePaths.metaJson this.filePaths.metaJson,
); );
logger.log(`success`, `created a new .meta.json in directory ${this.cwd}`); logger.log(`success`, `created a new .meta.json in directory ${this.cwd}`);
await plugins.smartfile.memory.toFs( await plugins.smartfile.memory.toFs(
@ -174,14 +174,14 @@ export class Meta {
name: this.dirName, name: this.dirName,
version: '1.0.0', version: '1.0.0',
}), }),
this.filePaths.packageJson this.filePaths.packageJson,
); );
logger.log(`success`, `created a new package.json in directory ${this.cwd}`); logger.log(`success`, `created a new package.json in directory ${this.cwd}`);
} else { } else {
logger.log(`error`, `directory ${this.cwd} already has a .metaJson file. Doing nothing.`); logger.log(`error`, `directory ${this.cwd} already has a .metaJson file. Doing nothing.`);
} }
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`cd ${this.cwd} && git add -A && git commit -m "feat(project): init meta project for ${this.dirName}"` `cd ${this.cwd} && git add -A && git commit -m "feat(project): init meta project for ${this.dirName}"`,
); );
await this.updateLocalRepos(); await this.updateLocalRepos();
} }
@ -203,7 +203,7 @@ export class Meta {
await this.sortMetaRepoData(); await this.sortMetaRepoData();
await this.writeToDisk(); await this.writeToDisk();
await this.smartshellInstance.exec( await this.smartshellInstance.exec(
`cd ${this.cwd} && git add -A && git commit -m "feat(project): add ${projectNameArg}"` `cd ${this.cwd} && git add -A && git commit -m "feat(project): add ${projectNameArg}"`,
); );
await this.updateLocalRepos(); await this.updateLocalRepos();
} }

View File

@ -5,11 +5,11 @@ export let run = (argvArg) => {
let projectInfo = new plugins.projectinfo.ProjectInfo(paths.cwd); let projectInfo = new plugins.projectinfo.ProjectInfo(paths.cwd);
if (argvArg._[1] === 'ci') { if (argvArg._[1] === 'ci') {
plugins.smartopen.openUrl( plugins.smartopen.openUrl(
`https://gitlab.com/${projectInfo.git.gituser}/${projectInfo.git.gitrepo}/settings/ci_cd` `https://gitlab.com/${projectInfo.git.gituser}/${projectInfo.git.gitrepo}/settings/ci_cd`,
); );
} else if (argvArg._[1] === 'pipelines') { } else if (argvArg._[1] === 'pipelines') {
plugins.smartopen.openUrl( plugins.smartopen.openUrl(
`https://gitlab.com/${projectInfo.git.gituser}/${projectInfo.git.gitrepo}/pipelines` `https://gitlab.com/${projectInfo.git.gituser}/${projectInfo.git.gitrepo}/pipelines`,
); );
} }
}; };

View File

@ -22,7 +22,7 @@ export let run = () => {
return projects; return projects;
})()} })()}
* format a project with 'gitzone format' * format a project with 'gitzone format'
` `,
); );
done.resolve(); done.resolve();
return done.promise; return done.promise;

View File

@ -2,7 +2,7 @@ import * as plugins from './plugins.js';
export let packageDir = plugins.path.join( export let packageDir = plugins.path.join(
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../' '../',
); );
export let assetsDir = plugins.path.join(packageDir, './assets'); export let assetsDir = plugins.path.join(packageDir, './assets');
export let templatesDir = plugins.path.join(assetsDir, 'templates'); export let templatesDir = plugins.path.join(assetsDir, 'templates');