File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed
scripts/testChangedPackageNames Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 3838 "generate:map" : " tsx scripts/generateClientTypesMap" ,
3939 "generate:tests" : " tsx scripts/generateNewClientTests" ,
4040 "lint" : " biome lint --write" ,
41+ "prepublishOnly" : " tsx scripts/testChangedPackageNames" ,
4142 "release" : " npm run build && changeset publish" ,
4243 "test" : " vitest"
4344 },
Original file line number Diff line number Diff line change 1+ import { exec } from "node:child_process" ;
2+ import { mkdtemp } from "node:fs/promises" ;
3+ import { tmpdir } from "node:os" ;
4+ import { join } from "node:path" ;
5+ import { promisify } from "node:util" ;
6+ import { CLIENT_PACKAGE_NAMES_MAP as PACKAGE_NAMES_MAP_TO_PUBLISH } from "../../src/transforms/v2-to-v3/config" ;
7+
8+ const execAsync = promisify ( exec ) ;
9+
10+ ( async ( ) => {
11+ // Create temporary directory
12+ const tempDir = await mkdtemp ( join ( tmpdir ( ) , "testChangedPackageNames-" ) ) ;
13+ await execAsync ( "npm install aws-sdk-js-codemod@latest" , { cwd : tempDir } ) ;
14+
15+ const { CLIENT_PACKAGE_NAMES_MAP : PACKAGE_NAMES_MAP_LATEST } = await import (
16+ join ( tempDir , "node_modules/aws-sdk-js-codemod/dist/transforms/v2-to-v3/config" )
17+ ) ;
18+
19+ const changedPackageNames = Object . keys ( PACKAGE_NAMES_MAP_TO_PUBLISH )
20+ . filter ( ( key ) => PACKAGE_NAMES_MAP_TO_PUBLISH [ key ] !== PACKAGE_NAMES_MAP_LATEST [ key ] )
21+ . map ( ( key ) => PACKAGE_NAMES_MAP_TO_PUBLISH [ key ] ) ;
22+
23+ console . log ( `Changed package names: ${ changedPackageNames . join ( ", " ) } ` ) ;
24+ for ( const packageName of changedPackageNames ) {
25+ const npmPackageName = `@aws-sdk/${ packageName } ` ;
26+ await execAsync ( `npm show ${ npmPackageName } version` ) ;
27+ console . log ( `${ npmPackageName } exists` ) ;
28+ }
29+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments