mirror of
https://github.com/google/blockly.git
synced 2026-01-08 09:30:06 +01:00
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:
35
scripts/helpers.js
Normal file
35
scripts/helpers.js
Normal 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,
|
||||
};
|
||||
Reference in New Issue
Block a user