Fixed compile errors, added publish scripts
This commit is contained in:
0
.github/workflows.yml
vendored
0
.github/workflows.yml
vendored
@@ -1,20 +0,0 @@
|
||||
import type { StorybookConfig } from "@storybook/react-vite"
|
||||
const config: StorybookConfig = {
|
||||
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
||||
addons: [
|
||||
"@storybook/addon-links",
|
||||
"@storybook/addon-essentials",
|
||||
"@storybook/addon-interactions",
|
||||
],
|
||||
framework: {
|
||||
name: "@storybook/react-vite",
|
||||
options: {},
|
||||
},
|
||||
docs: {
|
||||
autodocs: "tag",
|
||||
},
|
||||
core: {
|
||||
disableTelemetry: true,
|
||||
},
|
||||
}
|
||||
export default config
|
||||
@@ -1,15 +0,0 @@
|
||||
import type { Preview } from "@storybook/react"
|
||||
|
||||
const preview: Preview = {
|
||||
parameters: {
|
||||
actions: { argTypesRegex: "^on[A-Z].*" },
|
||||
controls: {
|
||||
matchers: {
|
||||
color: /(background|color)$/i,
|
||||
date: /Date$/,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
export default preview
|
||||
20368
package-lock.json
generated
20368
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
48
package.json
48
package.json
@@ -1,31 +1,32 @@
|
||||
{
|
||||
"name": "@armco/components",
|
||||
"description": "React Component Library for Armco's stack of products and services",
|
||||
"version": "0.0.47",
|
||||
"version": "0.0.54",
|
||||
"type": "module",
|
||||
"author": "Armco (@restruct-corporate-advantage)",
|
||||
"types": "build/types/index.d.ts",
|
||||
"main": "build/cjs/index.js",
|
||||
"module": "build/es/index.js",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"start": "NODE_ENV=production vite",
|
||||
"build": "tsc && vite build",
|
||||
"build:publish": "./scripts/build.sh",
|
||||
"build:publish:compile": "tsc --p ./tsconfig-build.json && vite build --config vite-publish.config.ts",
|
||||
"generate": "plop",
|
||||
"build": "rm -rf build && tsc && vite build",
|
||||
"component": "plop component",
|
||||
"test": "NODE_ENV=development vitest",
|
||||
"format": "prettier --write .",
|
||||
"lint": "eslint .",
|
||||
"type-check": "tsc",
|
||||
"publish:dry": "npm publish --dry-run",
|
||||
"publish:local": "./scripts/publish-local.sh",
|
||||
"publish:public": "./scripts/publish.sh"
|
||||
"publish:local": "./publish-local.sh",
|
||||
"publish:sh": "./publish.sh"
|
||||
},
|
||||
"dependencies": {
|
||||
"@armco/utils": "^0.0.0",
|
||||
"@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",
|
||||
"@storybook/cli": "^7.0.23",
|
||||
"bootstrap": "^5.3.0",
|
||||
"classnames": "^2.3.2",
|
||||
"d3": "^7.9.0",
|
||||
@@ -53,17 +54,10 @@
|
||||
"vite-plugin-svgr": "^3.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@armco/types": "^0.0.6",
|
||||
"@armco/types": "^0.0.11",
|
||||
"@babel/preset-env": "^7.24.5",
|
||||
"@babel/preset-react": "^7.24.1",
|
||||
"@babel/preset-typescript": "^7.24.1",
|
||||
"@storybook/addon-essentials": "^7.0.23",
|
||||
"@storybook/addon-interactions": "^7.0.23",
|
||||
"@storybook/addon-links": "^7.0.23",
|
||||
"@storybook/blocks": "^7.0.23",
|
||||
"@storybook/react": "^7.0.23",
|
||||
"@storybook/react-vite": "^7.0.23",
|
||||
"@storybook/testing-library": "^0.0.14-next.2",
|
||||
"@testing-library/dom": "^9.2.0",
|
||||
"@testing-library/jest-dom": "^5.11.4",
|
||||
"@testing-library/react": "^14.0.0",
|
||||
@@ -84,7 +78,6 @@
|
||||
"eslint": "^8.0.0",
|
||||
"eslint-config-react-app": "^7.0.1",
|
||||
"eslint-plugin-prettier": "^4.2.1",
|
||||
"eslint-plugin-storybook": "^0.6.12",
|
||||
"execa": "^8.0.1",
|
||||
"fs-extra": "^11.2.0",
|
||||
"glob": "^10.3.10",
|
||||
@@ -99,12 +92,13 @@
|
||||
"react-dom": "^18.2.0",
|
||||
"rollup-plugin-visualizer": "^5.12.0",
|
||||
"sass": "^1.63.4",
|
||||
"storybook": "^7.0.23",
|
||||
"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"
|
||||
},
|
||||
"peerDependencies": {
|
||||
@@ -118,8 +112,7 @@
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest",
|
||||
"plugin:storybook/recommended"
|
||||
"react-app/jest"
|
||||
],
|
||||
"plugins": [
|
||||
"prettier"
|
||||
@@ -130,9 +123,6 @@
|
||||
}
|
||||
},
|
||||
"prettier": "prettier-config-nick",
|
||||
"types": "./build/index.d.ts",
|
||||
"main": "./build/index.js",
|
||||
"module": "./build/index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ReStruct-Corporate-Advantage/armory-react-components.git"
|
||||
|
||||
32
plopfile.cjs
32
plopfile.cjs
@@ -79,22 +79,22 @@ module.exports = (plop) => {
|
||||
actions: [
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/atoms/{{pascalCase name}}/{{pascalCase name}}.tsx",
|
||||
path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.tsx",
|
||||
templateFile: "plop-templates/Component/Component.tsx.hbs",
|
||||
},
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/atoms/{{pascalCase name}}/{{pascalCase name}}.test.ts",
|
||||
path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.test.ts",
|
||||
templateFile: "plop-templates/Component/Component.test.ts.hbs",
|
||||
},
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/atoms/{{pascalCase name}}/{{pascalCase name}}.component.scss",
|
||||
path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.component.scss",
|
||||
templateFile: "plop-templates/Component/Component.component.scss.hbs",
|
||||
},
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/atoms/{{pascalCase name}}/index.ts",
|
||||
path: "src/app/components/{{pascalCase name}}/index.ts",
|
||||
templateFile: "plop-templates/Component/index.ts.hbs",
|
||||
},
|
||||
{
|
||||
@@ -105,25 +105,25 @@ module.exports = (plop) => {
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/atoms/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_IMPORT */`,
|
||||
template: `import {{pascalCase name}} from "./{{pascalCase name}}"`,
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/atoms/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_EXPORT */`,
|
||||
template: ` {{pascalCase name}},`,
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/atoms/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_TYPE_IMPORT */`,
|
||||
template: ` {{pascalCase name}}Props,`,
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/atoms/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_TYPE_EXPORT */`,
|
||||
template: ` type {{pascalCase name}}Props,`,
|
||||
},
|
||||
@@ -147,22 +147,22 @@ module.exports = (plop) => {
|
||||
actions: [
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/molecules/{{pascalCase name}}/{{pascalCase name}}.tsx",
|
||||
path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.tsx",
|
||||
templateFile: "plop-templates/Component/Component.tsx.hbs",
|
||||
},
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/molecules/{{pascalCase name}}/{{pascalCase name}}.test.ts",
|
||||
path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.test.ts",
|
||||
templateFile: "plop-templates/Component/Component.test.ts.hbs",
|
||||
},
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/molecules/{{pascalCase name}}/{{pascalCase name}}.component.scss",
|
||||
path: "src/app/components/{{pascalCase name}}/{{pascalCase name}}.component.scss",
|
||||
templateFile: "plop-templates/Component/Component.component.scss.hbs",
|
||||
},
|
||||
{
|
||||
type: "add",
|
||||
path: "src/app/components/molecules/{{pascalCase name}}/index.ts",
|
||||
path: "src/app/components/{{pascalCase name}}/index.ts",
|
||||
templateFile: "plop-templates/Component/index.ts.hbs",
|
||||
},
|
||||
{
|
||||
@@ -173,25 +173,25 @@ module.exports = (plop) => {
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/molecules/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_IMPORT */`,
|
||||
template: `import {{pascalCase name}} from "./{{pascalCase name}}"`,
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/molecules/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_EXPORT */`,
|
||||
template: ` {{pascalCase name}},`,
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/molecules/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_TYPE_IMPORT */`,
|
||||
template: ` {{pascalCase name}}Props,`,
|
||||
},
|
||||
{
|
||||
type: "append",
|
||||
path: "src/app/components/molecules/index.ts",
|
||||
path: "src/app/components/index.ts",
|
||||
pattern: `/* PLOP_INJECT_TYPE_EXPORT */`,
|
||||
template: ` type {{pascalCase name}}Props,`,
|
||||
},
|
||||
|
||||
16
publish-local.sh
Executable file
16
publish-local.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
semver=${1:-patch}
|
||||
|
||||
set -e
|
||||
|
||||
npm run build
|
||||
cp package.json build/
|
||||
sed -i '' -E 's/"build"/"*"/' build/package.json
|
||||
|
||||
sed -i '' 's#"build/cjs/index.js"#"cjs/index.js"#' build/package.json
|
||||
sed -i '' 's#"build/es/index.js"#"es/index.js"#' build/package.json
|
||||
sed -i '' 's#"build/types/index.d.ts"#"types/index.d.ts"#' build/package.json
|
||||
|
||||
cd build
|
||||
npm pack --pack-destination ~/__Projects__/Common
|
||||
16
publish.sh
Executable file
16
publish.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
semver=${1:-patch}
|
||||
|
||||
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/index.js"#"cjs/index.js"#' build/package.json
|
||||
sed -i '' 's#"build/es/index.js"#"es/index.js"#' build/package.json
|
||||
sed -i '' 's#"build/types/index.d.ts"#"types/index.d.ts"#' build/package.json
|
||||
|
||||
cd build
|
||||
npm publish --access public --loglevel verbose
|
||||
@@ -92,8 +92,8 @@ 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/atoms/index.ts lib/atoms.ts
|
||||
cp src/app/components/molecules/index.ts lib/molecules.ts
|
||||
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
|
||||
@@ -110,8 +110,8 @@ 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/molecules/Carousel/cssClasses.ts "lib"
|
||||
cp src/app/components/molecules/Carousel/animations.ts "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
|
||||
|
||||
5
src/index.scss
Normal file
5
src/index.scss
Normal file
@@ -0,0 +1,5 @@
|
||||
@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");
|
||||
|
||||
@@ -1,2 +1,9 @@
|
||||
import "./index.scss"
|
||||
|
||||
export * from "@armco/shared-components"
|
||||
export { Icon } from "@armco/icon"
|
||||
export { default as Icon } from "@armco/icon"
|
||||
export { default as Avatar } from "@armco/avatar"
|
||||
export { default as ImageEditor } from "@armco/imageeditor"
|
||||
export * from "@armco/calendar"
|
||||
export * from "@armco/layout"
|
||||
export * from "@armco/uploader"
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"downlevelIteration": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"outDir": "build",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx",
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"target": "es5",
|
||||
"outDir": "build",
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"jsx": "react-jsx"
|
||||
},
|
||||
"include": ["../shared-components/src"],
|
||||
"exclude": ["build", "plop-templates", "node_modules", "../shared-components/src/**/*.test.*", "../shared-components/src/**/*.spec.*", "../shared-components/src/stories", "scripts"]
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
import { defineConfig } from "vitest/config"
|
||||
import { extname, relative, resolve } from "path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import path from "path"
|
||||
import svgr from "vite-plugin-svgr"
|
||||
import dts from "vite-plugin-dts"
|
||||
import libCss from "./build-tools/injectLibCss"
|
||||
import { glob } from "glob"
|
||||
import { visualizer } from "rollup-plugin-visualizer"
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
svgr(),
|
||||
react(),
|
||||
libCss({
|
||||
exclude: ["utils", "config", "types", "static", "hooks", "contexts"],
|
||||
}),
|
||||
dts({
|
||||
include: ["lib"],
|
||||
}),
|
||||
],
|
||||
server: {
|
||||
open: true,
|
||||
port: 3000,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"~bootstrap": path.resolve(__dirname, "node_modules/bootstrap"),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
copyPublicDir: false,
|
||||
lib: {
|
||||
entry: resolve(__dirname, "lib/index.ts"),
|
||||
name: "@armco/armory-react-components",
|
||||
formats: [
|
||||
// "cjs",
|
||||
"es",
|
||||
// "umd"
|
||||
],
|
||||
fileName: (format, b) => {
|
||||
return `${format}/${b}.${format}.js`
|
||||
},
|
||||
},
|
||||
outDir: "build",
|
||||
// sourcemap: true,
|
||||
rollupOptions: {
|
||||
treeshake: true,
|
||||
external: [
|
||||
"react",
|
||||
"react/jsx-runtime",
|
||||
"react-router-dom",
|
||||
"react-dom",
|
||||
"react-redux",
|
||||
"react-dnd",
|
||||
"react-dnd",
|
||||
"react-dnd-html5-backend",
|
||||
"react-dnd-touch-backend",
|
||||
],
|
||||
input: Object.fromEntries(
|
||||
glob.sync("lib/**/*.{ts,tsx}").map((file) => [
|
||||
// The name of the entry point
|
||||
// lib/nested/foo.ts becomes nested/foo
|
||||
relative("lib", file.slice(0, file.length - extname(file).length)),
|
||||
// The absolute path to the entry file
|
||||
// lib/nested/foo.ts becomes /project/lib/nested/foo.ts
|
||||
fileURLToPath(new URL(file, import.meta.url)),
|
||||
]),
|
||||
),
|
||||
output: {
|
||||
assetFileNames: "assets/[name][extname]",
|
||||
entryFileNames: "[name].js",
|
||||
},
|
||||
plugins: [visualizer()],
|
||||
},
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
setupFiles: "src/setupTests",
|
||||
mockReset: true,
|
||||
},
|
||||
})
|
||||
@@ -1,28 +1,41 @@
|
||||
import { resolve } from "path"
|
||||
import { glob } from "glob"
|
||||
import { defineConfig } from "vitest/config"
|
||||
import react from "@vitejs/plugin-react"
|
||||
import path from "path"
|
||||
import svgr from "vite-plugin-svgr"
|
||||
import dts from "vite-plugin-dts"
|
||||
import { libInjectCss } from "vite-plugin-lib-inject-css"
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [svgr(), react()],
|
||||
server: {
|
||||
open: true,
|
||||
port: 3000,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"~bootstrap": path.resolve(__dirname, "node_modules/bootstrap"),
|
||||
},
|
||||
},
|
||||
plugins: [react(), libInjectCss(), dts({ outDir: "build/types" })],
|
||||
build: {
|
||||
outDir: "build",
|
||||
// sourcemap: true,
|
||||
},
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
setupFiles: "src/setupTests",
|
||||
mockReset: true,
|
||||
lib: {
|
||||
entry: glob.sync(resolve(__dirname, "src/**/!(*.d).{ts,tsx}")),
|
||||
},
|
||||
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