fix(publishmodule): Fix syntax errors and improve formatting in classes.publishmodule.ts

This commit is contained in:
Philipp Kunz 2024-10-21 14:51:12 +02:00
parent 0f4c2cbba4
commit 1fd74928c5
3 changed files with 30 additions and 8 deletions

View File

@ -1,5 +1,12 @@
# Changelog
## 2024-10-21 - 1.2.4 - fix(publishmodule)
Fix syntax errors and improve formatting in classes.publishmodule.ts
- Fixed missing semicolons in multiple locations for improved syntax correctness.
- Improved the formatting for better code readability.
- Added --no-git-checks flag to the pnpm publish command.
## 2024-10-21 - 1.2.3 - fix(logs)
Improve logging mechanism with structured logs for publish process

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tspublish',
version: '1.2.3',
version: '1.2.4',
description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.'
}

View File

@ -33,7 +33,7 @@ export class PublishModule {
);
const monoRepoPackageJson = JSON.parse(
plugins.smartfile.fs.toStringSync(plugins.path.join(this.options.monoRepoDir, 'package.json'))
)
);
this.options.dependencies = {
...this.options.dependencies,
...(() => {
@ -42,7 +42,7 @@ export class PublishModule {
resultDependencies[dependency] = monoRepoPackageJson.dependencies[dependency];
}
return resultDependencies;
})()
})(),
};
this.options.name = this.options.name || jsonData.name;
this.options.version = monoRepoPackageJson.version;
@ -88,6 +88,18 @@ export class PublishModule {
devDependencies: {
'@git.zone/tsbuild': await this.getLatestVersionOfPackage('@git.zone/tsbuild'),
},
files: [
'ts/**/*',
'ts_web/**/*',
'dist/**/*',
'dist_*/**/*',
'dist_ts/**/*',
'dist_ts_web/**/*',
'assets/**/*',
'cli.js',
'npmextra.json',
'readme.md',
],
};
return JSON.stringify(packageJson, null, 2);
}
@ -97,7 +109,7 @@ export class PublishModule {
this.options.monoRepoDir,
`dist_publish_${this.options.packageSubFolder}`
);
// package.json
await plugins.smartfile.fs.ensureEmptyDir(this.options.publishModDirFullPath);
const packageJson = await plugins.smartfile.SmartFile.fromString(
@ -108,20 +120,23 @@ export class PublishModule {
await packageJson.write();
// ts folder
await plugins.smartfile.fs.copy(this.options.packageSubFolderFullPath, plugins.path.join(this.options.publishModDirFullPath, this.options.packageSubFolder))
await plugins.smartfile.fs.copy(
this.options.packageSubFolderFullPath,
plugins.path.join(this.options.publishModDirFullPath, this.options.packageSubFolder)
);
}
public async build() {
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
})
});
await smartshellInstance.exec(`cd ${this.options.publishModDirFullPath} && pnpm run build`);
}
public async publish() {
const smartshellInstance = new plugins.smartshell.Smartshell({
executor: 'bash',
})
await smartshellInstance.exec(`cd ${this.options.publishModDirFullPath} && pnpm publish`);
});
await smartshellInstance.exec(`cd ${this.options.publishModDirFullPath} && pnpm publish --no-git-checks`);
}
}