2021-02-21 20:54:33 +01:00
|
|
|
|
|
|
|
import * as st from "scripting-tools";
|
2021-02-21 21:27:42 +01:00
|
|
|
import { join as pathJoin, basename as pathBasename } from "path";
|
2021-02-21 20:54:33 +01:00
|
|
|
|
2021-02-21 23:06:42 +01:00
|
|
|
export const sampleReactProjectDirPath = pathJoin(__dirname, "..", "..", "sample_react_project");
|
2021-02-21 20:54:33 +01:00
|
|
|
|
2021-02-21 23:06:42 +01:00
|
|
|
export function setupSampleReactProject() {
|
2021-02-21 20:54:33 +01:00
|
|
|
|
|
|
|
st.execSync(`rm -rf ${sampleReactProjectDirPath}`);
|
|
|
|
st.execSync(`mkdir ${sampleReactProjectDirPath}`);
|
|
|
|
|
2021-02-21 21:27:42 +01:00
|
|
|
const url = "https://github.com/garronej/keycloak-react-theming/releases/download/v0.0.1/sample_build_dir_and_package_json.zip";
|
|
|
|
|
2021-02-21 20:54:33 +01:00
|
|
|
[
|
2021-02-21 21:27:42 +01:00
|
|
|
`wget ${url}`,
|
|
|
|
...["unzip", "rm"].map(prg => `${prg} ${pathBasename(url)}`)
|
2021-02-21 20:54:33 +01:00
|
|
|
].forEach(cmd => st.execSync(cmd, { "cwd": sampleReactProjectDirPath }));
|
|
|
|
|
|
|
|
}
|