feat(classes.publishmodule): Add method to create and write tsconfig.json during publish module setup
This commit is contained in:
parent
f518670443
commit
91f3c90607
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-10-28 - 1.5.0 - feat(classes.publishmodule)
|
||||
Add method to create and write tsconfig.json during publish module setup
|
||||
|
||||
- Introduced createTsconfigJson method in PublishModule class to generate a tsconfig.json for each publishable module.
|
||||
- Modified createPublishModuleDir method to include writing of tsconfig.json file.
|
||||
|
||||
## 2024-10-26 - 1.4.0 - feat(core)
|
||||
Refactor directory reading and module discovery for publishing process
|
||||
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@git.zone/tspublish',
|
||||
version: '1.4.0',
|
||||
version: '1.5.0',
|
||||
description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.'
|
||||
}
|
||||
|
@ -76,6 +76,31 @@ export class PublishModule {
|
||||
return packageInfo.allVersions[0].version;
|
||||
}
|
||||
|
||||
public async createTsconfigJson() {
|
||||
const originalTsConfig = plugins.smartfile.fs.toObjectSync(
|
||||
plugins.path.join(paths.cwd, 'tsconfig.json')
|
||||
);
|
||||
for (const path of originalTsConfig.compilerOptions.paths) {
|
||||
originalTsConfig.compilerOptions.paths[path][0] = `.${originalTsConfig.compilerOptions.paths[path][0]}`;
|
||||
}
|
||||
const tsconfigJson = {
|
||||
compilerOptions: {
|
||||
experimentalDecorators: true,
|
||||
useDefineForClassFields: false,
|
||||
target: 'ES2022',
|
||||
module: 'NodeNext',
|
||||
moduleResolution: 'NodeNext',
|
||||
esModuleInterop: true,
|
||||
verbatimModuleSyntax: true,
|
||||
paths: originalTsConfig.compilerOptions.paths,
|
||||
},
|
||||
exclude: [
|
||||
'dist_*/**/*.d.ts',
|
||||
],
|
||||
};
|
||||
return JSON.stringify(tsconfigJson, null, 2);
|
||||
}
|
||||
|
||||
public async createPackageJson() {
|
||||
const packageJson = {
|
||||
name: this.options.name,
|
||||
@ -125,6 +150,14 @@ export class PublishModule {
|
||||
);
|
||||
await packageJson.write();
|
||||
|
||||
// tsconfig.json
|
||||
const originalTsConfigJson = await plugins.smartfile.SmartFile.fromString(
|
||||
plugins.path.join(this.options.publishModDirFullPath, 'tsconfig.json'),
|
||||
await this.createTsconfigJson(),
|
||||
'utf8'
|
||||
);
|
||||
await originalTsConfigJson.write();
|
||||
|
||||
// ts folder
|
||||
await plugins.smartfile.fs.copy(
|
||||
this.options.packageSubFolderFullPath,
|
||||
|
Loading…
Reference in New Issue
Block a user