Skip to content

Commit a4260fe

Browse files
committed
more console information about the plugins and scripts
- add docs/comments
1 parent 52daa9e commit a4260fe

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

plugins/strip-devtool.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
/**
2+
* Removes all occurrences of a specified HTML tag and its contents from a string
3+
* @param {string} html - The HTML string to process
4+
* @param {string} tagName - The name of the tag to remove
5+
* @returns {string} The HTML string with all instances of the specified tag removed
6+
*/
17
function removetag(html, tagName) {
28
const pattern = new RegExp(`<${tagName}\\b[^>]*>([\\s\\S]*?)</${tagName}>`, 'gi')
39
// Repeatedly apply the regex until no more tags are found
@@ -7,13 +13,23 @@ function removetag(html, tagName) {
713
return html
814
}
915

16+
/**
17+
* Removes all lines containing a specified string from a source text
18+
* @param {string} src - The source text to process
19+
* @param {string} tagName - The string to search for in each line
20+
* @returns {string} The source text with all lines containing the search string removed
21+
*/
1022
function removeline(src, tagName) {
1123
// Create a regular expression that matches any line containing the specified word
1224
const regex = new RegExp(`^.*${tagName}.*(?:\\r?\\n|\\r)?`, 'gim')
1325
// Replace all occurrences of lines containing the word with an empty string
1426
return src.replace(regex, '')
1527
}
1628

29+
/**
30+
* Creates a Vite plugin that strips development tools and components based on build mode
31+
* @returns {import('vite').Plugin} A Vite plugin object that transforms App.vue and SmileApp.vue files
32+
*/
1733
export default function stripDevToolPlugin() {
1834
let config
1935
const loaderMatch = /(App\.vue|SmileApp\.vue)$/
@@ -26,6 +42,7 @@ export default function stripDevToolPlugin() {
2642

2743
transform(src, id) {
2844
if (loaderMatch.test(id)) {
45+
console.log(' ➜ stripping dev/present mode components from', id.split('/').slice(-3).join('/'))
2946
let clean_src = src
3047

3148
// Handle App.vue specific removals

scripts/generate_git_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ENV_FILE='env/.env.git.local'
44

5-
echo "Regenerating local environment file based on git info $ENV_FILE"
5+
echo "Regenerating local environment file based on git info $ENV_FILE"
66
echo "# DO NOT EDIT THIS FILE IT IS AUTOMATICALLY GENERATED" > $ENV_FILE
77
echo "# this file is automatically generated by the post-commit hook (see scripts/generate_git_env)." >> $ENV_FILE
88
echo "" >> $ENV_FILE

0 commit comments

Comments
 (0)