diff --git a/.github/workflows/01-build-showcases.yml b/.github/workflows/01-build-showcases.yml index dbb597ccaf7..9ceab4c8c76 100644 --- a/.github/workflows/01-build-showcases.yml +++ b/.github/workflows/01-build-showcases.yml @@ -81,7 +81,7 @@ jobs: env: NEXT_PUBLIC_BASE_PATH: ${{ steps.base-path.outputs.result }} run: | - npm run scripts:md-resolve-svg + node scripts/md-resolve-svg.js npm run build-showcases - name: ⏫ Upload Showcases diff --git a/.github/workflows/02-e2e-showcases.yml b/.github/workflows/02-e2e-showcases.yml index b8469eb2f5d..b7db8322aee 100644 --- a/.github/workflows/02-e2e-showcases.yml +++ b/.github/workflows/02-e2e-showcases.yml @@ -56,7 +56,8 @@ jobs: - name: 👩‍🔬 Test showcase with Playwright 🎭 env: HOME: /root - run: npm run test:${{ matrix.framework }}-showcase -- -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} + run: | + npm run test:e2e --workspace=${{ matrix.framework }}-showcase -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} - name: 🔣 Print GitHub Report if: failure() diff --git a/.husky/pre-commit b/.husky/pre-commit index 1c1ab875e4b..4f8bdb44c7d 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ npx validate-branch-name -npm run scripts:check-commit-mail +node scripts/check-commit-mail.js npx --no -- lint-staged --config ./.lintstagedrc.js npm run lint:jscpd diff --git a/e2e/README.md b/e2e/README.md index 4c7ec0a0442..9c6f1b6cb10 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -2,7 +2,7 @@ This directory provides `docker-compose.yml` to test or regenerate screenshots. -- run `npm run build && npm run build-showcases` from your root directory +- run `npm run build && npm run build --workspace=react-showcase` from your root directory - run either one of those commands: - testing: `docker-compose -f ./e2e/docker-compose.yml up` - update screenshots (all): `docker-compose -f ./e2e/docker-compose.regenerate.yml up` diff --git a/e2e/package.json b/e2e/package.json index 0f884430f01..99153810a24 100644 --- a/e2e/package.json +++ b/e2e/package.json @@ -31,7 +31,6 @@ "fs-extra": "^11.1.0", "http-server": "14.1.1", "npm-run-all": "4.1.5", - "replace-in-file": "^6.3.5", "tslib": "^2.5.0", "typescript": "^5.3.3" } diff --git a/package.json b/package.json index 158b1f737e0..ba7abd5b392 100644 --- a/package.json +++ b/package.json @@ -19,65 +19,28 @@ "output/*", "output/vue/vue3", "showcases/*", - "docs" + "docs", + "scripts" ], "scripts": { - "build": "npm-run-all build:*", - "build-outputs": "npm-run-all -p build-outputs:*", - "build-outputs:components": "npm run copy-output --workspace=@db-ui/components", - "build-outputs:foundations": "npm run copy-build --workspace=@db-ui/foundations", - "build-outputs:ngx-components": "npm run build --workspace=@db-ui/ngx-components", - "build-outputs:react-components": "npm run build --workspace=@db-ui/react-components", - "build-outputs:v-components": "npm run build --workspace=@db-ui/v-components", - "build-outputs:web-components": "npm run build --workspace=@db-ui/web-components", - "build-showcases": "npm-run-all -p build-showcases:*", - "build-showcases:angular": "npm run build --workspace=angular-showcase", - "build-showcases:patternhub": "npm run build --workspace=db-patternhub", - "build-showcases:react": "npm run build --workspace=react-showcase", - "build-showcases:vanilla": "npm run build --workspace=vanilla-showcase", - "build-showcases:vue": "npm run build --workspace=vue-showcase", - "build:01_foundations": "npm run build --workspace=@db-ui/foundations", - "build:02_components": "npm run build --workspace=@db-ui/components", + "build": "npm run build --workspace=scripts", + "build-outputs": "npm run build-outputs --workspace=scripts", + "build-showcases": "npm run build-showcases --workspace=scripts", "clean": "git clean -dfx --exclude=.env", - "clean:incrementally": "npm-run-all -p clean:incrementally:*", - "clean:incrementally:components-build": "rimraf packages/components/build", - "clean:incrementally:foundations-build": "rimraf packages/foundations/build", - "clean:incrementally:outputs": "rimraf -g output/**/src", - "clean:incrementally:patternhub-pages": "rimraf -g showcases/patternhub/pages/components/*/*", - "clean:incrementally:patternhub-src-ts": "rimraf -g showcases/patternhub/components/src/**/*.ts", - "clean:incrementally:patternhub-src-tsx": "rimraf -g showcases/patternhub/components/src/**/*.tsx", - "dev": "node scripts/dev.js", - "dev:angular-components": "npm run dev:angular --workspace=@db-ui/components", - "dev:plain-html": "npm run dev:html --workspace=@db-ui/components", - "dev:react-components": "npm run dev:react --workspace=@db-ui/components", - "dev:sass": "npm run dev:scss --workspace=@db-ui/components", - "dev:vue-components": "npm run dev:vue --workspace=@db-ui/components", + "dev": "npm run dev --workspace=scripts", "generate:component": "npm run generate:component --workspace=@db-ui/components", - "generate:icon-fonts": "npm run generate:icon-fonts --workspace=@db-ui/foundations", - "generate:icon-types": "npm run generate:icon-types --workspace=@db-ui/components", "lint": "npm-run-all -p lint:*", "lint:jscpd": "jscpd --exitCode 1 .", "lint:markdownlint": "markdownlint -c .markdown-lint.yml **/*.md", "lint:stylelint": "stylelint **/*.scss", "lint:xo": "cross-env TIMING=1 NODE_OPTIONS=\"--max-old-space-size=4096\" xo", "prepare": "husky", - "regenerate:screenshots": "npm run build && npm run build-showcases:react && docker-compose -f ./e2e/docker-compose.regenerate.yml up", + "regenerate:screenshots": "npm run build && npm run build --workspace=react-showcase && docker-compose -f ./e2e/docker-compose.regenerate.yml up", "regenerate:screenshots:rebuild": "npm run clean && npm i && npm run regenerate:screenshots -- --build", - "scripts:check-commit-mail": "node scripts/check-commit-mail.js", - "scripts:md-resolve-svg": "node scripts/md-resolve-svg.js", - "start": "node scripts/start.js", - "start-showcase:angular": "npm run dev --workspace=angular-showcase", - "start-showcase:patternhub": "npm run dev --workspace=db-patternhub", - "start-showcase:react": "npm run dev --workspace=react-showcase", - "start-showcase:vanilla": "npm run dev --workspace=vanilla-showcase", - "start-showcase:vue": "npm run dev --workspace=vue-showcase", - "start:components": "npm run start --workspace=@db-ui/components", - "start:foundations": "npm run start --workspace=@db-ui/foundations", - "test:angular-showcase": "npm run test:e2e --workspace=angular-showcase", - "test:react-showcase": "npm run test:e2e --workspace=react-showcase", - "test:vue-showcase": "npm run test:e2e --workspace=vue-showcase", + "rm:builds": "npm run rm:builds --workspace=scripts", + "start": "npm run start --workspace=patternhub", "update:dependency:playwright": "node .github/scripts/update-playwright.js", - "update:icon-fonts": "npm-run-all generate:icon-fonts generate:icon-types" + "update:icon-fonts": "npm run update:icon-fonts --workspace=scripts" }, "devDependencies": { "@commitlint/cli": "19.0.3", diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 00000000000..ca46a06af49 --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,46 @@ +{ + "name": "scripts", + "version": "0.0.0", + "type": "module", + "description": "contains scripts for monorepo", + "scripts": { + "build": "npm-run-all build:foundations build:components", + "build-outputs": "npm-run-all -p build-outputs:*", + "build-outputs:components": "npm run copy-output --workspace=@db-ui/components", + "build-outputs:foundations": "npm run copy-build --workspace=@db-ui/foundations", + "build-outputs:ngx-components": "npm run build --workspace=@db-ui/ngx-components", + "build-outputs:react-components": "npm run build --workspace=@db-ui/react-components", + "build-outputs:v-components": "npm run build --workspace=@db-ui/v-components", + "build-outputs:web-components": "npm run build --workspace=@db-ui/web-components", + "build-showcases": "npm-run-all -p build-showcases:*", + "build-showcases:angular": "npm run build --workspace=angular-showcase", + "build-showcases:patternhub": "npm run build --workspace=patternhub", + "build-showcases:react": "npm run build --workspace=react-showcase", + "build-showcases:vanilla": "npm run build --workspace=vanilla-showcase", + "build-showcases:vue": "npm run build --workspace=vue-showcase", + "build:components": "npm run build --workspace=@db-ui/components", + "build:foundations": "npm run build --workspace=@db-ui/foundations", + "dev": "node dev.js", + "dev:angular-components": "npm run dev:angular --workspace=@db-ui/components", + "dev:plain-html": "npm run dev:html --workspace=@db-ui/components", + "dev:react-components": "npm run dev:react --workspace=@db-ui/components", + "dev:sass": "npm run dev:scss --workspace=@db-ui/components", + "dev:vue-components": "npm run dev:vue --workspace=@db-ui/components", + "generate:icon-fonts": "npm run generate:icon-fonts --workspace=@db-ui/foundations", + "generate:icon-types": "npm run generate:icon-types --workspace=@db-ui/components", + "rm-builds:components-build": "rimraf ../packages/components/build", + "rm-builds:foundations-build": "rimraf ../packages/foundations/build", + "rm-builds:outputs": "rimraf -g ../output/**/src", + "rm-builds:patternhub-pages": "rimraf -g ../showcases/patternhub/pages/components/*/*", + "rm-builds:patternhub-src-ts": "rimraf -g ../showcases/patternhub/components/src/**/*.ts", + "rm-builds:patternhub-src-tsx": "rimraf -g ../showcases/patternhub/components/src/**/*.tsx", + "rm:builds": "npm-run-all -p rm-builds:*", + "start-showcase:angular": "npm run dev --workspace=angular-showcase", + "start-showcase:patternhub": "npm run dev --workspace=patternhub", + "start-showcase:react": "npm run dev --workspace=react-showcase", + "start-showcase:vanilla": "npm run dev --workspace=vanilla-showcase", + "start-showcase:vue": "npm run dev --workspace=vue-showcase", + "start:foundations": "npm run start --workspace=@db-ui/foundations", + "update:icon-fonts": "npm-run-all generate:icon-fonts generate:icon-types" + } +} diff --git a/scripts/start.js b/scripts/start.js deleted file mode 100644 index 625d8585a04..00000000000 --- a/scripts/start.js +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable unicorn/prefer-top-level-await */ -import childProcess from 'node:child_process'; -import inquirer from 'inquirer'; - -inquirer - .prompt([ - { - type: 'checkbox', - message: 'Select frameworks to start;', - name: 'frameworks', - choices: [ - { - name: 'angular' - }, - { - name: 'patternhub' - }, - { - name: 'react', - checked: true - }, - { - name: 'reactwind' - }, - { - name: 'vanilla' - }, - { - name: 'vue' - } - ], - validate(answer) { - if (answer.length === 0) { - return 'You must choose at least one framework.'; - } - - return true; - } - } - ]) - - .then((answers) => { - let startCommand = 'npm-run-all -p build:* -p'; - if (answers?.frameworks) - for (const answer of answers.frameworks) { - startCommand += ` start-showcase:${answer}`; - } - - // eslint-disable-next-line no-console - console.log(`Start with command: '${startCommand}'`); - // TODO: Handle child process better - childProcess.execSync(startCommand, { stdio: 'inherit' }); - }); diff --git a/showcases/patternhub/package.json b/showcases/patternhub/package.json index cbf33af8a89..332a2433007 100644 --- a/showcases/patternhub/package.json +++ b/showcases/patternhub/package.json @@ -1,5 +1,5 @@ { - "name": "db-patternhub", + "name": "patternhub", "version": "0.1.0", "type": "module", "private": true,