Files
test-repo/scripts/install-prettier.js
T
fisker Cheung 71fbd6149a Refactor production tests (#8073)
# Conflicts:
#	scripts/test-dist.js
2020-04-20 00:57:31 +03:00

24 lines
629 B
JavaScript

"use strict";
const path = require("path");
const shell = require("shelljs");
const tempy = require("tempy");
shell.config.fatal = true;
const rootDir = path.join(__dirname, "..");
const distDir = path.join(rootDir, "dist");
module.exports = () => {
const file = shell.exec("npm pack", { cwd: distDir }).stdout.trim();
const tarPath = path.join(distDir, file);
const tmpDir = tempy.directory();
shell.config.silent = true;
shell.exec("npm init -y", { cwd: tmpDir });
shell.exec(`npm install "${tarPath}"`, { cwd: tmpDir });
shell.config.silent = false;
return path.join(tmpDir, "node_modules/prettier");
};