From 1d50eea4a410a4cec9f0e3a22a4b6de8ff360876 Mon Sep 17 00:00:00 2001 From: YoungKi Lyu Date: Sat, 16 Mar 2024 16:50:43 +0900 Subject: [PATCH] sample(34-grpc-client-server): skip a (proto) folder --- tools/gulp/tasks/samples.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/gulp/tasks/samples.ts b/tools/gulp/tasks/samples.ts index 977947d12e8..63cfd999337 100644 --- a/tools/gulp/tasks/samples.ts +++ b/tools/gulp/tasks/samples.ts @@ -2,10 +2,11 @@ import * as childProcess from 'child_process'; import * as clc from 'cli-color'; import * as log from 'fancy-log'; import { task } from 'gulp'; -import { resolve } from 'path'; +import { join, resolve } from 'path'; import { promisify } from 'util'; import { samplePath } from '../config'; import { containsPackageJson, getDirs } from '../util/task-helpers'; +import { existsSync } from 'fs'; const exec = promisify(childProcess.exec); @@ -43,6 +44,14 @@ async function executeNPMScriptInDirectory( appendScript?: string, ) { const dirName = dir.replace(resolve(__dirname, '../../../'), ''); + + if (!existsSync(join(dir, 'package.json'))) { + log.info( + `Skipping ${clc.magenta(dirName)} as it does not contain a package.json`, + ); + return; + } + log.info(`Running ${clc.blue(script)} in ${clc.magenta(dirName)}`); try { const result = await exec(