Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
5bdc3e8bcc | |||
5389034108 | |||
a656e3e040 | |||
819c1dca0f | |||
f3d641d1c1 | |||
1fd74928c5 | |||
0f4c2cbba4 | |||
0b68a2dd57 | |||
fda3204cfb | |||
76a1da6ca5 | |||
1653e48714 | |||
1017cb84a6 | |||
25d2703a36 |
45
changelog.md
45
changelog.md
@ -1,5 +1,50 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2024-10-23 - 1.3.1 - fix(classes.publishmodule)
|
||||||
|
Fix template string in createPackageJson method for export path
|
||||||
|
|
||||||
|
- Corrected the syntax for template string in the exports path of created package.json
|
||||||
|
|
||||||
|
## 2024-10-21 - 1.3.0 - feat(core)
|
||||||
|
Add support for multiple registries in the publish process
|
||||||
|
|
||||||
|
- Updated the PublishModule class to handle multiple registries for publishing.
|
||||||
|
- Refactored the handling of tspublish.json by incorporating it into the PublishModule options.
|
||||||
|
- Implemented logic to parse registry access level and apply it during publication.
|
||||||
|
|
||||||
|
## 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
|
||||||
|
|
||||||
|
- Enhanced log messages to provide more clarity during module publishing.
|
||||||
|
- Ensured logging captures steps of publish and init process in TsPublish and PublishModule classes respectively.
|
||||||
|
|
||||||
|
## 2024-10-21 - 1.2.3 - fix(classes.publishmodule)
|
||||||
|
Add missing 'type: module' to dynamically generated package.json
|
||||||
|
|
||||||
|
- Ensure that the 'type: module' field is included in each dynamically generated package.json file for consistent module handling.
|
||||||
|
|
||||||
|
## 2024-10-21 - 1.2.3 - fix(classes.publishmodule)
|
||||||
|
Add missing 'type: module' to dynamically generated package.json
|
||||||
|
|
||||||
|
- Ensure that the 'type: module' field is included in each dynamically generated package.json file for consistent module handling.
|
||||||
|
|
||||||
|
## 2024-10-21 - 1.2.2 - fix(publishmodule)
|
||||||
|
Fix bug in package.json creation for publish module
|
||||||
|
|
||||||
|
- Fixed an issue where `package.json` was not being written to the publish module directory.
|
||||||
|
|
||||||
|
## 2024-10-21 - 1.2.1 - fix(package.json)
|
||||||
|
Ensure bin field is properly restructured
|
||||||
|
|
||||||
|
- Fixed the structure of the package.json to ensure the bin field is accurately set.
|
||||||
|
|
||||||
## 2024-10-21 - 1.2.0 - feat(core)
|
## 2024-10-21 - 1.2.0 - feat(core)
|
||||||
Enhance package publication workflow with dependency handling and CLI improvements.
|
Enhance package publication workflow with dependency handling and CLI improvements.
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@git.zone/tspublish",
|
"name": "@git.zone/tspublish",
|
||||||
"version": "1.2.0",
|
"version": "1.3.1",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.",
|
"description": "A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
@ -13,13 +13,16 @@
|
|||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "(tsbuild --web --allowimplicitany)",
|
||||||
"buildDocs": "(tsdoc)"
|
"buildDocs": "(tsdoc)"
|
||||||
},
|
},
|
||||||
|
"bin": {
|
||||||
|
"tspublish": "cli.js"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^2.1.25",
|
"@git.zone/tsbuild": "^2.1.25",
|
||||||
"@git.zone/tsbundle": "^2.0.5",
|
"@git.zone/tsbundle": "^2.0.5",
|
||||||
"@git.zone/tsrun": "^1.2.46",
|
"@git.zone/tsrun": "^1.2.46",
|
||||||
"@git.zone/tstest": "^1.0.44",
|
"@git.zone/tstest": "^1.0.44",
|
||||||
"@push.rocks/tapbundle": "^5.0.15",
|
"@push.rocks/tapbundle": "^5.0.15",
|
||||||
"@types/node": "^22.7.6"
|
"@types/node": "^22.7.7"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
74
pnpm-lock.yaml
generated
74
pnpm-lock.yaml
generated
@ -35,16 +35,16 @@ importers:
|
|||||||
version: 2.0.15
|
version: 2.0.15
|
||||||
'@git.zone/tsrun':
|
'@git.zone/tsrun':
|
||||||
specifier: ^1.2.46
|
specifier: ^1.2.46
|
||||||
version: 1.2.49(@types/node@22.7.6)
|
version: 1.2.49(@types/node@22.7.7)
|
||||||
'@git.zone/tstest':
|
'@git.zone/tstest':
|
||||||
specifier: ^1.0.44
|
specifier: ^1.0.44
|
||||||
version: 1.0.90(@types/node@22.7.6)
|
version: 1.0.90(@types/node@22.7.7)
|
||||||
'@push.rocks/tapbundle':
|
'@push.rocks/tapbundle':
|
||||||
specifier: ^5.0.15
|
specifier: ^5.0.15
|
||||||
version: 5.3.0
|
version: 5.3.0
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.7.6
|
specifier: ^22.7.7
|
||||||
version: 22.7.6
|
version: 22.7.7
|
||||||
|
|
||||||
packages:
|
packages:
|
||||||
|
|
||||||
@ -812,8 +812,8 @@ packages:
|
|||||||
'@types/node-forge@1.3.11':
|
'@types/node-forge@1.3.11':
|
||||||
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
|
resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==}
|
||||||
|
|
||||||
'@types/node@22.7.6':
|
'@types/node@22.7.7':
|
||||||
resolution: {integrity: sha512-/d7Rnj0/ExXDMcioS78/kf1lMzYk4BZV8MZGTBKzTGZ6/406ukkbYlIsZmMPhcR5KlkunDHQLrtAVmSq7r+mSw==}
|
resolution: {integrity: sha512-SRxCrrg9CL/y54aiMCG3edPKdprgMVGDXjA3gB8UmmBW5TcXzRUYAh8EWzTnSJFAd1rgImPELza+A3bJ+qxz8Q==}
|
||||||
|
|
||||||
'@types/parse5@6.0.3':
|
'@types/parse5@6.0.3':
|
||||||
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
|
resolution: {integrity: sha512-SuT16Q1K51EAVPz1K29DJ/sXjhSQ0zjvsypYJ6tlwVsRV9jwW5Adq2ch8Dq8kDBCkYnELS7N7VNCSB5nC56t/g==}
|
||||||
@ -3460,22 +3460,22 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@git.zone/tsrun@1.2.49(@types/node@22.7.6)':
|
'@git.zone/tsrun@1.2.49(@types/node@22.7.7)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@push.rocks/smartfile': 11.0.21
|
'@push.rocks/smartfile': 11.0.21
|
||||||
'@push.rocks/smartshell': 3.0.6
|
'@push.rocks/smartshell': 3.0.6
|
||||||
ts-node: 10.9.2(@types/node@22.7.6)(typescript@5.5.2)
|
ts-node: 10.9.2(@types/node@22.7.7)(typescript@5.5.2)
|
||||||
typescript: 5.5.2
|
typescript: 5.5.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@swc/core'
|
- '@swc/core'
|
||||||
- '@swc/wasm'
|
- '@swc/wasm'
|
||||||
- '@types/node'
|
- '@types/node'
|
||||||
|
|
||||||
'@git.zone/tstest@1.0.90(@types/node@22.7.6)':
|
'@git.zone/tstest@1.0.90(@types/node@22.7.7)':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@api.global/typedserver': 3.0.51
|
'@api.global/typedserver': 3.0.51
|
||||||
'@git.zone/tsbundle': 2.0.15
|
'@git.zone/tsbundle': 2.0.15
|
||||||
'@git.zone/tsrun': 1.2.49(@types/node@22.7.6)
|
'@git.zone/tsrun': 1.2.49(@types/node@22.7.7)
|
||||||
'@push.rocks/consolecolor': 2.0.2
|
'@push.rocks/consolecolor': 2.0.2
|
||||||
'@push.rocks/smartbrowser': 2.0.6
|
'@push.rocks/smartbrowser': 2.0.6
|
||||||
'@push.rocks/smartdelay': 3.0.5
|
'@push.rocks/smartdelay': 3.0.5
|
||||||
@ -4306,14 +4306,14 @@ snapshots:
|
|||||||
|
|
||||||
'@types/accepts@1.3.7':
|
'@types/accepts@1.3.7':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/babel__code-frame@7.0.6': {}
|
'@types/babel__code-frame@7.0.6': {}
|
||||||
|
|
||||||
'@types/body-parser@1.19.5':
|
'@types/body-parser@1.19.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/connect': 3.4.38
|
'@types/connect': 3.4.38
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/buffer-json@2.0.3': {}
|
'@types/buffer-json@2.0.3': {}
|
||||||
|
|
||||||
@ -4327,17 +4327,17 @@ snapshots:
|
|||||||
|
|
||||||
'@types/clean-css@4.2.11':
|
'@types/clean-css@4.2.11':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
source-map: 0.6.1
|
source-map: 0.6.1
|
||||||
|
|
||||||
'@types/co-body@6.1.3':
|
'@types/co-body@6.1.3':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
'@types/qs': 6.9.16
|
'@types/qs': 6.9.16
|
||||||
|
|
||||||
'@types/connect@3.4.38':
|
'@types/connect@3.4.38':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/content-disposition@0.5.8': {}
|
'@types/content-disposition@0.5.8': {}
|
||||||
|
|
||||||
@ -4350,11 +4350,11 @@ snapshots:
|
|||||||
'@types/connect': 3.4.38
|
'@types/connect': 3.4.38
|
||||||
'@types/express': 5.0.0
|
'@types/express': 5.0.0
|
||||||
'@types/keygrip': 1.0.6
|
'@types/keygrip': 1.0.6
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/cors@2.8.17':
|
'@types/cors@2.8.17':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/debounce@1.2.4': {}
|
'@types/debounce@1.2.4': {}
|
||||||
|
|
||||||
@ -4366,14 +4366,14 @@ snapshots:
|
|||||||
|
|
||||||
'@types/express-serve-static-core@4.19.6':
|
'@types/express-serve-static-core@4.19.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
'@types/qs': 6.9.16
|
'@types/qs': 6.9.16
|
||||||
'@types/range-parser': 1.2.7
|
'@types/range-parser': 1.2.7
|
||||||
'@types/send': 0.17.4
|
'@types/send': 0.17.4
|
||||||
|
|
||||||
'@types/express-serve-static-core@5.0.0':
|
'@types/express-serve-static-core@5.0.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
'@types/qs': 6.9.16
|
'@types/qs': 6.9.16
|
||||||
'@types/range-parser': 1.2.7
|
'@types/range-parser': 1.2.7
|
||||||
'@types/send': 0.17.4
|
'@types/send': 0.17.4
|
||||||
@ -4394,21 +4394,21 @@ snapshots:
|
|||||||
|
|
||||||
'@types/from2@2.3.5':
|
'@types/from2@2.3.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/fs-extra@11.0.4':
|
'@types/fs-extra@11.0.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/jsonfile': 6.1.4
|
'@types/jsonfile': 6.1.4
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/glob@8.1.0':
|
'@types/glob@8.1.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/minimatch': 5.1.2
|
'@types/minimatch': 5.1.2
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/gunzip-maybe@1.4.2':
|
'@types/gunzip-maybe@1.4.2':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/hast@3.0.4':
|
'@types/hast@3.0.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -4442,7 +4442,7 @@ snapshots:
|
|||||||
|
|
||||||
'@types/jsonfile@6.1.4':
|
'@types/jsonfile@6.1.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/keygrip@1.0.6': {}
|
'@types/keygrip@1.0.6': {}
|
||||||
|
|
||||||
@ -4459,7 +4459,7 @@ snapshots:
|
|||||||
'@types/http-errors': 2.0.4
|
'@types/http-errors': 2.0.4
|
||||||
'@types/keygrip': 1.0.6
|
'@types/keygrip': 1.0.6
|
||||||
'@types/koa-compose': 3.2.8
|
'@types/koa-compose': 3.2.8
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/mdast@4.0.4':
|
'@types/mdast@4.0.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -4481,9 +4481,9 @@ snapshots:
|
|||||||
|
|
||||||
'@types/node-forge@1.3.11':
|
'@types/node-forge@1.3.11':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/node@22.7.6':
|
'@types/node@22.7.7':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 6.19.8
|
undici-types: 6.19.8
|
||||||
|
|
||||||
@ -4504,12 +4504,12 @@ snapshots:
|
|||||||
'@types/send@0.17.4':
|
'@types/send@0.17.4':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/mime': 1.3.5
|
'@types/mime': 1.3.5
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/serve-static@1.15.7':
|
'@types/serve-static@1.15.7':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/http-errors': 2.0.4
|
'@types/http-errors': 2.0.4
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
'@types/send': 0.17.4
|
'@types/send': 0.17.4
|
||||||
|
|
||||||
'@types/sinon-chai@3.2.12':
|
'@types/sinon-chai@3.2.12':
|
||||||
@ -4527,11 +4527,11 @@ snapshots:
|
|||||||
|
|
||||||
'@types/tar-stream@2.2.3':
|
'@types/tar-stream@2.2.3':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/through2@2.0.41':
|
'@types/through2@2.0.41':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/trusted-types@2.0.7': {}
|
'@types/trusted-types@2.0.7': {}
|
||||||
|
|
||||||
@ -4551,15 +4551,15 @@ snapshots:
|
|||||||
|
|
||||||
'@types/ws@7.4.7':
|
'@types/ws@7.4.7':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/ws@8.5.12':
|
'@types/ws@8.5.12':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
|
|
||||||
'@types/yauzl@2.10.3':
|
'@types/yauzl@2.10.3':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
'@ungap/structured-clone@1.2.0': {}
|
'@ungap/structured-clone@1.2.0': {}
|
||||||
@ -5096,7 +5096,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/cookie': 0.4.1
|
'@types/cookie': 0.4.1
|
||||||
'@types/cors': 2.8.17
|
'@types/cors': 2.8.17
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
accepts: 1.3.8
|
accepts: 1.3.8
|
||||||
base64id: 2.0.0
|
base64id: 2.0.0
|
||||||
cookie: 0.4.2
|
cookie: 0.4.2
|
||||||
@ -6961,14 +6961,14 @@ snapshots:
|
|||||||
|
|
||||||
trough@2.2.0: {}
|
trough@2.2.0: {}
|
||||||
|
|
||||||
ts-node@10.9.2(@types/node@22.7.6)(typescript@5.5.2):
|
ts-node@10.9.2(@types/node@22.7.7)(typescript@5.5.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cspotcode/source-map-support': 0.8.1
|
'@cspotcode/source-map-support': 0.8.1
|
||||||
'@tsconfig/node10': 1.0.11
|
'@tsconfig/node10': 1.0.11
|
||||||
'@tsconfig/node12': 1.0.11
|
'@tsconfig/node12': 1.0.11
|
||||||
'@tsconfig/node14': 1.0.3
|
'@tsconfig/node14': 1.0.3
|
||||||
'@tsconfig/node16': 1.0.4
|
'@tsconfig/node16': 1.0.4
|
||||||
'@types/node': 22.7.6
|
'@types/node': 22.7.7
|
||||||
acorn: 8.13.0
|
acorn: 8.13.0
|
||||||
acorn-walk: 8.3.4
|
acorn-walk: 8.3.4
|
||||||
arg: 4.1.3
|
arg: 4.1.3
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tspublish',
|
name: '@git.zone/tspublish',
|
||||||
version: '1.2.0',
|
version: '1.3.1',
|
||||||
description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.'
|
description: 'A tool to publish multiple, concise, and small packages from monorepos, specifically for TypeScript projects within a git environment.'
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,17 @@ import * as plugins from './plugins.js';
|
|||||||
import * as paths from './paths.js';
|
import * as paths from './paths.js';
|
||||||
import { logger } from './logging.js';
|
import { logger } from './logging.js';
|
||||||
|
|
||||||
|
export interface ITsPublishJson {
|
||||||
|
name: string;
|
||||||
|
dependencies: string[];
|
||||||
|
registries: string[];
|
||||||
|
}
|
||||||
|
|
||||||
export interface IPublishModuleOptions {
|
export interface IPublishModuleOptions {
|
||||||
monoRepoDir: string;
|
monoRepoDir: string;
|
||||||
packageSubFolder: string;
|
packageSubFolder: string;
|
||||||
packageSubFolderFullPath?: string;
|
packageSubFolderFullPath?: string;
|
||||||
|
tsPublishJson?: ITsPublishJson;
|
||||||
publishModDirFullPath?: string;
|
publishModDirFullPath?: string;
|
||||||
name?: string;
|
name?: string;
|
||||||
version?: string;
|
version?: string;
|
||||||
@ -28,23 +35,23 @@ export class PublishModule {
|
|||||||
if (!this.options.packageSubFolder.startsWith('ts')) {
|
if (!this.options.packageSubFolder.startsWith('ts')) {
|
||||||
throw new Error('subFolder must start with "ts"');
|
throw new Error('subFolder must start with "ts"');
|
||||||
}
|
}
|
||||||
const jsonData = plugins.smartfile.fs.toObjectSync(
|
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(
|
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 = {
|
||||||
...this.options.dependencies,
|
...this.options.dependencies,
|
||||||
...(() => {
|
...(() => {
|
||||||
const resultDependencies = {};
|
const resultDependencies = {};
|
||||||
for (const dependency of jsonData.dependencies) {
|
for (const dependency of this.options.tsPublishJson.dependencies) {
|
||||||
resultDependencies[dependency] = monoRepoPackageJson.dependencies[dependency];
|
resultDependencies[dependency] = monoRepoPackageJson.dependencies[dependency];
|
||||||
}
|
}
|
||||||
return resultDependencies;
|
return resultDependencies;
|
||||||
})()
|
})(),
|
||||||
};
|
};
|
||||||
this.options.name = this.options.name || jsonData.name;
|
this.options.name = this.options.name || this.options.tsPublishJson.name;
|
||||||
this.options.version = monoRepoPackageJson.version;
|
this.options.version = monoRepoPackageJson.version;
|
||||||
|
|
||||||
// now that we have a name and version, lets check if there is already a package under the same name and version.
|
// now that we have a name and version, lets check if there is already a package under the same name and version.
|
||||||
@ -74,10 +81,11 @@ export class PublishModule {
|
|||||||
const packageJson = {
|
const packageJson = {
|
||||||
name: this.options.name,
|
name: this.options.name,
|
||||||
version: this.options.version,
|
version: this.options.version,
|
||||||
|
type: 'module',
|
||||||
description: '',
|
description: '',
|
||||||
exports: {
|
exports: {
|
||||||
'.': {
|
'.': {
|
||||||
import: './dist_${this.options.packageSubFolder}/index.js',
|
import: `./dist_${this.options.packageSubFolder}/index.js`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
scripts: {
|
scripts: {
|
||||||
@ -87,6 +95,18 @@ export class PublishModule {
|
|||||||
devDependencies: {
|
devDependencies: {
|
||||||
'@git.zone/tsbuild': await this.getLatestVersionOfPackage('@git.zone/tsbuild'),
|
'@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);
|
return JSON.stringify(packageJson, null, 2);
|
||||||
}
|
}
|
||||||
@ -96,7 +116,7 @@ export class PublishModule {
|
|||||||
this.options.monoRepoDir,
|
this.options.monoRepoDir,
|
||||||
`dist_publish_${this.options.packageSubFolder}`
|
`dist_publish_${this.options.packageSubFolder}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// package.json
|
// package.json
|
||||||
await plugins.smartfile.fs.ensureEmptyDir(this.options.publishModDirFullPath);
|
await plugins.smartfile.fs.ensureEmptyDir(this.options.publishModDirFullPath);
|
||||||
const packageJson = await plugins.smartfile.SmartFile.fromString(
|
const packageJson = await plugins.smartfile.SmartFile.fromString(
|
||||||
@ -104,22 +124,35 @@ export class PublishModule {
|
|||||||
await this.createPackageJson(),
|
await this.createPackageJson(),
|
||||||
'utf8'
|
'utf8'
|
||||||
);
|
);
|
||||||
|
await packageJson.write();
|
||||||
|
|
||||||
// ts folder
|
// 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() {
|
public async build() {
|
||||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
executor: 'bash',
|
executor: 'bash',
|
||||||
})
|
});
|
||||||
await smartshellInstance.exec(`cd ${this.options.publishModDirFullPath} && pnpm run build`);
|
await smartshellInstance.exec(`cd ${this.options.publishModDirFullPath} && pnpm run build`);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async publish() {
|
public async publish() {
|
||||||
const smartshellInstance = new plugins.smartshell.Smartshell({
|
const smartshellInstance = new plugins.smartshell.Smartshell({
|
||||||
executor: 'bash',
|
executor: 'bash',
|
||||||
})
|
});
|
||||||
await smartshellInstance.exec(`cd ${this.options.publishModDirFullPath} && pnpm publish`);
|
for (const registry of this.options.tsPublishJson.registries) {
|
||||||
|
const registryArray = registry.split(':');
|
||||||
|
const registryUrl = registryArray[0];
|
||||||
|
const registryAccessLevel = registryArray[1];
|
||||||
|
await smartshellInstance.exec(
|
||||||
|
`cd ${this.options.publishModDirFullPath} && pnpm publish ${
|
||||||
|
registryAccessLevel === 'public' ? '--access public' : ''
|
||||||
|
} --no-git-checks --registry https://${registryUrl}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user