diff --git a/index.html b/index.html
new file mode 100644
index 0000000..b286335
--- /dev/null
+++ b/index.html
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+ React Redux App
+
+
+
+
+
+
+
diff --git a/package-lock.json b/package-lock.json
index c8f69da..e22f8e5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@armco/icon",
- "version": "0.0.10",
+ "version": "0.0.11",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@armco/icon",
- "version": "0.0.10",
+ "version": "0.0.11",
"license": "ISC",
"dependencies": {
"@armco/utils": "^0.0.31"
@@ -15,6 +15,7 @@
"@armco/types": "^0.0.22",
"@types/node": "^24.10.0",
"@types/react": "^19.2.2",
+ "@types/react-dom": "^19.2.2",
"@vitejs/plugin-react": "^5.1.0",
"react": "^18.3.1",
"sass-embedded": "^1.93.3",
@@ -25,7 +26,7 @@
},
"peerDependencies": {
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.3.1"
}
},
"node_modules/@armco/configs": {
@@ -1832,6 +1833,16 @@
"csstype": "^3.0.2"
}
},
+ "node_modules/@types/react-dom": {
+ "version": "19.2.2",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.2.tgz",
+ "integrity": "sha512-9KQPoO6mZCi7jcIStSnlOWn2nEF3mNmyr3rIAsGnAbQKYbRLyqmeSc39EVgtxXVia+LMT8j3knZLAZAh+xLmrw==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "^19.2.0"
+ }
+ },
"node_modules/@vitejs/plugin-react": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-5.1.0.tgz",
diff --git a/package.json b/package.json
index 4eca87a..62a3ffb 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"module": "build/es/Icon.js",
"types": "build/types/Icon.d.ts",
"scripts": {
+ "dev": "vite --config vite-dev.config.ts",
"build": "./build-tools/build.sh",
"build:sm": "./build-tools/build.sh --dev",
"format": "prettier --write .",
@@ -28,7 +29,7 @@
},
"peerDependencies": {
"react": "^18.2.0",
- "react-dom": "^18.2.0"
+ "react-dom": "^18.3.1"
},
"prettier": "prettier-config-nick",
"repository": {
@@ -53,6 +54,7 @@
"@armco/types": "^0.0.22",
"@types/node": "^24.10.0",
"@types/react": "^19.2.2",
+ "@types/react-dom": "^19.2.2",
"@vitejs/plugin-react": "^5.1.0",
"react": "^18.3.1",
"sass-embedded": "^1.93.3",
diff --git a/publish.sh b/publish.sh
index e7e0563..4c9bcdf 100755
--- a/publish.sh
+++ b/publish.sh
@@ -6,11 +6,32 @@ set -e
npm --no-git-tag-version version ${semver}
npm run build
cp package.json build/
-sed -i '' -E 's/"build"/"*"/' build/package.json
-sed -i '' 's#"build/cjs/Icon.js"#"cjs/Icon.js"#' build/package.json
-sed -i '' 's#"build/es/Icon.js"#"es/Icon.js"#' build/package.json
-sed -i '' 's#"build/types/Icon.d.ts"#"types/Icon.d.ts"#' build/package.json
+# Use Node.js for portable package.json normalization
+# Pass the target path via env var to avoid Node treating it as a module/script argument
+PKG_PATH="$(pwd)/build/package.json" node - <<'EOF'
+const fs = require('fs');
+const path = process.env.PKG_PATH;
+const pkg = JSON.parse(fs.readFileSync(path, 'utf8'));
+pkg.private = false;
+delete pkg.scripts;
+delete pkg.devDependencies;
+
+if (!pkg.files) pkg.files = ['*'];
+else pkg.files = pkg.files.map(x => x === 'build' ? '*' : x);
+
+['main','module','types'].forEach(k => {
+ if (pkg[k]) {
+ pkg[k] = pkg[k]
+ .replace(/^build\//, '')
+ .replace('build/cjs/Icon.js', 'cjs/Icon.js')
+ .replace('build/es/Icon.js', 'es/Icon.js')
+ .replace('build/types/Icon.d.ts', 'types/Icon.d.ts');
+ }
+});
+
+fs.writeFileSync(path, JSON.stringify(pkg, null, 2) + '\n');
+EOF
cd build
npm publish --access public --loglevel verbose
diff --git a/src/Test.tsx b/src/Test.tsx
new file mode 100644
index 0000000..e6bd45f
--- /dev/null
+++ b/src/Test.tsx
@@ -0,0 +1,6 @@
+import ReactDOM from "react-dom/client"
+import Icon from "./Icon"
+
+const root = ReactDOM.createRoot(document.getElementById("root") as HTMLElement)
+
+root.render()
diff --git a/vite-dev.config.ts b/vite-dev.config.ts
index b41c669..dde33a4 100644
--- a/vite-dev.config.ts
+++ b/vite-dev.config.ts
@@ -1,45 +1,23 @@
import { resolve } from "path"
import { defineConfig } from "vitest/config"
import react from "@vitejs/plugin-react"
-import dts from "vite-plugin-dts"
-import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js"
-import { externalizeDeps } from "vite-plugin-externalize-deps"
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
react(),
- dts({ outDir: "build/types" }),
- cssInjectedByJsPlugin({
- jsAssetsFilterFunction: (chunk) => chunk.fileName.includes("Icon"),
- }),
- externalizeDeps(),
],
+ server: {
+ open: true,
+ },
build: {
outDir: "build",
- lib: {
- entry: [
- resolve(__dirname, "src/helper.ts"),
- resolve(__dirname, "src/Icon.tsx"),
- ],
- },
sourcemap: true,
- rollupOptions: {
- treeshake: true,
- output: [
- {
- format: "es",
- dir: "build/es",
- entryFileNames: "[name].js",
- chunkFileNames: "[name].js",
- },
- {
- format: "cjs",
- dir: "build/cjs",
- entryFileNames: "[name].js",
- chunkFileNames: "[name].js",
- },
- ],
- },
+ },
+ test: {
+ globals: true,
+ environment: "jsdom",
+ setupFiles: "src/setupTests",
+ mockReset: true,
},
})