From c33d42a9b5736145e9223b372944db8e4da6398a Mon Sep 17 00:00:00 2001 From: dsod Date: Thu, 8 Feb 2024 00:43:02 +0100 Subject: [PATCH] build commands --- .github/workflows/ci.yml | 11 +++++----- nx.json | 9 +-------- packages/css/project.json | 1 + packages/qwik/package.json | 16 +-------------- .../panda.config.ts => qwik/panda.config.js} | 0 .../postcss.config.js} | 0 packages/qwik/project.json | 6 ++++++ packages/qwik/tsconfig.lib.json | 6 +----- packages/qwik/vite.config.ts | 20 +++---------------- packages/react/.eslintrc.cjs | 11 ---------- packages/react/package.json | 8 +------- .../panda.config.ts => react/panda.config.js} | 0 .../postcss.config.js} | 0 packages/react/project.json | 6 ++++++ packages/react/tsconfig.lib.json | 4 ++-- packages/react/vite.config.ts | 8 ++++++++ packages/solidjs/package.json | 3 +++ packages/solidjs/panda.config.js | 2 ++ packages/solidjs/postcss.config.js | 2 ++ packages/solidjs/project.json | 6 ++++++ packages/solidjs/tsconfig.lib.json | 4 +--- packages/solidjs/vite.config.ts | 9 +++++++-- 22 files changed, 56 insertions(+), 76 deletions(-) rename packages/{react/panda.config.ts => qwik/panda.config.js} (100%) rename packages/{react/postcss.config.ts => qwik/postcss.config.js} (100%) delete mode 100644 packages/react/.eslintrc.cjs rename packages/{solidjs/panda.config.ts => react/panda.config.js} (100%) rename packages/{solidjs/postcss.config.ts => react/postcss.config.js} (100%) create mode 100644 packages/solidjs/package.json create mode 100644 packages/solidjs/panda.config.js create mode 100644 packages/solidjs/postcss.config.js diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf3d6fd..b08a019 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,16 +20,15 @@ jobs: - uses: pnpm/action-setup@v2 with: version: 8 - - # - run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" - # Cache node_modules - uses: actions/setup-node@v4 with: node-version: 20 cache: 'pnpm' + + # Run CI - run: pnpm i --frozen-lockfile - - uses: nrwl/nx-set-shas@v4 - - run: npx nx-cloud record -- nx format:check - - run: npx nx affected -t lint test build + - uses: nrwl/nx-set-shas@v4 + - run: pnpm biome check --changed --since=${{ env.NX_BASE }} --files-ignore-unknown=true + - run: pnpm nx affected -t lint test build diff --git a/nx.json b/nx.json index 20d57e6..38cdac5 100644 --- a/nx.json +++ b/nx.json @@ -9,12 +9,5 @@ "libsDir": "packages" }, "nxCloudAccessToken": "MTEwOTM4NjctMWQ0Yy00ODliLWE5ODctZDhkMGI4ZDVkMDNifHJlYWQtd3JpdGU=", - "plugins": [ - { - "plugin": "@nx/eslint/plugin", - "options": { - "targetName": "lint" - } - } - ] + "plugins": [] } diff --git a/packages/css/project.json b/packages/css/project.json index 6adbfe2..a043da4 100644 --- a/packages/css/project.json +++ b/packages/css/project.json @@ -7,6 +7,7 @@ "prepare-build": { "executor": "nx:run-commands", "options": { + "cwd": "packages/css", "command": "pnpm panda codegen" } } diff --git a/packages/qwik/package.json b/packages/qwik/package.json index e5f4df7..bedb411 100644 --- a/packages/qwik/package.json +++ b/packages/qwik/package.json @@ -1,17 +1,3 @@ { - "type": "module", - "scripts": { - "build": "qwik build", - "build.lib": "vite build --mode lib", - "build.types": "tsc --emitDeclarationOnly", - "dev": "vite --mode ssr", - "dev.debug": "node --inspect-brk ./node_modules/vite/bin/vite.js --mode ssr --force", - "fmt": "prettier --write .", - "fmt.check": "prettier --check .", - "lint": "eslint \"src/**/*.ts*\"", - "release": "np", - "start": "vite --open --mode ssr", - "test": "echo \"No test specified\" && exit 0", - "qwik": "qwik" - } + "type": "module" } diff --git a/packages/react/panda.config.ts b/packages/qwik/panda.config.js similarity index 100% rename from packages/react/panda.config.ts rename to packages/qwik/panda.config.js diff --git a/packages/react/postcss.config.ts b/packages/qwik/postcss.config.js similarity index 100% rename from packages/react/postcss.config.ts rename to packages/qwik/postcss.config.js diff --git a/packages/qwik/project.json b/packages/qwik/project.json index ec7d820..19f226e 100644 --- a/packages/qwik/project.json +++ b/packages/qwik/project.json @@ -10,6 +10,12 @@ "cwd": "packages/qwik", "command": "pnpm panda codegen" } + }, + "build": { + "executor": "@nx/vite:build", + "options": { + "outputPath": "dist/qwik" + } } }, "tags": [] diff --git a/packages/qwik/tsconfig.lib.json b/packages/qwik/tsconfig.lib.json index 4df0dc2..eef05fb 100644 --- a/packages/qwik/tsconfig.lib.json +++ b/packages/qwik/tsconfig.lib.json @@ -1,14 +1,10 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../../dist/css", - "declaration": true, - "allowSyntheticDefaultImports": true, + "isolatedModules": true, "esModuleInterop": true, "jsx": "react-jsx", "jsxImportSource": "@builder.io/qwik", - "noEmit": true, - "isolatedModules": true, "types": ["vite/client"] }, "include": ["src/**/*.tsx"], diff --git a/packages/qwik/vite.config.ts b/packages/qwik/vite.config.ts index 4bafded..ffb8733 100644 --- a/packages/qwik/vite.config.ts +++ b/packages/qwik/vite.config.ts @@ -1,30 +1,16 @@ -import { qwikVite } from "@builder.io/qwik/optimizer"; import { nxViteTsPaths } from "@nx/vite/plugins/nx-tsconfig-paths.plugin"; import { defineConfig } from "vite"; -import pkg from "./package.json"; - -type Packages = typeof pkg & { - dependencies: Record; - peerDependencies: Record; -}; -const { dependencies = {}, peerDependencies = {} } = pkg as Packages; -const makeRegex = (dep) => new RegExp(`^${dep}(/.*)?$`); -const excludeAll = (obj) => Object.keys(obj).map(makeRegex); export default defineConfig(() => { return { build: { target: "es2020", lib: { - entry: "./src/index.ts", + entry: "./src/index.tsx", formats: ["es", "cjs"], - fileName: (format) => `index.qwik.${format === "es" ? "mjs" : "cjs"}`, - }, - rollupOptions: { - // externalize deps that shouldn't be bundled into the library - external: [/^node:.*/, ...excludeAll(dependencies), ...excludeAll(peerDependencies)], + fileName: (format) => `index.${format === "es" ? "mjs" : "cjs"}`, }, }, - plugins: [qwikVite(), nxViteTsPaths()], + plugins: [nxViteTsPaths()], }; }); diff --git a/packages/react/.eslintrc.cjs b/packages/react/.eslintrc.cjs deleted file mode 100644 index 676b506..0000000 --- a/packages/react/.eslintrc.cjs +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = { - root: true, - env: { browser: true, es2020: true }, - extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:react-hooks/recommended"], - ignorePatterns: ["dist", ".eslintrc.cjs"], - parser: "@typescript-eslint/parser", - plugins: ["react-refresh"], - rules: { - "react-refresh/only-export-components": ["warn", { allowConstantExport: true }], - }, -}; diff --git a/packages/react/package.json b/packages/react/package.json index 7555de5..bedb411 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,9 +1,3 @@ { - "type": "module", - "scripts": { - "dev": "vite", - "build": "tsc && vite build", - "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", - "preview": "vite preview" - } + "type": "module" } diff --git a/packages/solidjs/panda.config.ts b/packages/react/panda.config.js similarity index 100% rename from packages/solidjs/panda.config.ts rename to packages/react/panda.config.js diff --git a/packages/solidjs/postcss.config.ts b/packages/react/postcss.config.js similarity index 100% rename from packages/solidjs/postcss.config.ts rename to packages/react/postcss.config.js diff --git a/packages/react/project.json b/packages/react/project.json index 679d780..577c085 100644 --- a/packages/react/project.json +++ b/packages/react/project.json @@ -10,6 +10,12 @@ "cwd": "packages/react", "command": "pnpm panda codegen" } + }, + "build": { + "executor": "@nx/vite:build", + "options": { + "outputPath": "dist/react" + } } }, "tags": [] diff --git a/packages/react/tsconfig.lib.json b/packages/react/tsconfig.lib.json index 10fdb48..bbcc922 100644 --- a/packages/react/tsconfig.lib.json +++ b/packages/react/tsconfig.lib.json @@ -1,10 +1,10 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "moduleResolution": "bundler", "isolatedModules": true, "esModuleInterop": true, - "jsx": "react-jsx" + "jsx": "react-jsx", + "types": ["vite/client"] }, "include": ["src/**/*.tsx"], "exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"] diff --git a/packages/react/vite.config.ts b/packages/react/vite.config.ts index 6b19ecb..6f4e031 100644 --- a/packages/react/vite.config.ts +++ b/packages/react/vite.config.ts @@ -4,5 +4,13 @@ import { defineConfig } from "vite"; // https://vitejs.dev/config/ export default defineConfig({ + build: { + target: "es2020", + lib: { + entry: "./src/index.tsx", + formats: ["es", "cjs"], + fileName: (format) => `index.${format === "es" ? "mjs" : "cjs"}`, + }, + }, plugins: [react(), nxViteTsPaths()], }); diff --git a/packages/solidjs/package.json b/packages/solidjs/package.json new file mode 100644 index 0000000..bedb411 --- /dev/null +++ b/packages/solidjs/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/solidjs/panda.config.js b/packages/solidjs/panda.config.js new file mode 100644 index 0000000..eae53aa --- /dev/null +++ b/packages/solidjs/panda.config.js @@ -0,0 +1,2 @@ +import { getDefaultConfig } from "../../panda.base.config.js"; +export default getDefaultConfig(__dirname); diff --git a/packages/solidjs/postcss.config.js b/packages/solidjs/postcss.config.js new file mode 100644 index 0000000..de85c33 --- /dev/null +++ b/packages/solidjs/postcss.config.js @@ -0,0 +1,2 @@ +import { getDefaultConfig } from "../../postcss.base.config.js"; +export default getDefaultConfig(); diff --git a/packages/solidjs/project.json b/packages/solidjs/project.json index 2d6b7e7..e6c4c66 100644 --- a/packages/solidjs/project.json +++ b/packages/solidjs/project.json @@ -10,6 +10,12 @@ "cwd": "packages/solidjs", "command": "pnpm panda codegen" } + }, + "build": { + "executor": "@nx/vite:build", + "options": { + "outputPath": "dist/solidjs" + } } }, "tags": [] diff --git a/packages/solidjs/tsconfig.lib.json b/packages/solidjs/tsconfig.lib.json index 2ddca3d..4116f65 100644 --- a/packages/solidjs/tsconfig.lib.json +++ b/packages/solidjs/tsconfig.lib.json @@ -1,12 +1,10 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "allowSyntheticDefaultImports": true, + "isolatedModules": true, "esModuleInterop": true, "jsx": "preserve", "jsxImportSource": "solid-js", - "noEmit": true, - "isolatedModules": true, "types": ["vite/client"] }, "include": ["src/**/*.tsx"], diff --git a/packages/solidjs/vite.config.ts b/packages/solidjs/vite.config.ts index 5c22aa3..7288d53 100644 --- a/packages/solidjs/vite.config.ts +++ b/packages/solidjs/vite.config.ts @@ -3,8 +3,13 @@ import { defineConfig } from "vite"; import solidPlugin from "vite-plugin-solid"; export default defineConfig({ - plugins: [solidPlugin(), nxViteTsPaths()], build: { - target: "esnext", + target: "es2020", + lib: { + entry: "./src/index.tsx", + formats: ["es", "cjs"], + fileName: (format) => `index.${format === "es" ? "mjs" : "cjs"}`, + }, }, + plugins: [solidPlugin(), nxViteTsPaths()], });