Skip to content

Instantly share code, notes, and snippets.

@naxmefy
Created August 11, 2023 06:20
Show Gist options
  • Select an option

  • Save naxmefy/8d067a8693be79278c0487f1343f2871 to your computer and use it in GitHub Desktop.

Select an option

Save naxmefy/8d067a8693be79278c0487f1343f2871 to your computer and use it in GitHub Desktop.

Revisions

  1. naxmefy revised this gist Aug 11, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions create.sh
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,6 @@
    #!/usr/bin/env sh

    # check for command - here example with nestjs
    # shellcheck disable=SC2039
    if ! command -v nest &> /dev/null
    then
  2. naxmefy created this gist Aug 11, 2023.
    27 changes: 27 additions & 0 deletions create.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    #!/usr/bin/env sh

    # shellcheck disable=SC2039
    if ! command -v nest &> /dev/null
    then
    echo "nest could not be found. install with 'npm install --global @nestjs/cli'"
    exit
    fi

    MAX=$(
    # shellcheck disable=SC2164
    cd samples;
    # shellcheck disable=SC2035
    find * -type d -maxdepth 0 -mindepth 0 |
    awk '/^([0-9]+)\-.+$/ { printf("%d\n", $1) }' |
    sort -n |
    tail -n1
    )

    PROJECT_NAME=$1
    NEXT=$((MAX + 1))

    # command to create example project
    # here example with nestjs
    # nest new -s -g -p npm --directory "samples/$(printf "%05d\n" $NEXT)-$PROJECT_NAME" "$PROJECT_NAME"
    # here example with flutter
    # flutter create --org me.nax.lab --project-name "$PROJECT_NAME" "samples/$(printf "%05d\n" $NEXT)-$PROJECT_NAME"