File tree Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Expand file tree Collapse file tree 2 files changed +16
-12
lines changed Original file line number Diff line number Diff line change 66// ╚═════╝╚══════╝╚═╝
77
88import path from 'path'
9+ import fs from 'fs'
910import { ALL_TEMPLATES , DEFAULT_TEMPLATE , BROWSERS } from './fixtures/constants'
1011import {
1112 extensionProgram ,
@@ -93,22 +94,26 @@ describe('extension build', () => {
9394 `builds and zips the source files of an extension created via "$name" template` ,
9495 async ( template ) => {
9596 const extensionPath = path . join ( __dirname , 'fixtures' , template . name )
97+ const outputPath = path . join (
98+ __dirname ,
99+ 'fixtures' ,
100+ template . name ,
101+ 'dist'
102+ )
96103
97104 await extensionProgram ( `build ${ extensionPath } --zip-source` )
98105
99106 expect (
100- distFileExists (
101- template . name ,
102- BROWSERS [ 0 ] ,
103- `${ template . name } -1.0-source.zip`
107+ fs . existsSync (
108+ path . join ( outputPath , `${ template . name } -1.0-source.zip` )
104109 )
105110 ) . toBeTruthy ( )
106111 } ,
107112 50000
108113 )
109114
110115 it . each ( [ DEFAULT_TEMPLATE ] ) (
111- `builds and zips the source files of an extension created via "$name" template with a custom output name using the --zip-filename flag` ,
116+ `builds and zips the distribution files of an extension created via "$name" template with a custom output name using the --zip-filename flag` ,
112117 async ( template ) => {
113118 const extensionPath = path . join ( __dirname , 'fixtures' , template . name )
114119
@@ -117,11 +122,7 @@ describe('extension build', () => {
117122 )
118123
119124 expect (
120- distFileExists (
121- template . name ,
122- BROWSERS [ 0 ] ,
123- `${ template . name } -nice.zip`
124- )
125+ distFileExists ( template . name , BROWSERS [ 0 ] , `${ template . name } -nice.zip` )
125126 ) . toBeTruthy ( )
126127 } ,
127128 50000
Original file line number Diff line number Diff line change @@ -72,16 +72,19 @@ export default function generateZip(
7272 { browser = 'chrome' , ...options } : BuildOptions
7373) {
7474 try {
75- const outputDir = path . join ( projectDir , 'dist' , browser )
75+ const distDir = path . join ( projectDir , 'dist' )
76+ const outputDir = path . join ( distDir , browser )
7677 // We collect data from the projectDir if the user wants to zip the source files.
7778 const dataDir = options . zipSource ? projectDir : outputDir
7879 const manifest : Record < string , string > = require (
7980 path . join ( dataDir , 'manifest.json' )
8081 )
8182 const name = getPackageName ( manifest , options )
8283 const ext = getExtensionExtension ( browser )
84+ // Dist zips are stored in dist/[browser]/[name].zip
8385 const distZipPath = path . join ( outputDir , `${ name } .${ ext } ` )
84- const sourceZipPath = path . join ( outputDir , `${ name } -source.${ ext } ` )
86+ // Source zips are stored in dist/[name]-source.zip
87+ const sourceZipPath = path . join ( distDir , `${ name } -source.${ ext } ` )
8588 const capitalizedBrowser = capitalizeBrowserName ( browser )
8689
8790 if ( options . zipSource ) {
You can’t perform that action at this time.
0 commit comments