Skip to content

Commit cac9406

Browse files
authored
Use .npmrc from cwd for devextreme-themebuilder installation (#106)
1 parent 2968047 commit cac9406

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

commands/themebuider.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,21 +94,34 @@ const getMeta = (fullMeta, base, filter, baseParametersList) => {
9494
return result;
9595
};
9696

97-
const installThemeBuilder = version => {
97+
const installThemeBuilder = async version => {
9898
const packageJsonPath = path.join(themeBuilderPackagePath, 'package.json');
99+
const cwd = path.join(__dirname, '..');
100+
const npmrc = './.npmrc';
101+
const installationNpmrc = path.join(cwd, '.npmrc');
102+
let removeNpmrc = false;
99103

100104
if(fs.existsSync(packageJsonPath) && require(packageJsonPath).version === version) {
101105
return;
102106
}
103107

104-
return runCommand('npm', [
108+
if(fs.existsSync(npmrc)) {
109+
removeNpmrc = true;
110+
fs.copyFileSync(npmrc, installationNpmrc);
111+
}
112+
113+
await runCommand('npm', [
105114
'install',
106115
'--no-save',
107116
`devextreme-themebuilder@${version}`
108117
], {
109-
cwd: path.join(__dirname, '..'),
118+
cwd,
110119
stdio: 'ignore'
111120
});
121+
122+
if(removeNpmrc) {
123+
fs.unlinkSync(installationNpmrc);
124+
}
112125
};
113126

114127
const getDevExtremeVersion = () => {

0 commit comments

Comments
 (0)