Files
keycloak_theme/src/test/setupSampleReactProject.ts
2021-02-28 18:40:57 +01:00

20 lines
734 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { getProjectRoot } from "../bin/tools/getProjectRoot";
import * as st from "scripting-tools";
import { join as pathJoin, basename as pathBasename } from "path";
export const sampleReactProjectDirPath = pathJoin(getProjectRoot(), "sample_react_project");
export function setupSampleReactProject() {
st.execSync(`rm -rf ${sampleReactProjectDirPath}`);
st.execSync(`mkdir ${sampleReactProjectDirPath}`);
const url = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/sample_build_dir_and_package_json.zip";
[
`wget ${url}`,
...["unzip", "rm"].map(prg => `${prg} ${pathBasename(url)}`)
].forEach(cmd => st.execSync(cmd, { "cwd": sampleReactProjectDirPath }));
}