@@ -15,14 +15,10 @@ import {
15
15
} from './utils.js' ;
16
16
17
17
console . log ( '\n./npmDist' ) ;
18
- await buildPackage ( './npmDist' , false ) ;
18
+ await buildPackage ( './npmDist' ) ;
19
19
showDirStats ( './npmDist' ) ;
20
20
21
- console . log ( '\n./npmEsmDist' ) ;
22
- await buildPackage ( './npmEsmDist' , true ) ;
23
- showDirStats ( './npmEsmDist' ) ;
24
-
25
- async function buildPackage ( outDir : string , isESMOnly : boolean ) : Promise < void > {
21
+ async function buildPackage ( outDir : string ) : Promise < void > {
26
22
fs . rmSync ( outDir , { recursive : true , force : true } ) ;
27
23
fs . mkdirSync ( outDir ) ;
28
24
@@ -82,36 +78,25 @@ async function buildPackage(outDir: string, isESMOnly: boolean): Promise<void> {
82
78
) ;
83
79
}
84
80
85
- if ( isESMOnly ) {
86
- packageJSON . exports = { } ;
81
+ packageJSON . exports = { } ;
87
82
88
- const { emittedTSFiles } = emitTSFiles ( {
89
- outDir,
90
- module : 'es2020' ,
91
- extension : '.js' ,
92
- } ) ;
83
+ const { emittedTSFiles } = emitTSFiles ( {
84
+ outDir,
85
+ module : 'es2020' ,
86
+ extension : '.js' ,
87
+ } ) ;
93
88
94
- for ( const filepath of emittedTSFiles ) {
95
- if ( path . basename ( filepath ) === 'index.js' ) {
96
- const relativePath = './' + path . relative ( './npmEsmDist' , filepath ) ;
97
- packageJSON . exports [ path . dirname ( relativePath ) ] = relativePath ;
98
- }
89
+ for ( const filepath of emittedTSFiles ) {
90
+ if ( path . basename ( filepath ) === 'index.js' ) {
91
+ const relativePath = './' + path . relative ( './npmDist' , filepath ) ;
92
+ packageJSON . exports [ path . dirname ( relativePath ) ] = relativePath ;
99
93
}
100
-
101
- // Temporary workaround to allow "internal" imports, no grantees provided
102
- packageJSON . exports [ './*.js' ] = './*.js' ;
103
- packageJSON . exports [ './*' ] = './*.js' ;
104
-
105
- packageJSON . publishConfig . tag += '-esm' ;
106
- packageJSON . version += '+esm' ;
107
- } else {
108
- delete packageJSON . type ;
109
- packageJSON . main = 'index' ;
110
- packageJSON . module = 'index.mjs' ;
111
- emitTSFiles ( { outDir, module : 'commonjs' , extension : '.js' } ) ;
112
- emitTSFiles ( { outDir, module : 'es2020' , extension : '.mjs' } ) ;
113
94
}
114
95
96
+ // Temporary workaround to allow "internal" imports, no grantees provided
97
+ packageJSON . exports [ './*.js' ] = './*.js' ;
98
+ packageJSON . exports [ './*' ] = './*.js' ;
99
+
115
100
const packageJsonPath = `./${ outDir } /package.json` ;
116
101
const prettified = await prettify (
117
102
packageJsonPath ,
0 commit comments