diff --git a/cookiecutter.yaml b/cookiecutter.yaml new file mode 100644 index 0000000..0b8fbdf --- /dev/null +++ b/cookiecutter.yaml @@ -0,0 +1,10 @@ +default_context: + project_name: "demo" + project_slug: "demo" + project_generated_name: "demo" + owner_email: "demo@crowdbotics.com" + custom_domain: "demo.botics.co" + repo_url: "https://github.com/crowdbotics/modules" + heroku_dyno_size: "free" + heroku_team: "" + is_mobile: "y" diff --git a/dist/react-native-demo.zip b/dist/react-native-demo.zip new file mode 100644 index 0000000..a6235b7 Binary files /dev/null and b/dist/react-native-demo.zip differ diff --git a/package.json b/package.json index 96c537c..aff419a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "scripts": { "semver": "node scripts/semver.js", "cookie": "node scripts/cookie.js", + "demo": "node scripts/demo.js", "raw": "node scripts/raw.js", "template": "node scripts/template.js", "bootstrap": "npm run raw; npm run cookie", diff --git a/scripts/demo.js b/scripts/demo.js new file mode 100644 index 0000000..04e2f38 --- /dev/null +++ b/scripts/demo.js @@ -0,0 +1,33 @@ +import path from "path"; +import { execSync } from "child_process"; +import fs from "fs"; + +const demoPath = path.join(process.cwd(), "demo"); + +const options = { + encoding: "utf8", + stdio: "inherit", + cwd: path.dirname(demoPath) +}; +const yaml = path.join(process.cwd(), "cookiecutter.yaml"); + +function removeDir(dir) { + if (fs.existsSync(dir)) { + fs.rmSync(dir, { recursive: true }); + } +} + +removeDir(demoPath); + +const rnCookieCutterCommand = [ + "pipenv run cookiecutter", + "./dist/cookie", + `--config-file ${yaml}`, + "--no-input" +].join(" "); + +execSync(rnCookieCutterCommand, options); + +execSync(`cd ${demoPath} && zip -r ../dist/react-native-demo.zip .`, options); + +removeDir(demoPath);