-
Notifications
You must be signed in to change notification settings - Fork 415
/
Copy path_setup.js
25 lines (18 loc) · 998 Bytes
/
_setup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
// That file is only used by the e2e tests
const path = require('path');
module.exports = async (originalFixturePath, fixturePath, utils) => {
const pluginPath = path.resolve(originalFixturePath, '..', '..');
const SLS_CONFIG_PATH = path.join(fixturePath, 'serverless.yml');
const WEBPACK_CONFIG_PATH = path.join(fixturePath, 'webpack.config.js');
const PACKAGE_JSON_PATH = path.join(fixturePath, 'package.json');
const LOCK_PATH = path.join(fixturePath, 'yarn.lock');
await Promise.all([
utils.replaceInFile(SLS_CONFIG_PATH, '- serverless-webpack', `- ${pluginPath}`),
utils.replaceInFile(WEBPACK_CONFIG_PATH, "'serverless-webpack'", `'${pluginPath}'`),
utils.replaceInFile(PACKAGE_JSON_PATH, 'file:../..', `file:${pluginPath}`),
utils.replaceInFile(LOCK_PATH, 'file:../..', `file:${pluginPath}`)
]);
const command = /^win/.test(process.platform) ? 'yarn.cmd' : 'yarn';
return utils.spawnProcess(command, ['install'], { cwd: __dirname });
};