I want to have a timestamp or build number somewhere on my Angular2 App so I can tell if a user is using an old cached version or not.
How to do this with AngularCLI
There's no need to replace-in-file.
Just inside your desired environment.*.ts file (For more information about environments read angular-2-and-environment-variables) require package.json like so:
export const environment = {
version: require('../package.json').version
};
Then inside your app import environment:
import { environment } from '../environments/environment';
And you have environment.version.
If you get cannot find name 'require' error, Read this answer
More info
Note: As @VolodymyrBilyachat mentioned in comments, this will include your package.json file in the final bundle file.