fix(build): build/test on windows (#6431)

* build: build/test on windows

* chore(deps): bump @hyperjump/json-schema from 0.18.4 to 0.18.5
* chore(deps): add gulp-gzip 1.4.2
* build: migrate test scripts to gulp task (test_tasks.js)
* build: not to use the grep command
* build: normalize path

* fix: Modified based on review suggestions.
* Add JSDoc comment
* Line length <= 80 characters.
* Formatting test output as previously.
* Always continue even if a test unit fails.
* Suppress the gulp messages.
* Fix test_tasks.js to pass eslint.

* fix: Modified based on review suggestions.
* Change generator test output directory.
* Formatting test output as previously.

* fix: Formatting test output as previously.

* fix: Modified based on review suggestions.
This commit is contained in:
YAMADA Yutaka
2022-10-28 05:02:50 +09:00
committed by GitHub
parent c1fbcc5bed
commit 52879dd953
11 changed files with 604 additions and 209 deletions

35
scripts/helpers.js Normal file
View File

@@ -0,0 +1,35 @@
/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @fileoverview Helper functions for build/test.
*/
/* eslint-env node */
const path = require('path');
/**
* Escape regular expression pattern
* @param {string} pattern regular expression pattern
* @return {string} escaped regular expression pattern
*/
function escapeRegex(pattern) {
return pattern.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
}
/**
* Replaces OS-specific path with POSIX style path.
* @param {string} target target path
* @return {string} posix path
*/
function posixPath(target) {
const osSpecificSep = new RegExp(escapeRegex(path.sep), 'g');
return target.replace(osSpecificSep, path.posix.sep);
}
module.exports = {
posixPath,
};