At any point, you can test your template against your $SAMPLE.

  1. Generate $CODE:
    CODE=$SAMPLES/code
    ns generate $CODE -t $TEMPLATE
  1. Make sure it is generating the right files. Add whatever --exclude statements you want and run this:

    DIFFS_FILE=$NS_DIR/diffs
    diff -qr --exclude=node_modules \
         --exclude=.git \
         --exclude=.idea  \
    $SAMPLE/ $CODE/ | sed "s|$SAMPLE|\$SAMPLE|g" \
    | sed "s|$CODE|\$CODE|g" \
    | sed "s|: |\/|g" \
    | sed "s|Only in \$SAMPLE/|not being generated: |g" \
    | sed "s|Only in \$CODE/|new added: |g" \
    | sort > $DIFFS_FILE
  2. Make corrections. If you are seeing differences, and they are for generated files (static or dynamic), either you are generating them wrong or you simply need to insert into $CODE the custom changes.

To turn $CODE into a version of $SAMPLE that works with your template, run this code for any file not working. The example give

DIFFERENT_FILE=src/commands/push.ts
DIFF_FOR_FILE=~/ns/diffs-file
diff $OLD_FILE/$DIFFERENT_FILE $NEW_FILE/$DIFFERENT_FILE | sed '/^> /d' | sed 's/< //g' > DIFF_FOR_FILE

Then edit the result and you'll see a nice list of code to add to the $CODE version, even telling you the line numbers.

But if a change that you see is due to an error in generation, you have to modify $TEMPLATE and regenerate again.