feat(build): Allow building in windows without admin priviledges
Closes #2873
This commit is contained in:
parent
f827e1532e
commit
f1f578436b
|
@ -181,6 +181,9 @@ Karma is run against the new output.
|
||||||
much easier to debug. `xit` and `xdescribe` can also be useful to exclude a test and a group of
|
much easier to debug. `xit` and `xdescribe` can also be useful to exclude a test and a group of
|
||||||
tests respectively.
|
tests respectively.
|
||||||
|
|
||||||
|
**Note**: **watch mode** needs symlinks to work, so if you're using windows, ensure you have the
|
||||||
|
rights to built them in your operating system.
|
||||||
|
|
||||||
### E2E tests
|
### E2E tests
|
||||||
|
|
||||||
1. `$(npm bin)/gulp build.js.cjs` (builds benchpress and tests into `dist/js/cjs` folder).
|
1. `$(npm bin)/gulp build.js.cjs` (builds benchpress and tests into `dist/js/cjs` folder).
|
||||||
|
|
|
@ -41,7 +41,11 @@ class DiffingReplace implements DiffingBroccoliPlugin {
|
||||||
});
|
});
|
||||||
fs.writeFileSync(destFilePath, content, FILE_ENCODING);
|
fs.writeFileSync(destFilePath, content, FILE_ENCODING);
|
||||||
} else if (!fs.existsSync(destFilePath)) {
|
} else if (!fs.existsSync(destFilePath)) {
|
||||||
fs.symlinkSync(sourceFilePath, destFilePath);
|
try {
|
||||||
|
fs.symlinkSync(sourceFilePath, destFilePath);
|
||||||
|
} catch (e) {
|
||||||
|
fs.writeFileSync(destFilePath, fs.readFileSync(sourceFilePath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,34 @@ module.exports = function(gulp, plugins, config) {
|
||||||
var linkDir = path.join(nodeModulesDir, relativeFolder);
|
var linkDir = path.join(nodeModulesDir, relativeFolder);
|
||||||
if (!fs.existsSync(linkDir)) {
|
if (!fs.existsSync(linkDir)) {
|
||||||
console.log('creating link', linkDir, sourceDir);
|
console.log('creating link', linkDir, sourceDir);
|
||||||
fs.symlinkSync(sourceDir, linkDir, 'dir');
|
try {
|
||||||
|
fs.symlinkSync(sourceDir, linkDir, 'dir');
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
var sourceDir = path.join(config.dir, relativeFolder);
|
||||||
|
console.log('linking failed: trying to hard copy', linkDir, sourceDir);
|
||||||
|
copyRecursiveSync(sourceDir, linkDir);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function copyRecursiveSync (src, dest) {
|
||||||
|
if (fs.existsSync(src)) {
|
||||||
|
var stats = fs.statSync(src);
|
||||||
|
if (stats.isDirectory()) {
|
||||||
|
fs.mkdirSync(dest);
|
||||||
|
fs.readdirSync(src).forEach(function(childItemName) {
|
||||||
|
copyRecursiveSync(path.join(src, childItemName),
|
||||||
|
path.join(dest, childItemName));
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
fs.writeFileSync(dest, fs.readFileSync(src));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function getSubdirs(rootDir) {
|
function getSubdirs(rootDir) {
|
||||||
return fs.readdirSync(rootDir).filter(function(file) {
|
return fs.readdirSync(rootDir).filter(function(file) {
|
||||||
if (file[0] === '.') {
|
if (file[0] === '.') {
|
||||||
|
@ -29,4 +51,4 @@ function getSubdirs(rootDir) {
|
||||||
var dirPath = path.join(rootDir, file);
|
var dirPath = path.join(rootDir, file);
|
||||||
return fs.statSync(dirPath).isDirectory();
|
return fs.statSync(dirPath).isDirectory();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue