11import * as core from '@actions/core'
2- import semanticRelease from 'semantic-release'
2+ import type SemanticRelease from 'semantic-release'
33import defaultConfig from './defaultConfig'
44import { install } from './util/install'
5- import debugLib from 'debug'
65import { forceRelease , initialRelease } from './plugin'
7- import { PluginSpec } from './semantic-release'
6+ import type { PluginSpec } from './semantic-release'
87import { updateTags } from './util/updateTags'
98import { gitConfig } from './util/gitConfig'
109
1110export default async function run ( env = process . env ) : Promise < void > {
1211 try {
13- const packages : string [ ] = [ 'semantic-release' ] // npm warns about missing peer dependency without this
12+ const packages : string [ ] = [ 'semantic-release' ]
1413
1514 const config = getConfig ( core . getInput ( 'config' , { required : false } ) , defaultConfig , packages )
1615 const plugins : PluginSpec [ ] = Array . from ( config . plugins ?? [ ] )
@@ -43,14 +42,16 @@ export default async function run(env = process.env): Promise<void> {
4342 log ( 'DRY RUN' )
4443 }
4544 if ( debug ) {
45+ const { default : debugLib } = await import ( 'debug' )
4646 debugLib . enable ( 'semantic-release:*' )
4747 }
4848
4949 plugins . push ( forceRelease , initialRelease )
5050
51+ const { default : semanticRelease } = await import ( 'semantic-release' )
5152 const result = await semanticRelease ( {
5253 ...config ,
53- plugins : plugins as semanticRelease . PluginSpec [ ] ,
54+ plugins : plugins as SemanticRelease . PluginSpec [ ] ,
5455 dryRun,
5556 } , {
5657 env : {
@@ -119,9 +120,9 @@ function safeParse(val: string) {
119120
120121function getConfig (
121122 configInput : string ,
122- defaultConfig : Partial < semanticRelease . GlobalConfig > ,
123+ defaultConfig : Partial < SemanticRelease . GlobalConfig > ,
123124 packages : string [ ] ,
124- ) : Partial < semanticRelease . GlobalConfig > {
125+ ) : Partial < SemanticRelease . GlobalConfig > {
125126 if ( configInput [ 0 ] === '.' ) {
126127 return {
127128 ...defaultConfig ,
@@ -131,7 +132,7 @@ function getConfig(
131132 try {
132133 return {
133134 ...defaultConfig ,
134- ...JSON . parse ( configInput ) as Partial < semanticRelease . GlobalConfig > ,
135+ ...JSON . parse ( configInput ) as Partial < SemanticRelease . GlobalConfig > ,
135136 }
136137 } catch ( e ) {
137138 throw 'Invalid inline config'
0 commit comments