When building the environment stamp, support two modes: release and snapshot The release mode will always stamp using the current version of in the root package.json and in snapshot mode will use a version stamp expressing a version based on the tag and the number of commits from the tag. PR Close #40095
		
			
				
	
	
		
			37 lines
		
	
	
		
			938 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			938 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| /**
 | |
|  * @license
 | |
|  * Copyright Google LLC All Rights Reserved.
 | |
|  *
 | |
|  * Use of this source code is governed by an MIT-style license that can be
 | |
|  * found in the LICENSE file at https://angular.io/license
 | |
|  */
 | |
| 
 | |
| import {Arguments, Argv, CommandModule} from 'yargs';
 | |
| 
 | |
| import {buildEnvStamp, EnvStampMode} from './env-stamp';
 | |
| 
 | |
| 
 | |
| export interface Options {
 | |
|   mode: EnvStampMode;
 | |
| }
 | |
| 
 | |
| function builder(args: Argv): Argv<Options> {
 | |
|   return args.option('mode', {
 | |
|     demandOption: true,
 | |
|     description: 'Whether the env-stamp should be built for a snapshot or release',
 | |
|     choices: ['snapshot' as const, 'release' as const]
 | |
|   });
 | |
| }
 | |
| 
 | |
| async function handler({mode}: Arguments<Options>) {
 | |
|   buildEnvStamp(mode);
 | |
| }
 | |
| 
 | |
| /** CLI command module for building the environment stamp. */
 | |
| export const BuildEnvStampCommand: CommandModule<{}, Options> = {
 | |
|   builder,
 | |
|   handler,
 | |
|   command: 'build-env-stamp',
 | |
|   describe: 'Build the environment stamping information',
 | |
| };
 |