diff --git a/CHANGELOG.md b/CHANGELOG.md index 33bb6a5..acf42c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,36 @@ Based on [Common Changelog](https://common-changelog.org/). +## 3.0.2 - 2024-04-17 + +### Fixed + +Fixed issues with `cookiecutter` commands not the finding `cookiecutter.yaml` file. + +The file got removed and the configuration is now instead injected directly in the command arguments. The `demo` command should now be much more reliable across all combinations of operating system/package manager of choice. + +## 3.0.1 - 2024-03-27 + +### Changed + +The repository has moved from [crowdbotics/modules](https://github.com/crowdbotics/modules) to [crowdbotics/cli](https://github.com/crowdbotics/cli). + +## 3.0.0-canary - 2024-03-21 + +_The project has been published to npm under the name ["crowdbotics"](https://www.npmjs.com/package/crowdbotics)._ + +### Changed + +You can now install it directly: +``` +npm install -g crowdbotics +``` + +And run it with the `cb` binary: +``` +cb help +``` + ## 2.4.0 - 2023-12-21 ### Added diff --git a/cookiecutter.yaml b/cookiecutter.yaml deleted file mode 100644 index 0b8fbdf..0000000 --- a/cookiecutter.yaml +++ /dev/null @@ -1,10 +0,0 @@ -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/index.js b/index.js index 16cd625..d57128e 100755 --- a/index.js +++ b/index.js @@ -52,19 +52,6 @@ import { EVENT } from "./scripts/analytics/constants.js"; import { askOptIn } from "./scripts/analytics/scripts.js"; import { sentryMonitoring } from "./scripts/utils/sentry.js"; -const pkg = JSON.parse( - fs.readFileSync(new URL("package.json", import.meta.url), "utf8") -); - -let sourceDir = path.dirname(path.dirname(process.argv[1])); -if (fs.existsSync(path.join(sourceDir, pkg.name))) { - // npx lib directory - sourceDir = path.join(sourceDir, pkg.name); -} else { - // npm lib directory - sourceDir = path.join(sourceDir, "lib", "node_modules", pkg.name); -} - const gitRoot = () => { try { return path.dirname(findGitRoot(process.cwd())); @@ -116,10 +103,7 @@ const commands = { EnvironmentDependency.Python, EnvironmentDependency.PipEnv ]); - createDemo( - path.join(gitRoot(), "demo"), - path.join(sourceDir, "cookiecutter.yaml") - ); + createDemo(path.join(gitRoot(), "demo")); valid("demo app successfully generated"); }, parse: () => { diff --git a/package.json b/package.json index 2b23c0f..791f3fb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "crowdbotics", - "version": "3.0.1", + "version": "3.0.2", "description": "A powerful command-line tool designed to streamline the management of your Crowdbotics applications", "main": "index.js", "license": "MIT", diff --git a/scripts/demo.js b/scripts/demo.js index a8ec2ef..84ba3c1 100644 --- a/scripts/demo.js +++ b/scripts/demo.js @@ -5,7 +5,22 @@ import { section, generateCommand } from "../utils.js"; import { execSync } from "child_process"; import { configurePython, execOptions } from "./utils/environment.js"; -export function createDemo(dir, yaml) { +const config = { + 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", + is_mobile: "y" +}; + +const extraContext = Object.entries(config) + .map((cur) => `${cur[0]}=${cur[1]}`) + .join(" "); + +export function createDemo(dir) { const options = Object.assign(execOptions, { cwd: path.dirname(dir) }); @@ -25,8 +40,8 @@ export function createDemo(dir, yaml) { "gh:crowdbotics/react-native-scaffold", "--directory dist/cookie", "--checkout master", - `--config-file ${yaml}`, - "--no-input" + "--no-input", + extraContext ]); execSync(rnCookieCutterCommand, options); @@ -42,9 +57,9 @@ export function createDemo(dir, yaml) { "pipenv run cookiecutter", "gh:crowdbotics/django-scaffold", "--checkout master", - `--config-file ${yaml}`, `--output-dir ${path.basename(dir)}`, - "--no-input" + "--no-input", + extraContext ]); execSync(djangoCookieCutterCommand, options); fse.moveSync(path.join(dir, path.basename(dir)), path.join(dir, "backend"));