"Fossies" - the Fresh Open Source Software Archive

Member "angular-cli-15.2.4/tests/legacy-cli/e2e/initialize/500-create-project.ts" (16 Mar 2023, 1326 Bytes) of package /linux/www/angular-cli-15.2.4.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "500-create-project.ts": 15.1.6_vs_15.2.0.

    1 import { join } from 'path';
    2 import yargsParser from 'yargs-parser';
    3 import { getGlobalVariable } from '../utils/env';
    4 import { expectFileToExist } from '../utils/fs';
    5 import { gitClean } from '../utils/git';
    6 import { setRegistry as setNPMConfigRegistry } from '../utils/packages';
    7 import { ng } from '../utils/process';
    8 import { prepareProjectForE2e, updateJsonFile } from '../utils/project';
    9 
   10 export default async function () {
   11   const argv = getGlobalVariable<yargsParser.Arguments>('argv');
   12 
   13   if (argv.noproject) {
   14     return;
   15   }
   16 
   17   if (argv.reuse) {
   18     process.chdir(argv.reuse);
   19     await gitClean();
   20   } else {
   21     // Ensure local test registry is used when outside a project
   22     await setNPMConfigRegistry(true);
   23 
   24     await ng('new', 'test-project', '--skip-install');
   25     await expectFileToExist(join(process.cwd(), 'test-project'));
   26     process.chdir('./test-project');
   27 
   28     // Setup esbuild builder if requested on the commandline
   29     const useEsbuildBuilder = !!getGlobalVariable('argv')['esbuild'];
   30     if (useEsbuildBuilder) {
   31       await updateJsonFile('angular.json', (json) => {
   32         json['projects']['test-project']['architect']['build']['builder'] =
   33           '@angular-devkit/build-angular:browser-esbuild';
   34       });
   35     }
   36   }
   37 
   38   await prepareProjectForE2e('test-project');
   39   await ng('version');
   40 }