Updated publish script to make it compatible with jenkins pod
All checks were successful
armco-org/icon/pipeline/head This commit looks good
All checks were successful
armco-org/icon/pipeline/head This commit looks good
This commit is contained in:
14
index.html
Normal file
14
index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>React Redux App</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/Test.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
17
package-lock.json
generated
17
package-lock.json
generated
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
29
publish.sh
29
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
|
||||
|
||||
6
src/Test.tsx
Normal file
6
src/Test.tsx
Normal file
@@ -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(<Icon icon="ci.CiAlignBottom" />)
|
||||
@@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user