Backing up
This commit is contained in:
155
.gitignore
vendored
155
.gitignore
vendored
@@ -46,3 +46,158 @@ backlog.yml
|
||||
Lottie Structure.txt
|
||||
LottieSchema.json
|
||||
.hintrc
|
||||
|
||||
icon
|
||||
avatar
|
||||
imageeditor
|
||||
calendar
|
||||
Anchor
|
||||
DroppableContainer
|
||||
Droppable
|
||||
Accordion
|
||||
Badge
|
||||
Button
|
||||
ColorSelector
|
||||
Dropdown
|
||||
Link
|
||||
Mask
|
||||
NumericStepper
|
||||
PickerRange
|
||||
Pillbox
|
||||
PopoverV2
|
||||
Radio
|
||||
Segment
|
||||
Slider
|
||||
Table
|
||||
TextArea
|
||||
Toggle
|
||||
TypeAhead
|
||||
AlertStackManager
|
||||
Application
|
||||
ArViz
|
||||
Blog
|
||||
BubbleChart
|
||||
Carousel
|
||||
Content
|
||||
CronTab
|
||||
DetailsPanel
|
||||
EcommOrders
|
||||
ErrorBoundary
|
||||
layout
|
||||
Card
|
||||
Label
|
||||
Draggable
|
||||
AdvancedColorPicker
|
||||
Breadcrumb
|
||||
Checkbox
|
||||
DateInput
|
||||
LabelValue
|
||||
List
|
||||
Modal
|
||||
Pagination
|
||||
Picklist
|
||||
Popover
|
||||
ProgressIndicator
|
||||
SearchField
|
||||
Select
|
||||
Tab
|
||||
Tag
|
||||
TextInput
|
||||
Tooltip
|
||||
Widget
|
||||
AlphabetFilter
|
||||
ArIconsViewer
|
||||
Banner
|
||||
Brands
|
||||
BubbleViz
|
||||
CategoryFilter
|
||||
ContextMenu
|
||||
Cta
|
||||
Download
|
||||
EcommProducts
|
||||
uploader
|
||||
Component_404
|
||||
Text
|
||||
Image
|
||||
Alert
|
||||
BrowserIncompatibility
|
||||
ColorPicker
|
||||
Dialog
|
||||
LearnLink
|
||||
Loader
|
||||
Notification
|
||||
Password
|
||||
Pill
|
||||
PopoverV1
|
||||
ProgressStepper
|
||||
SegmentedControl
|
||||
SelectionPill
|
||||
TabBar
|
||||
Tags
|
||||
TimeEntry
|
||||
TreeList
|
||||
AboutUs
|
||||
AppAndToolsSelector
|
||||
ArmcoIamProvider
|
||||
Benefits
|
||||
Breadcrumbs
|
||||
Careers
|
||||
Contact
|
||||
Cookies
|
||||
Dashboard
|
||||
Drawer
|
||||
Empty
|
||||
FacetedFilter
|
||||
Filters
|
||||
Form
|
||||
GraphTiles
|
||||
HowItWorks
|
||||
InstaPhotos
|
||||
LoginProvider
|
||||
Newsletter
|
||||
Portfolio
|
||||
ProductInfo
|
||||
RepeatRenderer
|
||||
SecondaryNavigation
|
||||
SignInUp
|
||||
Stats
|
||||
Suggestions
|
||||
Testimonials
|
||||
Toolbar
|
||||
Users
|
||||
Wizard
|
||||
Faq
|
||||
FlexTools
|
||||
Gallery
|
||||
Header
|
||||
HttpCode
|
||||
Integrations
|
||||
LogoClouds
|
||||
Notifications
|
||||
Pricing
|
||||
ProgressiveBarChart
|
||||
Reviews
|
||||
Services
|
||||
Snackbar
|
||||
Steps
|
||||
Swiper
|
||||
Tiles
|
||||
TransferShuttle
|
||||
Features
|
||||
Footer
|
||||
Graph
|
||||
Hero
|
||||
InlineMenu
|
||||
LayoutGenerator
|
||||
Main
|
||||
Portal
|
||||
ProductDescriptionTile
|
||||
Projects
|
||||
ScrollPagination
|
||||
SidePanel
|
||||
Splitter
|
||||
StuffleIamProvider
|
||||
Team
|
||||
Toast
|
||||
UserOptions
|
||||
WizardModal
|
||||
6
ListItem/package.json
Normal file
6
ListItem/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "@armco/components/ListItem",
|
||||
"main": "../../shared-components/build/cjs/ListItem.js",
|
||||
"module": "../../shared-components/build/es/ListItem.js",
|
||||
"types": "../../shared-components/buildtypes/ListItem.d.ts"
|
||||
}
|
||||
6
MenuButton/package.json
Normal file
6
MenuButton/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "@armco/components/MenuButton",
|
||||
"main": "../../shared-components/build/cjs/MenuButton.js",
|
||||
"module": "../../shared-components/build/es/MenuButton.js",
|
||||
"types": "../../shared-components/buildtypes/MenuButton.d.ts"
|
||||
}
|
||||
36
build-tools/build.sh
Executable file
36
build-tools/build.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Get the directory of the current script
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Default values
|
||||
DEV_FLAG=""
|
||||
|
||||
# Parse arguments
|
||||
for arg in "$@"
|
||||
do
|
||||
case $arg in
|
||||
--dev)
|
||||
DEV_FLAG="--dev"
|
||||
shift # Remove --dev from processing
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "[BUILD:SH] Dev flag is: $DEV_FLAG"
|
||||
echo "[BUILD:SH] Removing build if exists"
|
||||
rm -rf build
|
||||
echo "[BUILD:SH] Running TypeScript Validations"
|
||||
npx tsc
|
||||
echo "[BUILD:SH] Initiating build..."
|
||||
# Conditionally use vite-dev.config.ts if --dev flag is present
|
||||
if [ "$DEV_FLAG" == "--dev" ]; then
|
||||
vite build --config vite-dev.config.ts
|
||||
else
|
||||
vite build
|
||||
fi
|
||||
|
||||
echo "[BUILD:SH] Running post processor scripts from $SCRIPT_DIR/post-processor.js"
|
||||
# Run Post processors: Update style imports in .js files, create component modules
|
||||
node "$SCRIPT_DIR/post-processor.js" build/cjs $DEV_FLAG
|
||||
node "$SCRIPT_DIR/post-processor.js" build/es $DEV_FLAG
|
||||
47
build-tools/generate-module.js
Normal file
47
build-tools/generate-module.js
Normal file
@@ -0,0 +1,47 @@
|
||||
import { promises as fs } from "fs"
|
||||
import { dirname, resolve } from "path"
|
||||
import { fileURLToPath } from "url"
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = dirname(__filename)
|
||||
|
||||
const exclusions = ["enums.js", "v4.js", "index.js"]
|
||||
|
||||
async function generateModule(fileName, isDev) {
|
||||
if (!exclusions.includes(fileName)) {
|
||||
let packageJsonContent, dirPath
|
||||
|
||||
if (fileName.startsWith("@armco")) {
|
||||
const moduleName = fileName.split("/")[1]
|
||||
const name = `@armco/components/${moduleName}`
|
||||
dirPath = resolve(__dirname, `../${isDev ? "" : "build/"}${moduleName}`)
|
||||
const basepath = `../../../${fileName}/`
|
||||
packageJsonContent = {
|
||||
name,
|
||||
main: `${basepath}${isDev ? "build/" : ""}cjs/index.js`,
|
||||
module: `${basepath}${isDev ? "build/" : ""}es/index.js`,
|
||||
types: `${basepath}${isDev ? "build/" : ""}types/index.d.ts`,
|
||||
}
|
||||
} else {
|
||||
dirPath = resolve(__dirname, `../${isDev ? "" : "build/"}${fileName}`)
|
||||
const basepath = `../../shared-components${isDev ? "/build" : ""}`
|
||||
packageJsonContent = {
|
||||
name: `@armco/components/${fileName}`,
|
||||
main: `${basepath}/cjs/${fileName}.js`,
|
||||
module: `${basepath}/es/${fileName}.js`,
|
||||
types: `${basepath}types/${fileName}.d.ts`,
|
||||
}
|
||||
}
|
||||
try {
|
||||
await fs.mkdir(dirPath, { recursive: true })
|
||||
await fs.writeFile(
|
||||
resolve(dirPath, "package.json"),
|
||||
JSON.stringify(packageJsonContent, null, 2),
|
||||
)
|
||||
} catch (error) {
|
||||
console.error(`Error processing directory ${dirPath}:`, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default generateModule
|
||||
@@ -1,58 +0,0 @@
|
||||
import fs from "fs"
|
||||
import { resolve } from "path"
|
||||
import { PluginOption } from "vite"
|
||||
import { LibCssOptions } from "./injectLibCss.d"
|
||||
|
||||
let viteConfig
|
||||
|
||||
const injectLibCss = function (options: LibCssOptions = {}): PluginOption {
|
||||
return {
|
||||
name: "ar-lib-css",
|
||||
apply: "build",
|
||||
enforce: "post",
|
||||
|
||||
configResolved(resolvedConfig) {
|
||||
viteConfig = resolvedConfig
|
||||
},
|
||||
|
||||
writeBundle(option, bundle) {
|
||||
if (!viteConfig.build || !viteConfig.build.lib) {
|
||||
// only for lib build
|
||||
console.warn("vite-plugin-libcss only works in lib mode.")
|
||||
return
|
||||
}
|
||||
if (option.format !== "es") {
|
||||
// only for es built
|
||||
return
|
||||
}
|
||||
const files = Object.keys(bundle)
|
||||
const cssFile = files.find((v) => v.endsWith(".css"))
|
||||
if (!cssFile) {
|
||||
return
|
||||
}
|
||||
for (const file of files) {
|
||||
if (!(bundle[file] as any).isEntry) {
|
||||
// only for entry
|
||||
continue
|
||||
}
|
||||
if (
|
||||
options.exclude &&
|
||||
(options.exclude as Array<string>).findIndex((ex) =>
|
||||
file.startsWith(ex + "/"),
|
||||
) > -1
|
||||
) {
|
||||
// check if the file matches the include pattern
|
||||
continue
|
||||
}
|
||||
const outDir = viteConfig.build.outDir || "dist"
|
||||
const filePath = resolve(viteConfig.root, outDir, file)
|
||||
const data = fs.readFileSync(filePath, {
|
||||
encoding: "utf8",
|
||||
})
|
||||
fs.writeFileSync(filePath, `import './${cssFile}';\n${data}`)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export default injectLibCss
|
||||
87
build-tools/post-processor.js
Normal file
87
build-tools/post-processor.js
Normal file
@@ -0,0 +1,87 @@
|
||||
import { promises as fs, readdir } from "fs"
|
||||
import { fileURLToPath } from "url"
|
||||
import path from "path"
|
||||
import generateModule from "./generate-module.js"
|
||||
|
||||
// Get the directory name of the current module
|
||||
const __filename = fileURLToPath(import.meta.url)
|
||||
const __dirname = path.dirname(__filename)
|
||||
|
||||
// Path to the original file
|
||||
const componentsExportPath = path.resolve(__dirname, "../build/es/index.js")
|
||||
const exclusions = ["@armco/shared-components"]
|
||||
|
||||
function extractStandaloneComponents(content) {
|
||||
const exclusions = ["@armco/shared-components"]
|
||||
const imports = new Set()
|
||||
|
||||
// Regex to match @armco/* strings
|
||||
const armcoRegex = /@armco\/[^'"]+/g
|
||||
|
||||
let match
|
||||
while ((match = armcoRegex.exec(content)) !== null) {
|
||||
if (!exclusions.some((exclusion) => match[0].includes(exclusion))) {
|
||||
imports.add(match[0])
|
||||
}
|
||||
}
|
||||
|
||||
return Array.from(imports)
|
||||
}
|
||||
|
||||
function extractSharedComponents(content) {
|
||||
const imports = new Set()
|
||||
|
||||
// Regex to match lines starting with import and capture the last part
|
||||
const importRegex =
|
||||
/import\s+\{[^}]+\}\s+from\s+['"][^'"]+\/([^'"]+)\.js['"]/g
|
||||
|
||||
let match
|
||||
while ((match = importRegex.exec(content)) !== null) {
|
||||
imports.add(match[1])
|
||||
}
|
||||
|
||||
return Array.from(imports)
|
||||
}
|
||||
// Function to capture exports
|
||||
async function captureExports(isDev) {
|
||||
const sharedComponentsExportPath = isDev
|
||||
? path.resolve(
|
||||
__dirname,
|
||||
"../../../node_modules/@armco/shared-components/build/es/index.js",
|
||||
)
|
||||
: path.resolve(
|
||||
__dirname,
|
||||
"../node_modules/@armco/shared-components/es/index.js",
|
||||
)
|
||||
let content = await fs.readFile(componentsExportPath, "utf-8")
|
||||
let exports = extractStandaloneComponents(content)
|
||||
content = await fs.readFile(sharedComponentsExportPath, "utf-8")
|
||||
return exports.concat(extractSharedComponents(content))
|
||||
}
|
||||
|
||||
async function postProcessor(dir, isDev) {
|
||||
try {
|
||||
captureExports(isDev)
|
||||
.then(
|
||||
async (files) =>
|
||||
await Promise.all(
|
||||
files.map(async (file) => {
|
||||
await generateModule(file, isDev)
|
||||
}),
|
||||
),
|
||||
)
|
||||
.catch((err) => console.error("Error capturing exports:", err))
|
||||
} catch (error) {
|
||||
console.error(`Error processing directory ${dir}:`, error)
|
||||
}
|
||||
}
|
||||
|
||||
const targetDir = process.argv[2]
|
||||
const isDev = process.argv.includes("--dev")
|
||||
|
||||
if (targetDir) {
|
||||
postProcessor(targetDir, isDev)
|
||||
} else {
|
||||
console.error("Please provide the build directory to run post processor on.")
|
||||
process.exit(1)
|
||||
}
|
||||
11
build-tools/temp-index.js
Normal file
11
build-tools/temp-index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { default as e } from "@armco/icon";
|
||||
import { default as a } from "@armco/avatar";
|
||||
import { default as x } from "@armco/imageeditor";
|
||||
export * from "@armco/calendar";
|
||||
export * from "@armco/layout";
|
||||
export * from "@armco/uploader";
|
||||
export {
|
||||
a as Avatar,
|
||||
e as Icon,
|
||||
x as ImageEditor
|
||||
};
|
||||
33187
package-lock.json
generated
33187
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
96
package.json
96
package.json
@@ -1,14 +1,15 @@
|
||||
{
|
||||
"name": "@armco/components",
|
||||
"description": "React Component Library for Armco's stack of products and services",
|
||||
"version": "0.0.54",
|
||||
"version": "0.0.60",
|
||||
"type": "module",
|
||||
"author": "Armco (@restruct-corporate-advantage)",
|
||||
"types": "build/types/index.d.ts",
|
||||
"main": "build/cjs/index.js",
|
||||
"module": "build/es/index.js",
|
||||
"scripts": {
|
||||
"build": "rm -rf build && tsc && vite build",
|
||||
"build": "./build-tools/build.sh",
|
||||
"build:sm": "./build-tools/build.sh --dev",
|
||||
"component": "plop component",
|
||||
"lint": "eslint .",
|
||||
"publish:dry": "npm publish --dry-run",
|
||||
@@ -16,93 +17,26 @@
|
||||
"publish:sh": "./publish.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"@armco/avatar": "^0.0.4",
|
||||
"@armco/calendar": "^0.0.4",
|
||||
"@armco/icon": "^0.0.6",
|
||||
"@armco/imageeditor": "^0.0.6",
|
||||
"@armco/layout": "^0.0.6",
|
||||
"@armco/shared-components": "^0.0.53",
|
||||
"@armco/uploader": "^0.0.3",
|
||||
"@armco/utils": "^0.0.18",
|
||||
"@lottiefiles/react-lottie-player": "^3.5.3",
|
||||
"@popperjs/core": "^2.11.8",
|
||||
"@reduxjs/toolkit": "^1.8.1",
|
||||
"bootstrap": "^5.3.0",
|
||||
"classnames": "^2.3.2",
|
||||
"@tanstack/react-table": "^8.21.2",
|
||||
"d3": "^7.9.0",
|
||||
"highcharts": "^11.2.0",
|
||||
"highcharts-react-official": "^3.2.1",
|
||||
"highlight.js": "^11.8.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
"lottie-react": "^2.4.0",
|
||||
"lottie-web": "^5.12.2",
|
||||
"moment": "^2.29.4",
|
||||
"react-app-polyfill": "^3.0.0",
|
||||
"react-bootstrap": "^2.7.4",
|
||||
"react-dev-utils": "^12.0.1",
|
||||
"react-dnd": ">=16.0.0",
|
||||
"react-dnd-html5-backend": ">=16.0.0",
|
||||
"react-dnd-touch-backend": ">=16.0.0",
|
||||
"react-draggable": "^4.4.6",
|
||||
"react-redux": "^8.0.1",
|
||||
"react-resizable": "^3.0.5",
|
||||
"react-router-dom": "^6.13.0",
|
||||
"react-table": "^7.8.0",
|
||||
"resize-observer-polyfill": "^1.5.1",
|
||||
"svgpath": "^2.6.0",
|
||||
"uuid": "^9.0.0",
|
||||
"vite-plugin-svgr": "^3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@armco/types": "^0.0.11",
|
||||
"@babel/preset-env": "^7.24.5",
|
||||
"@babel/preset-react": "^7.24.1",
|
||||
"@babel/preset-typescript": "^7.24.1",
|
||||
"@testing-library/dom": "^9.2.0",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/user-event": "^14.2.5",
|
||||
"@types/bootstrap": "^5.2.6",
|
||||
"@types/d3": "^7.4.0",
|
||||
"@types/js-cookie": "^3.0.3",
|
||||
"@types/react": "^18.0.15",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/react-resizable": "^3.0.7",
|
||||
"@types/react-table": "^7.7.19",
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@types/uuid": "^9.0.2",
|
||||
"@vitejs/plugin-react": "^4.0.0",
|
||||
"chalk": "^5.3.0",
|
||||
"cherry-pick": "^0.5.0",
|
||||
"cpy-cli": "^5.0.0",
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"execa": "^8.0.1",
|
||||
"fs-extra": "^11.2.0",
|
||||
"glob": "^10.3.10",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"jsdom": "^21.1.0",
|
||||
"plop": "^3.1.2",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-config-nick": "^1.0.2",
|
||||
"prop-types": "^15.8.1",
|
||||
"react": ">=16.8.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.63.4",
|
||||
"ts-jest": "^29.2.3",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.0.2",
|
||||
"vite": "^4.0.0",
|
||||
"vite-plugin-dts": "^3.7.1",
|
||||
"vite-plugin-externalize-deps": "^0.8.0",
|
||||
"vite-plugin-lib-inject-css": "^2.1.1",
|
||||
"vitest": "^0.30.1"
|
||||
"lottie-web": "^5.12.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16.8.0",
|
||||
"@armco/types": "^0.0.18",
|
||||
"@armco/utils": "^0.0.29",
|
||||
"@armco/icon": "^0.0.10",
|
||||
"@armco/sam-editor": "^0.0.5",
|
||||
"@armco/uploader": "^0.0.5",
|
||||
"@armco/avatar": "^0.0.6",
|
||||
"@armco/calendar": "^0.0.7",
|
||||
"@armco/imageeditor": "^0.0.8",
|
||||
"@armco/shared-components": "^0.0.57",
|
||||
"react": "^18.2.0",
|
||||
"react-dnd": ">=16.0.0",
|
||||
"react-dnd-html5-backend": ">=16.0.0",
|
||||
"react-dnd-touch-backend": ">=16.0.0",
|
||||
|
||||
6
sam-editor/package.json
Normal file
6
sam-editor/package.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "@armco/components/sam-editor",
|
||||
"main": "../../../@armco/sam-editor/build/cjs/index.js",
|
||||
"module": "../../../@armco/sam-editor/build/es/index.js",
|
||||
"types": "../../../@armco/sam-editor/build/types/index.d.ts"
|
||||
}
|
||||
156
scripts/build.sh
156
scripts/build.sh
@@ -1,156 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
copy_files() {
|
||||
local source_dir="$1"
|
||||
local destination_dir="$2"
|
||||
local files_to_copy=".tsx|.scss"
|
||||
|
||||
echo "Copying files from $source_dir to $destination_dir"
|
||||
find "$source_dir" -type f \( -name "*.tsx" -o -name "*.scss" \) | while read -r file; do
|
||||
# Check if the file has one of the specified extensions
|
||||
for ext in $(echo "$files_to_copy" | tr '|' '\n'); do
|
||||
if echo "$file" | grep -q "$ext$"; then
|
||||
destination_file="$destination_dir/$(basename "$file")"
|
||||
# Create destination directory if it doesn't exist
|
||||
mkdir -p "$(dirname "$destination_file")"
|
||||
# echo "Copying $file to $destination_file"
|
||||
cp "$file" "$destination_file"
|
||||
echo "Copied $file to $destination_file"
|
||||
break # Exit the loop after finding a match
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
search_replace_in_files() {
|
||||
local directory_or_file="$1"
|
||||
local search_string="$2"
|
||||
local replace_string="$3"
|
||||
local -a dir_names=("${@:4}") # Accept array of directory names as arguments
|
||||
|
||||
echo "Initiate search and replace in files $search_string $replace_string"
|
||||
|
||||
# Step 1: Check if the argument is a file
|
||||
if [ -f "$directory_or_file" ]; then
|
||||
# Process the single file
|
||||
perl -pi -e "s|$search_string|$replace_string|g" "$directory_or_file"
|
||||
else
|
||||
# Step 2: Get all files recursively matching the condition (only .tsx and .scss)
|
||||
files=$(find "$directory_or_file" -type f \( -name "*.tsx" -o -name "*.scss" -o -name "*.ts" \))
|
||||
# Step 3: Iterate over each file and perform search and replace
|
||||
for file in $files; do
|
||||
# Step 4: Iterate over each directory name in the array
|
||||
for dir_name in "${dir_names[@]}"; do
|
||||
# Step 5: Check if the file name starts with any of the specified directories
|
||||
if [[ "$file" == *"/$dir_name/"* ]]; then
|
||||
echo "Skipping file $file as it starts with '$dir_name/'"
|
||||
continue 2 # Continue to the next iteration of the outer loop
|
||||
fi
|
||||
done
|
||||
# Step 6: Perform search and replace in each file using perl
|
||||
perl -pi -e "s|$search_string|$replace_string|g" "$file"
|
||||
done
|
||||
fi
|
||||
|
||||
echo "Search and replace in TypeScript and SCSS files completed."
|
||||
}
|
||||
|
||||
generate_modules() {
|
||||
input_dir=$1
|
||||
output_dir=$1
|
||||
|
||||
for file in $(find "$input_dir" -name "*.js"); do
|
||||
filename=$(basename "$file")
|
||||
base="${filename%.*}"
|
||||
relative_dir=$(dirname "${file#"$input_dir/"}")
|
||||
dir="$output_dir/$relative_dir/$base"
|
||||
mkdir -p "$dir"
|
||||
echo '{
|
||||
"name": "@armco/armory-react-components/'$relative_dir/$base'",
|
||||
"private": true,
|
||||
"main": "../'$relative_dir/$base'.js",
|
||||
"module": "../'$relative_dir/$base'.js",
|
||||
"typings": "../'$relative_dir/$base'.d.ts"
|
||||
}' > "$dir/package.json"
|
||||
done
|
||||
}
|
||||
|
||||
# Function to split the string into an array based on a delimiter
|
||||
split_string() {
|
||||
local string="$1"
|
||||
local delimiter="$2"
|
||||
IFS="$delimiter" read -r -a array <<< "$string"
|
||||
echo "${array[@]}"
|
||||
}
|
||||
|
||||
rm -rf ./lib
|
||||
mkdir -p "./lib"
|
||||
|
||||
file_types=("utils" "config" "static" "store" "hooks" "contexts")
|
||||
ignore_dirs=("hooks" "utils" "utils" "hooks" "" "hooks")
|
||||
|
||||
copy_files "src/app/components/atoms" "lib"
|
||||
copy_files "src/app/components/molecules" "lib"
|
||||
cp src/app/components/index.ts lib/atoms.ts
|
||||
cp src/app/components/index.ts lib/molecules.ts
|
||||
cp src/app/components/components.ts lib/index.ts
|
||||
cp src/app/components/dependencies.ts lib/dependencies.ts
|
||||
cp -r src/app/utils lib
|
||||
cp -r src/app/config lib
|
||||
cp -r src/app/static lib
|
||||
cp -r src/app/contexts lib
|
||||
cp -r src/app/hooks lib
|
||||
rm -rf lib/static/styles/*
|
||||
cp src/app/static/styles/_mixins.scss lib/static/styles/mixins.scss
|
||||
cp src/app/static/styles/_variables.scss lib/static/styles/variables.scss
|
||||
cp src/app/static/styles/_animations.scss lib/static/styles/animations.scss
|
||||
cp src/app/static/styles/index.scss lib/static/styles/index.scss
|
||||
cp -r src/app/hooks "lib"
|
||||
cp src/react-app-env.d.ts lib
|
||||
cp src/vite-env.d.ts lib
|
||||
cp package.json lib
|
||||
cp src/app/components/Carousel/cssClasses.ts "lib"
|
||||
cp src/app/components/Carousel/animations.ts "lib"
|
||||
cp src/app/store.ts "lib"
|
||||
|
||||
for i in $(seq 0 $((${#file_types[@]} - 1))); do
|
||||
echo ${file_types[i]} ${ignore_dirs[i]}
|
||||
ignore_dirs_array=($(split_string "${ignore_dirs[i]}" " "))
|
||||
search_replace_in_files "lib" "\.\./\.\./\.\./${file_types[i]}" "./${file_types[i]}" "${ignore_dirs_array[@]}"
|
||||
search_replace_in_files "lib" "\.\./\.\./${file_types[i]}" "./${file_types[i]}" "${ignore_dirs_array[@]}"
|
||||
search_replace_in_files "lib" "\.\./${file_types[i]}" "./${file_types[i]}" "${ignore_dirs_array[@]}"
|
||||
done
|
||||
|
||||
search_replace_in_files "lib/utils/helper.tsx" "\.\./components/molecules" ".."
|
||||
# Replace atoms and molecules imports
|
||||
search_replace_in_files "lib/Slot.tsx" "\.\./\.\./atoms" "./atoms"
|
||||
search_replace_in_files "lib/Slot.tsx" "\.\./\.\./molecules" "./molecules"
|
||||
search_replace_in_files "lib/FlexContent.tsx" "\.\./\.\./atoms" "./atoms"
|
||||
search_replace_in_files "lib/FlexContent.tsx" "\.\./\.\./molecules" "./molecules"
|
||||
search_replace_in_files "lib/DroppableContainer.tsx" "\.\./\.\./atoms" "./atoms"
|
||||
search_replace_in_files "lib/DroppableContainer.tsx" "\.\./\.\./molecules" "./molecules"
|
||||
|
||||
# Normalize imports for secondary components
|
||||
search_replace_in_files "lib/molecules.ts" "\./TextFormatter/ColorSelectorRadio" "./ColorSelectorRadio"
|
||||
search_replace_in_files "lib/molecules.ts" "\./TextFormatter/TextTool" "./TextTool"
|
||||
search_replace_in_files "lib/atoms.ts" "\./SegmentedControl/Segment" "./Segment"
|
||||
|
||||
search_replace_in_files "lib/package.json" "\./build/index" "index"
|
||||
search_replace_in_files "lib" "\"\.\./\.\.\"" "\"..\""
|
||||
search_replace_in_files "lib/static/LottieConfigs/presets" "\.\./\.\./\.\./components" "../../.."
|
||||
search_replace_in_files "lib/index.ts" "\.\./static/styles" "./static/styles"
|
||||
|
||||
sed '/componentsViewerPage/d' lib/store.ts > temp_file && mv temp_file lib/store.ts
|
||||
sed '/iconsPage/d' lib/store.ts > temp_file && mv temp_file lib/store.ts
|
||||
sed '/iconPage/d' lib/store.ts > temp_file && mv temp_file lib/store.ts
|
||||
sed '/tasksPage/d' lib/store.ts > temp_file && mv temp_file lib/store.ts
|
||||
|
||||
search_replace_in_files "lib" "\"\.\.\"" "\"\.\""
|
||||
search_replace_in_files "lib/hooks/useStateWithHistory.ts" "\.\./components" ".."
|
||||
search_replace_in_files "lib/Resizable.tsx" "\.\./Slot" "./Slot"
|
||||
search_replace_in_files "lib/utils/formatterUtils.ts" "\.\./components" ".."
|
||||
# generate_modules "build"
|
||||
|
||||
rm -rf build
|
||||
npm run build:publish:compile
|
||||
@@ -1,5 +1,6 @@
|
||||
@use "bootstrap/scss/bootstrap.scss";
|
||||
@use "@armco/shared-components/es/assets/index.css";
|
||||
@import url("https://static.armco.tech/font/Allerta Stencil");
|
||||
@import url("https://static.armco.tech/font/Noto Sans Chakma");
|
||||
// @use "@armco/shared-components/es/assets/index.css";
|
||||
@use "@armco/shared-components/build/es/assets/index.css";
|
||||
@import url("https://static.armco.dev/font/Allerta Stencil");
|
||||
@import url("https://static.armco.dev/font/Noto Sans Chakma");
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ export * from "@armco/shared-components"
|
||||
export { default as Icon } from "@armco/icon"
|
||||
export { default as Avatar } from "@armco/avatar"
|
||||
export { default as ImageEditor } from "@armco/imageeditor"
|
||||
export * from "@armco/sam-editor"
|
||||
export { default as SamEditor } from "@armco/sam-editor"
|
||||
export * from "@armco/calendar"
|
||||
export * from "@armco/layout"
|
||||
export { default as Calendar } from "@armco/calendar"
|
||||
export * from "@armco/uploader"
|
||||
export { default as Uploader } from "@armco/uploader"
|
||||
|
||||
42
vite-dev.config.ts
Normal file
42
vite-dev.config.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { resolve } from "path"
|
||||
import { glob } from "glob"
|
||||
import { defineConfig } from "vitest/config"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import dts from "vite-plugin-dts"
|
||||
import { libInjectCss } from "vite-plugin-lib-inject-css"
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react(), libInjectCss(), dts({ outDir: "build/types" })],
|
||||
build: {
|
||||
outDir: "build",
|
||||
lib: {
|
||||
entry: glob.sync(resolve(__dirname, "src/**/!(*.d).{ts,tsx}")),
|
||||
},
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
treeshake: true,
|
||||
external: [
|
||||
new RegExp("react*"),
|
||||
new RegExp("highcharts*"),
|
||||
new RegExp("@armco/*"),
|
||||
"d3",
|
||||
"uuid",
|
||||
],
|
||||
output: [
|
||||
{
|
||||
format: "es",
|
||||
dir: "build/es",
|
||||
entryFileNames: "[name].js",
|
||||
chunkFileNames: "[name]-chunk.js",
|
||||
},
|
||||
{
|
||||
format: "cjs",
|
||||
dir: "build/cjs",
|
||||
entryFileNames: "[name].js",
|
||||
chunkFileNames: "[name]-chunk.js",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
Reference in New Issue
Block a user