diff --git a/packages/unity-react-core/scripts/check-changes.tsx b/packages/unity-react-core/scripts/check-changes.tsx index aa9367037..7ec14d18c 100644 --- a/packages/unity-react-core/scripts/check-changes.tsx +++ b/packages/unity-react-core/scripts/check-changes.tsx @@ -1,134 +1,128 @@ import React from "react"; -import { AnchorMenu } from "../src/components/AnchorMenu/AnchorMenu"; +import { AnchorMenu } from "../src/components/AnchorMenu/AnchorMenu.jsx"; import { Article } from "../src/components/Article/Article.jsx"; import { Accordion } from "../src/components/Accordion/Accordion.jsx"; import { Card } from "../src/components/Card/Card.jsx"; -import { Pagination } from "../src/components/Pagination/Pagination.jsx" -import { Breadcrumbs } from "../src/components/Breadcrumbs/Breadcrumbs" -import { getBootstrapHTML } from '../src/components/GaEventWrapper/useBaseSpecificFramework.js'; +import { Pagination } from "../src/components/Pagination/Pagination.jsx"; +import { Breadcrumbs } from "../src/components/Breadcrumbs/Breadcrumbs"; +import { getBootstrapHTML } from "../src/components/GaEventWrapper/useBaseSpecificFramework.js"; -const fs = require('fs'); -const path = require('path'); +const fs = require("fs"); +const path = require("path"); -function convertToHTML(OLD_DATE){ +interface ComponentConfig { + reactComponent: React.ComponentType; + props: Record; +} + +interface ComponentMap { + [key: string]: ComponentConfig; +} -/** - * 2. OJAS TODO: Use a hashmap or object, {}, have each component have it's own key with values - * You only have to have one or two for now. We can add more laterr - * Example: - * const componentMap = { - * Pagination: { - * reactComponent: Pagination, // This is the Pagination we have imported at the top of the file - * props: { - *. type: "default", - background: "white", - totalPages: 4, - onChange: () => null - * } - * } - */ - const componentMap = { +function convertToHTML(OLD_DATE: string): void { + const componentMap: ComponentMap = { Accordion: { reactComponent: Accordion, props: { cards: [ - { - content: { - header: "Accordion Card 1", - body: "

Quatrenary Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

This is a level five headline. There's a fancy word for that too.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

", - }, - }, - { - content: { - header: "Accordion Card 2", - body: "

Quatrenary Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

This is a level five headline. There's a fancy word for that too.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

", - }, - }, - { - content: { - header: "Accordion Card 3, opened card", - body: "

Quatrenary Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

This is a level five headline. There's a fancy word for that too.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

", - }, - }, - ], - openedCard: 3, - } + { + content: { + header: "Accordion Card 1", + body: "

Quatrenary Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

This is a level five headline. There's a fancy word for that too.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

", + }, + }, + { + content: { + header: "Accordion Card 2", + body: "

Quatrenary Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

This is a level five headline. There's a fancy word for that too.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

", + }, + }, + { + content: { + header: "Accordion Card 3, opened card", + body: "

Quatrenary Headline

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

This is a level five headline. There's a fancy word for that too.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud

", + }, + }, + ], + openedCard: 3, + }, }, AnchorMenu: { reactComponent: AnchorMenu, props: { items: [ - { - text: "Title Case is Required", - targetIdName: "first-container", - icon: ["fas", "link"], - }, - { text: "Second Container", targetIdName: "second-container" }, - { text: "Third Container", targetIdName: "third-container" }, - { - text: "This is the Last", - targetIdName: "fourth-container", - icon: ["fas", "link"], - }, - ], - } + { + text: "Title Case is Required", + targetIdName: "first-container", + icon: ["fas", "link"], + }, + { text: "Second Container", targetIdName: "second-container" }, + { text: "Third Container", targetIdName: "third-container" }, + { + text: "This is the Last", + targetIdName: "fourth-container", + icon: ["fas", "link"], + }, + ], + }, }, Article: { reactComponent: Article, - props: {defaultArgs: { - type: "news", - articleUrl: "https://example.com", - headerImageUrl: "", - title: - "Clarisse Machanguana takes her skill set to the next level at ASU Thunderbird", - publicationDate: "March 18, 2021", - authorName: "Jimena Garrison", - authorTitle: "Media Relations and Strategic Communications", - authorEmail: "jgarris6@asu.edu", - authorPhone: "480-727-4058", - breadcrumbs: [ + props: { + defaultArgs: { + type: "news", + articleUrl: "https://example.com", + headerImageUrl: "", + title: + "Clarisse Machanguana takes her skill set to the next level at ASU Thunderbird", + publicationDate: "March 18, 2021", + authorName: "Jimena Garrison", + authorTitle: "Media Relations and Strategic Communications", + authorEmail: "jgarris6@asu.edu", + authorPhone: "480-727-4058", + breadcrumbs: [ + { + title: "Home", + url: "/", + }, + { + title: "Second nav item", + url: "/events", + }, + { + title: "Current page", + url: "/events/current-article", + active: true, + }, + ], + body: "

After 34 years in the game of basketball, Clarisse Machanguana retired. Her eponymous philanthropic foundation remains her only connection to the sport, although the effect of the global game has left imprints in many aspects of her life.

Playing basketball took her to Portugal and then the U.S., where she attended Old Dominion University in Virginia to study criminal justice. When she realized that sports could be a microcosm of life and values, she decided to create a way to coach sports while teaching life skills in her home country of Mozambique. She started the Clarisse Machanguana Foundation in 2014 with the goal of empowering Mozambican youth through health, education and sports programs.

Now she’s taking her leadership game to the next level at ASU’s Thunderbird School of Global Management, earning her Master of Global Management degree with a nonprofit management concentration. Machanguana is honing her skills as a global professional in and out of the classroom to propel her foundation even further.

Here she reflects on the experiences that brought her to Thunderbird and ASU.

Question: Why basketball?

Answer: I started at age 6, and because it was popular in my area and I was tall — now 6-feet-5-inches tall, to be exact — people kept telling me I should play. Basketball took me everywhere. I had a scholarship to play in Portugal and the U.S., and later on in Spain, France, Brazil, South Korea and Italy. Basketball became a passport and a school for me, and a source of amazing friendships. I played from age 6 to 40. My foundation now partners with the Department of Education. We collaborate with teachers and teach them to coach life skills and basketball.

I advocate social causes that are challenging for youth and transform them into opportunities, giving them tools to lift themselves out of the poverty they see. They use the skills like respecting your opponent and perseverance that can be applied in life as well as sports. When you wake up and all you see is poverty, you start to believe that mindset of limitations and scarcity. We give young people something else to believe in, a vision of a better life.

", + }, + }, + }, + Breadcrumbs: { + reactComponent: Breadcrumbs, + props: { + linkItems: [ { - title: "Home", - url: "/", + label: "Home", + active: false, + href: "#", }, { - title: "Second nav item", - url: "/events", + label: "Library", + active: false, + href: "#", }, { - title: "Current page", - url: "/events/current-article", + label: "Data", active: true, + href: "#", }, ], - body: "

After 34 years in the game of basketball, Clarisse Machanguana retired. Her eponymous philanthropic foundation remains her only connection to the sport, although the effect of the global game has left imprints in many aspects of her life.

Playing basketball took her to Portugal and then the U.S., where she attended Old Dominion University in Virginia to study criminal justice. When she realized that sports could be a microcosm of life and values, she decided to create a way to coach sports while teaching life skills in her home country of Mozambique. She started the Clarisse Machanguana Foundation in 2014 with the goal of empowering Mozambican youth through health, education and sports programs.

Now she’s taking her leadership game to the next level at ASU’s Thunderbird School of Global Management, earning her Master of Global Management degree with a nonprofit management concentration. Machanguana is honing her skills as a global professional in and out of the classroom to propel her foundation even further.

Here she reflects on the experiences that brought her to Thunderbird and ASU.

Question: Why basketball?

Answer: I started at age 6, and because it was popular in my area and I was tall — now 6-feet-5-inches tall, to be exact — people kept telling me I should play. Basketball took me everywhere. I had a scholarship to play in Portugal and the U.S., and later on in Spain, France, Brazil, South Korea and Italy. Basketball became a passport and a school for me, and a source of amazing friendships. I played from age 6 to 40. My foundation now partners with the Department of Education. We collaborate with teachers and teach them to coach life skills and basketball.

I advocate social causes that are challenging for youth and transform them into opportunities, giving them tools to lift themselves out of the poverty they see. They use the skills like respecting your opponent and perseverance that can be applied in life as well as sports. When you wake up and all you see is poverty, you start to believe that mindset of limitations and scarcity. We give young people something else to believe in, a vision of a better life.

", }, - } - }, - Breadcrumbs: { - reactComponent: Breadcrumbs, - props: { - linkItems: [ - { - label: "Home", - active: false, - href: "#", - }, - { - label: "Library", - active: false, - href: "#", - }, - { - label: "Data", - active: true, - href: "#", - }, - ], - } }, Card: { - reactComponenet: Card, + reactComponent: Card, props: { type: "default", horizontal: false, @@ -158,7 +152,7 @@ function convertToHTML(OLD_DATE){ ], linkUrl: "/#", linkLabel: "Link", - } + }, }, Pagination: { reactComponent: Pagination, @@ -166,75 +160,40 @@ function convertToHTML(OLD_DATE){ type: "default", background: "white", totalPages: 4, - } - } - } - - -/** - 3.OJAS TODO: Create function that iterates through the componentMap and generates the HTML for each component - and instead of writing individual html of each component, we can create a temporary object and then write that to the file. Using a try catch here would be good so we can log any errors - -FUNCTION generateAllComponents() - // DECLARE an empty object to store component HTML and metadata - DECLARE emptyObjectToWriteTo AS {} - - // ITERATE over each entry in the componentMap - FOR EACH componentName, component IN componentMap - // Generate HTML for the current component - // This is conceptually similar to in a React context - DECLARE html AS RESULT OF getBootstrapHTML(CreateElement(component.reactComponent, component.props)) - - // Store the generated HTML and its size in the temporary object - SET emptyObjectToWriteTo[componentName] TO { - html: html, - // We can use this as an easy way to check for changes in the future without having to parse the html - size: LENGTH(html) - } - END FOR - - // At this point, 'emptyObjectToWriteTo' holds all the generated HTML and sizes. - RETURN emptyObjectToWriteTo -END FUNCTION -*/ + }, + }, + }; -function generateAllComponents(){ - const emptyObjectToWriteTo = {}; + function generateAllComponents(): Record { + const emptyObjectToWriteTo: Record = {}; - for(const[key, value] of Object.entries(componentMap)){ - try{ - const html = getBootstrapHTML(React.createElement(value.reactComponent, value.props)); - emptyObjectToWriteTo[key] = { - html: html, - size: html.length - }; - } catch(error){ - emptyObjectToWriteTo[key] = { - html: null, - size: 0 - }; + for (const [key, value] of Object.entries(componentMap)) { + try { + const html = getBootstrapHTML( + React.createElement(value.reactComponent as any, value.props) + ); + emptyObjectToWriteTo[key] = { + html: html, + size: html.length, + }; + } catch (error) { + console.error(`Error rendering component ${key}:`, error); + emptyObjectToWriteTo[key] = { + html: null, + size: 0, + }; } + } + return emptyObjectToWriteTo; } - return emptyObjectToWriteTo; -} - -/* - * 4. OJAS TODO: Write the results of generateAllComponents to a file. - * Same as below but since you ahve all the component data in a single hash map, you can just name it `components-${DATE_TIMESTAMP}.json` - * - * Exmaple: - * const results = generateAllComponent() - * - * Make sure you serialize(make data easy to store and read) the data before writing it to the file using JSON.stringify - */ -const fileName = `components-${OLD_DATE}.json`; -const filePath = path.join(__dirname, fileName); -const result = generateAllComponents() + const fileName = `components-${OLD_DATE}.json`; + const filePath = path.join(__dirname, fileName); + const result = generateAllComponents(); -fs.writeFileSync(filePath, JSON.stringify(result), 'utf8'); + fs.writeFileSync(filePath, JSON.stringify(result, null, 2), "utf8"); } const args = process.argv.slice(0); if (args[2]) { -convertToHTML(args[2]); -}; + convertToHTML(args[2]); +} diff --git a/packages/unity-react-core/scripts/check-element-changes-copy.js b/packages/unity-react-core/scripts/check-element-changes-copy.js index ecddabe65..17f12191f 100644 --- a/packages/unity-react-core/scripts/check-element-changes-copy.js +++ b/packages/unity-react-core/scripts/check-element-changes-copy.js @@ -2,34 +2,71 @@ const {diffChars, createPatch} = require('diff'); const { execSync, spawnSync } = require("child_process"); const { fstat } = require("fs"); const fs = require('fs'); -// import {convertToHTML} from "./check-changes"; const exec = require("child_process").exec; const path = require("path"); //===================================================== -// console log helpers +// Console log helpers //===================================================== const FgBlue = "\x1b[34m"; const FgGreen = "\x1b[32m"; - -const printLine = () => console.log(FgBlue, "-".repeat(84)); - -const printTitle = (text = "") => { - console.log(FgGreen, `${text + " ".repeat(84 - text.length)}`); -}; +const FgRed = "\x1b[31m"; +const FgYellow = "\x1b[33m"; +const Reset = "\x1b[0m"; + +const printLine = () => console.log(FgBlue, "-".repeat(84), Reset); +const printTitle = (text = "") => console.log(FgGreen, `${text + " ".repeat(84 - text.length)}`, Reset); +const printError = (text = "") => console.log(FgRed, text, Reset); +const printWarning = (text = "") => console.log(FgYellow, text, Reset); //===================================================== // Process files //===================================================== -const args = process.argv.slice(1); -const daysAgo = args [2]; -console.log(daysAgo); +const args = process.argv.slice(2); + +let daysAgo; + +if (args.length === 0) { + console.log(` +Usage: node check-element-changes-copy.js -d + +Options: + -d, --days Number of days ago to compare with + +Examples: + node check-element-changes-copy.js -d 7 # Compare with 7 days ago + node check-element-changes-copy.js -d 14 # Compare with 14 days ago + node check-element-changes-copy.js --days 30 # Compare with 30 days ago + `); + process.exit(1); +} + +if (args[0] === '-d' || args[0] === '--days') { + if (args.length < 2 || isNaN(parseInt(args[1]))) { + printError('Error: Please provide a valid number of days after -d flag'); + process.exit(1); + } + daysAgo = parseInt(args[1]); +} else if (args[0] && !isNaN(parseInt(args[0]))) { + // Backward compatibility: accept just the number + daysAgo = parseInt(args[0]); +} else { + printError('Error: Invalid arguments. Use -d format.'); + process.exit(1); +} + +printTitle(`Comparing components: current vs ${daysAgo} days ago`); const runGit = function (command) { - let commitHash = null; - const eg = execSync(command); - return eg.toString(); + try { + const result = execSync(command, { encoding: 'utf8' }); + return result.toString(); + } catch (error) { + printError(`Git command failed: ${command}`); + printError(error.message); + throw error; + } }; const parseDateForHTML = (days=0) => { @@ -38,121 +75,173 @@ const parseDateForHTML = (days=0) => { return d.getMonth() + 1 + "-" + d.getDate() + "-" + d.getFullYear(); }; -const parseDateForGIT = () => { +const parseDateForGIT = (daysAgo) => { const d = new Date(); d.setDate(d.getDate() - daysAgo); const date = d.toDateString(); const arrayDate = date.split(' '); const [day, month, dayOfMonth, year] = arrayDate; - const old_Date = month + " " + dayOfMonth + " " + year; - return old_Date; + return month + " " + dayOfMonth + " " + year; }; const OLD_DATE_HTML = parseDateForHTML(daysAgo); +const old_date_git = parseDateForGIT(daysAgo); -const old_date_git = parseDateForGIT(); +printTitle(`Getting commit from ${daysAgo} days ago (${old_date_git})...`); const gitOldCommitCommand = `git rev-list -1 --before="${old_date_git}" dev --format=medium`; - const runOldCommit = runGit(gitOldCommitCommand); const m = runOldCommit.match(/^commit\s+([a-f0-9]{40})/m); const commitHash = m ? m[1] : null; +if (!commitHash) { + printError(`No commit found for date: ${old_date_git}`); + process.exit(1); +} + +console.log(`✅ Found commit: ${commitHash}`); + +printTitle("Setting up temporary worktree..."); + +// Clean up existing temp directory +if (fs.existsSync("scripts/temp")) { + try { + runGit(`git worktree remove scripts/temp --force`); + } catch (e) { + // Ignore errors if worktree doesn't exist + } +} + const gitCheckout = `git worktree add scripts/temp ${commitHash}`; const runCheckout = runGit(gitCheckout); const targetDir = "scripts/temp/packages/unity-react-core/scripts"; -const dir = "scripts/temp/packages/unity-react-core" -const srcDir = "packages/unity-react-core/scripts/check-changes.tsx" -const htmlDir = "packages/shared/utils/html-utils.js" -fs.copyFileSync(srcDir, targetDir+"/check-changes.tsx") -fs.copyFileSync(htmlDir, "scripts/temp/"+htmlDir) -/** - * - * 1. OJAS TODO: We dont actually need to change directory, we can pass in the directory to the spawnSync command as the argument cwd: - */ - -//execSync(`npx tsx check-changes.tsx ${OLD_DATE_HTML}`); -console.log(process.cwd()); +const dir = "scripts/temp/packages/unity-react-core"; +const srcDir = "packages/unity-react-core/scripts/check-changes.tsx"; +const htmlDir = "packages/shared/utils/html-utils.js"; + +if (!fs.existsSync(targetDir)) { + fs.mkdirSync(targetDir, { recursive: true }); +} + +fs.copyFileSync(srcDir, targetDir + "/check-changes.tsx"); +fs.copyFileSync(htmlDir, "scripts/temp/" + htmlDir); + +printTitle(`Generating component HTML from ${daysAgo} days ago...`); + const output = spawnSync("npx", ["tsx", "scripts/check-changes.tsx", OLD_DATE_HTML], { stdio: "inherit", cwd: dir }); -/** - * * 5. OJAS TODO: We know the name of old components file and the location, so we can - * read it using fs.readFileSync after creating the OLD_FILE_LOCATION variable - * Example: - * const OLD_FILE_LOCATION = path.join(targetDir, `components-${OLD_DATE_HTML}.json`) - * const oldDateComponentObjectWithHtml = JSON.parse(fs.readFileSync(OLD_FILE_LOCATION, 'utf8)) - */ +if (output.error) { + printError(`Error generating old components: ${output.error.message}`); + process.exit(1); +} + const OLD_FILE_LOCATION = path.join(targetDir, `components-${OLD_DATE_HTML}.json`); + +if (!fs.existsSync(OLD_FILE_LOCATION)) { + printError(`Old components file not found: ${OLD_FILE_LOCATION}`); + process.exit(1); +} + const oldDateComponentObjectWithHtml = JSON.parse( fs.readFileSync(OLD_FILE_LOCATION, 'utf8') -) - +); +printTitle("Generating current component HTML..."); -/** - * 6. OJAS TODO: We can run the spawnSync("npx", ["tsx" command again but in the same directory of this file - * and we can pass in today's date. You can create a date at the current time by just instantiating `new Date()` - * and then you can get the month day and year same as in parseDateForHTML above - */ const currentOutput = spawnSync("npx", ["tsx", "packages/unity-react-core/scripts/check-changes.tsx", parseDateForHTML()], { stdio: "inherit" }); - -/** - * 7. OJAS TODO: Now that we have the current date components in a json file from step 6, - * we can read that file and compare that to the old data, `oldDateComponentObjectWithHtml` - */ -const currFilewithHtml = JSON.parse( - fs.readFileSync(`packages/unity-react-core/scripts/components-${parseDateForHTML()}.json`, 'utf8') -); - -for(const[key, value] of Object.entries(currFilewithHtml)){ - try{ - const htmlStr = currFilewithHtml[key].html - const oldHtmlStr = oldDateComponentObjectWithHtml[key].html - const differences = diffChars(oldHtmlStr, htmlStr); - console.log("x") - console.log(differences); - } catch(error){ - console.log(error, key); - } +if (currentOutput.error) { + printError(`Error generating current components: ${currentOutput.error.message}`); + process.exit(1); } +const currentFilePath = `packages/unity-react-core/scripts/components-${parseDateForHTML()}.json`; +if (!fs.existsSync(currentFilePath)) { + printError(`Current components file not found: ${currentFilePath}`); + process.exit(1); +} +const currFilewithHtml = JSON.parse( + fs.readFileSync(currentFilePath, 'utf8') +); +// Enhanced comparison with better UI +printLine(); +printTitle("COMPONENT COMPARISON RESULTS"); +printLine(); + +const currentComponents = currFilewithHtml.components || currFilewithHtml; +const oldComponents = oldDateComponentObjectWithHtml.components || oldDateComponentObjectWithHtml; + +let changedCount = 0; +let unchangedCount = 0; +let errorCount = 0; + +Object.keys(currentComponents).forEach(componentName => { + const current = currentComponents[componentName]; + const old = oldComponents[componentName]; + + try { + if (!current || !old) { + printError(`❌ ${componentName}: Missing component data`); + errorCount++; + return; + } + + // Handle both old and new data structures + const currentHtml = current.html || current; + const oldHtml = old.html || old; + + if (typeof currentHtml !== 'string' || typeof oldHtml !== 'string') { + printError(`❌ ${componentName}: Invalid HTML data`); + errorCount++; + return; + } + + const hasChanges = currentHtml !== oldHtml; + const currentSize = currentHtml.length; + const oldSize = oldHtml.length; + const sizeDiff = currentSize - oldSize; + + if (hasChanges) { + console.log(`🔄 ${componentName}: CHANGED`); + console.log(` Size: ${oldSize} → ${currentSize} (${sizeDiff > 0 ? '+' : ''}${sizeDiff} chars)`); + + // Show detailed diff for debugging (optional, can be commented out for cleaner output) + // const differences = diffChars(oldHtml, currentHtml); + // console.log(` Detailed differences:`, differences.filter(part => part.added || part.removed)); + + changedCount++; + } else { + console.log(`✅ ${componentName}: No changes`); + unchangedCount++; + } + } catch (error) { + printError(`❌ ${componentName}: Error during comparison - ${error.message}`); + errorCount++; + } +}); +printLine(); +printTitle("SUMMARY"); +console.log(`Changed: ${changedCount}`); +console.log(`Unchanged: ${unchangedCount}`); +console.log(`Errors: ${errorCount}`); +console.log(`Total: ${changedCount + unchangedCount + errorCount}`); +printLine(); + +try { + execSync(`git worktree remove --force scripts/temp`); + console.log(`✅ Cleaned up temporary worktree`); +} catch (e) { + printWarning(`Warning: Could not remove temp directory: ${e.message}`); +} - -execSync(`git worktree remove --force scripts/temp`); - -//convertToHTML(OLD_DATE_HTML); - - -// const GIT_COMMAND = `git whatchanged --since '${parseDateForGIT()}' --oneline --name-only --pretty=format: | sort | uniq`; - -// console.log(`Run GIT command '${GIT_COMMAND}'`); - -// runGit(GIT_COMMAND, (res = "") => { -// const fileTemplates = res -// .split(/\r\n|\r|\n/) -// .filter(elm => elm.match(/.*\.(templates?)/gi)); - -// printLine(); - -// fileTemplates.forEach(filePath => { -// const fileName = path.parse(filePath).name; -// const packageName = filePath.split(path.sep)[1]; -// printTitle(`${packageName}: ${fileName}`); -// printLine(); -// }); -// }); -//===================================================== - -// const v = execSync(gitOldCommitCommand); -// console.log(v.toString()); +process.exit(errorCount > 0 ? 1 : 0); diff --git a/packages/unity-react-core/tsconfig.json b/packages/unity-react-core/tsconfig.json index 4bddcddbb..62ea2f72d 100644 --- a/packages/unity-react-core/tsconfig.json +++ b/packages/unity-react-core/tsconfig.json @@ -10,7 +10,7 @@ "allowImportingTsExtensions": true, "esModuleInterop": true, "moduleResolution": "bundler", - "rootDir": "src", + "rootDirs": ["src", "scripts"], "module": "esnext", "declaration": true, "sourceMap": true, @@ -33,7 +33,8 @@ "types/**/*", "src/vite-env.d.ts", "shared/**/*", - "./scripts/check-changes.tsx" + "scripts/**/*.ts", + "scripts/**/*.tsx" ], "exclude": [ "dist",