From ebdcf509fbeb7095cab4418f4d7d03dd4b716bbe Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sat, 10 Dec 2022 17:26:19 -0500 Subject: [PATCH] Simplify the process by just assuming my own git. --- README.md | 12 +++++++++++- commands/create.js | 13 +++++++++---- package.json | 2 +- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6130e2a..ff5dee9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# LJSTHW Bandolier +## LJSTHW Bandolier The Bandolier is an educational web framework featured in the [Learn JavaScript the Hard Way](https://learnjsthehardway.com) course. The Bandolier contains all of the features a full stack developer would need to learn, but with smaller easier to understand implementations that are fully visible in the project. @@ -70,6 +70,16 @@ npx bando-up create my-first-project This will create an initial web application using the course's web framework named `Bandolier`. It checks out the project from the `git.learnjsthehardway.com` site and then configures it so you get started. +### Installing Other Projects + +Since this tool is intended to make it easier for [Learn JavaScript the Hard Way](https://learnjsthehardway.com) student it only select projects from git.learnjsthehardway.com using their names. You use the `--using` option to specify a different project: + +```shell +npx bando-up --using js-level-1-code my-js-level-1 +``` + +This will check out the full URL `https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template.git` using `git` and then do the usual setup. You an [view a list of all available code](https://learnjsthehardway.com) for the course. + ## Updating When there's new releases you can update with: diff --git a/commands/create.js b/commands/create.js index 3d1aecc..0668c93 100644 --- a/commands/create.js +++ b/commands/create.js @@ -3,26 +3,31 @@ import { mkdir_to, exec_i, copy, glob } from "../lib/builderator.js"; import { log } from "../lib/logging.js"; import path from "path"; -export const BANDO_GIT = "https://git.learnjsthehardway.com/learn-javascript-the-hard-way/bandolier-template.git"; +export const GIT_BASE = "https://git.learnjsthehardway.com/learn-javascript-the-hard-way/"; +export const BANDO_GIT = "bandolier-template"; export const description = "Generates projects using the Bandolier educational framework."; export const options = [ - ["--repo", "repository to dupe and setup", BANDO_GIT], - ["--template", "templates directory to use for setups", "commands/templates"], + ["--using ", "repository to dupe and setup", BANDO_GIT], + ["--template ", "templates directory to use for setups", "commands/templates"], ["--keep-git", "for patches and analysis, you can keep the original .git", false], ]; export const argument = ["", "name of the project directory (must not exist)"]; export const main = async (target, opts) => { + const git_url = `${GIT_BASE}${BANDO_GIT}.git`; + + log.info(`Cloning from ${git_url}`); + try { await fs.access(target); log.error(`Target ${target} exists. Won't install into it.`); process.exit(1); } catch(error) { // access is stupid, it throws an exception but we want the negative response as a positive outcome - exec_i(`git clone --depth 1 ${BANDO_GIT} ${target}`); + exec_i(`git clone --depth 1 ${git_url} ${target}`); } // normalize the temp directory diff --git a/package.json b/package.json index bada739..bd7e8a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ljsthw-bandolier", - "version": "0.3.1", + "version": "0.4.1", "description": "Generates projects using the Bandolier educational framework.", "main": "bando.js", "bin": {