diff --git a/changelog.md b/changelog.md index 4ab1b41..c5866c0 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,12 @@ # Changelog +## 2024-11-05 - 1.7.2 - fix(project) +Fixed minor formatting issues and improved code consistency. + +- Added missing semicolons for consistency +- Improved indentation in various files for better readability +- Corrected usage of newlines and whitespace across the codebase + ## 2024-11-05 - 1.7.1 - fix(core) Implement error handling for missing publish module directories diff --git a/package.json b/package.json index 18132fc..0309a56 100644 --- a/package.json +++ b/package.json @@ -68,4 +68,4 @@ "module-management", "developer-tools" ] -} +} \ No newline at end of file diff --git a/readme.md b/readme.md index cdb1d84..4f9223a 100644 --- a/readme.md +++ b/readme.md @@ -172,11 +172,13 @@ Follow these steps: ```typescript import { runCli } from '@git.zone/tspublish'; -runCli().then(() => { - console.log('Publishing completed successfully'); -}).catch((error) => { - console.error('Error during publishing:', error); -}); +runCli() + .then(() => { + console.log('Publishing completed successfully'); + }) + .catch((error) => { + console.error('Error during publishing:', error); + }); ``` 3. Execute your CLI script: @@ -188,4 +190,4 @@ node publish.js Your script will call `runCli`, which will traverse each `ts-package`, verify their publish readiness, and handle individual publishing processes. By following these comprehensive guidelines and utilizing the structured approach provided by `@git.zone/tspublish`, you can efficiently manage and publish multiple sub-packages from within a monorepo, facilitating organized, modular package management in projects of any scale. -undefined \ No newline at end of file +undefined diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 2e4d86b..18093cf 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tspublish', - version: '1.7.1', + version: '1.7.2', description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.' } diff --git a/ts/classes.publishmodule.ts b/ts/classes.publishmodule.ts index 8e1d9c1..5187d07 100644 --- a/ts/classes.publishmodule.ts +++ b/ts/classes.publishmodule.ts @@ -28,7 +28,7 @@ export class PublishModule { public async init() { this.options.packageSubFolderFullPath = plugins.path.join( this.options.monoRepoDir, - this.options.packageSubFolder + this.options.packageSubFolder, ); // check requirements @@ -36,10 +36,12 @@ export class PublishModule { throw new Error('subFolder must start with "ts"'); } this.options.tsPublishJson = plugins.smartfile.fs.toObjectSync( - plugins.path.join(this.options.packageSubFolderFullPath, 'tspublish.json') + plugins.path.join(this.options.packageSubFolderFullPath, 'tspublish.json'), ); const monoRepoPackageJson = JSON.parse( - plugins.smartfile.fs.toStringSync(plugins.path.join(this.options.monoRepoDir, 'package.json')) + plugins.smartfile.fs.toStringSync( + plugins.path.join(this.options.monoRepoDir, 'package.json'), + ), ); this.options.dependencies = { ...this.options.dependencies, @@ -67,7 +69,10 @@ export class PublishModule { const availableVersions = packageInfo.allVersions.map((versionArg) => versionArg.version); logger.log('info', `available versions are: ${availableVersions.toString()}`); if (availableVersions.includes(this.options.version)) { - logger.log('error', `package ${this.options.name} already exists with version ${this.options.version}`); + logger.log( + 'error', + `package ${this.options.name} already exists with version ${this.options.version}`, + ); process.exit(1); } } @@ -84,11 +89,12 @@ export class PublishModule { public async createTsconfigJson() { const originalTsConfig = plugins.smartfile.fs.toObjectSync( - plugins.path.join(paths.cwd, 'tsconfig.json') + plugins.path.join(paths.cwd, 'tsconfig.json'), ); if (originalTsConfig?.compilerOptions?.paths) { for (const path of Object.keys(originalTsConfig.compilerOptions.paths)) { - originalTsConfig.compilerOptions.paths[path][0] = `.${originalTsConfig.compilerOptions.paths[path][0]}`; + originalTsConfig.compilerOptions.paths[path][0] = + `.${originalTsConfig.compilerOptions.paths[path][0]}`; } } const tsconfigJson = { @@ -102,9 +108,7 @@ export class PublishModule { verbatimModuleSyntax: true, paths: originalTsConfig?.compilerOptions?.paths, }, - exclude: [ - 'dist_*/**/*.d.ts', - ], + exclude: ['dist_*/**/*.d.ts'], }; return JSON.stringify(tsconfigJson, null, 2); } @@ -146,7 +150,7 @@ export class PublishModule { public async createPublishModuleDir() { this.options.publishModDirFullPath = plugins.path.join( this.options.monoRepoDir, - `dist_publish_${this.options.packageSubFolder}` + `dist_publish_${this.options.packageSubFolder}`, ); await plugins.smartfile.fs.ensureEmptyDir(this.options.publishModDirFullPath); @@ -154,7 +158,7 @@ export class PublishModule { const packageJson = await plugins.smartfile.SmartFile.fromString( plugins.path.join(this.options.publishModDirFullPath, 'package.json'), await this.createPackageJson(), - 'utf8' + 'utf8', ); await packageJson.write(); @@ -162,26 +166,26 @@ export class PublishModule { const originalTsConfigJson = await plugins.smartfile.SmartFile.fromString( plugins.path.join(this.options.publishModDirFullPath, 'tsconfig.json'), await this.createTsconfigJson(), - 'utf8' + 'utf8', ); await originalTsConfigJson.write(); // ts folder await plugins.smartfile.fs.copy( this.options.packageSubFolderFullPath, - plugins.path.join(this.options.publishModDirFullPath, this.options.packageSubFolder) + plugins.path.join(this.options.publishModDirFullPath, this.options.packageSubFolder), ); // readme await plugins.smartfile.fs.copy( plugins.path.join(this.options.packageSubFolderFullPath, 'readme.md'), - plugins.path.join(this.options.publishModDirFullPath, 'readme.md') + plugins.path.join(this.options.publishModDirFullPath, 'readme.md'), ); // license await plugins.smartfile.fs.copy( plugins.path.join(this.options.monoRepoDir, 'license'), - plugins.path.join(this.options.publishModDirFullPath, 'license') + plugins.path.join(this.options.publishModDirFullPath, 'license'), ); } @@ -203,7 +207,7 @@ export class PublishModule { await smartshellInstance.exec( `cd ${this.options.publishModDirFullPath} && pnpm publish ${ registryAccessLevel === 'public' ? '--access public' : '' - } --no-git-checks --registry https://${registryUrl}` + } --no-git-checks --registry https://${registryUrl}`, ); } } diff --git a/ts/classes.tspublish.ts b/ts/classes.tspublish.ts index bf5d523..43f1293 100644 --- a/ts/classes.tspublish.ts +++ b/ts/classes.tspublish.ts @@ -7,11 +7,14 @@ import { PublishModule } from './classes.publishmodule.js'; export class TsPublish { constructor() {} - public async publish (monorepoDirArg: string) { + public async publish(monorepoDirArg: string) { const publishModules = await this.getModuleSubDirs(monorepoDirArg); logger.log('info', `Found ${Object.keys(publishModules).length} publish modules:`); for (const publishModule of Object.keys(publishModules)) { - logger.log('info', `Publishing module: ${publishModule} -> ${publishModules[publishModule].name}`); + logger.log( + 'info', + `Publishing module: ${publishModule} -> ${publishModules[publishModule].name}`, + ); } for (const publishModule of Object.keys(publishModules)) { const publishModuleInstance = new PublishModule({ @@ -25,9 +28,9 @@ export class TsPublish { } } - public async getModuleSubDirs (dirArg: string) { + public async getModuleSubDirs(dirArg: string) { const subDirs = await plugins.smartfile.fs.listFolders(dirArg); - const publishModules: {[key: string]: interfaces.ITsPublishJson} = {}; + const publishModules: { [key: string]: interfaces.ITsPublishJson } = {}; for (const subDir of subDirs) { if (!subDir.startsWith('ts')) { continue; @@ -38,9 +41,11 @@ export class TsPublish { continue; } logger.log('info', `found publish module: ${subDir}`); - publishModules[subDir] = JSON.parse(plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json'))); + publishModules[subDir] = JSON.parse( + plugins.smartfile.fs.toStringSync(plugins.path.join(subDir, 'tspublish.json')), + ); } logger.log('ok', `found ${publishModules.length} publish modules`); return publishModules; } -} \ No newline at end of file +} diff --git a/ts/index.ts b/ts/index.ts index a51c605..e296e02 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,10 +1,10 @@ import * as paths from './paths.js'; import { TsPublish } from './classes.tspublish.js'; -export * from './classes.tspublish.js' +export * from './classes.tspublish.js'; export const runCli = async () => { console.log('Starting tspublish...'); const tspublish = new TsPublish(); await tspublish.publish(paths.cwd); -} +}; diff --git a/ts/logging.ts b/ts/logging.ts index 5e507fd..10735ef 100644 --- a/ts/logging.ts +++ b/ts/logging.ts @@ -2,4 +2,4 @@ import * as plugins from './plugins.js'; import * as commitinfo from './00_commitinfo_data.js'; export const logger = plugins.smartlog.Smartlog.createForCommitinfo(commitinfo.commitinfo); -logger.enableConsole(); \ No newline at end of file +logger.enableConsole(); diff --git a/ts/paths.ts b/ts/paths.ts index 7ffad64..647c24a 100644 --- a/ts/paths.ts +++ b/ts/paths.ts @@ -2,6 +2,8 @@ import * as plugins from './plugins.js'; export const cwd = process.cwd(); -export const packageDir = plugins.path.join(plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '..'); +export const packageDir = plugins.path.join( + plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url), + '..', +); export const nogitDir = plugins.path.join(packageDir, '.nogit'); - diff --git a/ts/plugins.ts b/ts/plugins.ts index 3549f6d..ac920c0 100644 --- a/ts/plugins.ts +++ b/ts/plugins.ts @@ -1,8 +1,6 @@ // node native scope import * as path from 'path'; -export { - path, -} +export { path }; // @push.rocks scope import * as smartfile from '@push.rocks/smartfile'; diff --git a/tsconfig.json b/tsconfig.json index fb63727..2413b93 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,8 +7,10 @@ "moduleResolution": "NodeNext", "esModuleInterop": true, "verbatimModuleSyntax": true, + "baseUrl": ".", + "paths": {} }, "exclude": [ "dist_*/**/*.d.ts" ] -} +} \ No newline at end of file