33// That file is only used by the e2e tests
44
55const path = require ( 'path' ) ;
6+ const fse = require ( 'fs-extra' ) ;
7+
8+ async function replacePluginLockReference ( lockPath , pluginPackagePath ) {
9+ const lock = await fse . readJson ( lockPath ) ;
10+ const pluginPackage = lock . packages [ '../..' ] ;
11+ const installedPackage = lock . packages [ 'node_modules/serverless-webpack' ] || { } ;
12+
13+ lock . packages [ '' ] . devDependencies [ 'serverless-webpack' ] = `file:${ pluginPackagePath } ` ;
14+ delete lock . packages [ '../..' ] ;
15+ lock . packages [ 'node_modules/serverless-webpack' ] = {
16+ ...pluginPackage ,
17+ ...installedPackage ,
18+ resolved : `file:${ pluginPackagePath } `
19+ } ;
20+ delete lock . packages [ 'node_modules/serverless-webpack' ] . link ;
21+
22+ await fse . writeJson ( lockPath , lock , { spaces : 2 } ) ;
23+ }
624
725module . exports = async ( originalFixturePath , fixturePath , utils ) => {
826 const pluginPath = path . resolve ( originalFixturePath , '..' , '..' ) ;
@@ -16,7 +34,7 @@ module.exports = async (originalFixturePath, fixturePath, utils) => {
1634 utils . replaceInFile ( SLS_CONFIG_PATH , '- serverless-webpack' , `- ${ pluginPath } ` ) ,
1735 utils . replaceInFile ( WEBPACK_CONFIG_PATH , "'serverless-webpack'" , `'${ pluginPath } '` ) ,
1836 utils . replaceInFile ( PACKAGE_JSON_PATH , 'file:../..' , `file:${ utils . pluginPackagePath } ` ) ,
19- utils . replaceInFile ( LOCK_PATH , '../..' , ` ${ utils . pluginPackagePath } ` )
37+ replacePluginLockReference ( LOCK_PATH , utils . pluginPackagePath )
2038 ] ) ;
2139
2240 const command = / ^ w i n / . test ( process . platform ) ? 'npm.cmd' : 'npm' ;
0 commit comments