ta-scripts
Advanced tools
Comparing version 2.3.0 to 2.3.1
#!/usr/bin/env node | ||
'use strict' | ||
const fs = require('fs') | ||
const sh = require('shelljs') | ||
@@ -115,5 +116,5 @@ const path = require('path') | ||
const stagedPath = getStagedPath(repo, branch) | ||
const newTagPath = `="/${stagedPath}/` | ||
const absPathRegEx = /(="\/)(?!\/)/g | ||
const pathRegExp = /(href="|src=")\/?(?!\/)(.*?")/g | ||
// cache file contents so we can restore them | ||
const cache = {} | ||
sh.cd(dir) | ||
@@ -124,3 +125,6 @@ const indexFiles = sh.find('.').filter((file) => /\.html$/.test(file)) | ||
sh.echo('...monkey patching html paths') | ||
indexFiles.forEach((file) => sh.sed('-i', absPathRegEx, newTagPath, file)) | ||
indexFiles.forEach((file) => { | ||
cache[file] = sh.cat(file) | ||
sh.sed('-i', pathRegExp, (group, g1, g2) => `${g1}/${stagedPath}/${g2}`, file) | ||
}) | ||
@@ -134,3 +138,3 @@ // sync | ||
sh.echo('...cleanup') | ||
indexFiles.forEach((file) => sh.sed('-i', newTagPath, '="/', file)) | ||
indexFiles.forEach((file) => fs.writeFileSync(file, cache[file], 'utf8')) | ||
} | ||
@@ -137,0 +141,0 @@ |
{ | ||
"name": "ta-scripts", | ||
"version": "2.3.0", | ||
"version": "2.3.1", | ||
"description": "CI/CD scripts", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20503
292
3