diff --git a/.changeset/README.md b/.changeset/README.md new file mode 100644 index 00000000..e5b6d8d6 --- /dev/null +++ b/.changeset/README.md @@ -0,0 +1,8 @@ +# Changesets + +Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works +with multi-package repos, or single-package repos to help you version and publish your code. You can +find the full documentation for it [in our repository](https://github.com/changesets/changesets) + +We have a quick list of common questions to get you started engaging with this project in +[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) diff --git a/.changeset/config.json b/.changeset/config.json new file mode 100644 index 00000000..777c81de --- /dev/null +++ b/.changeset/config.json @@ -0,0 +1,11 @@ +{ + "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", + "changelog": "@changesets/cli/changelog", + "commit": false, + "fixed": [["hwy", "create-hwy", "@hwy-js/*"]], + "linked": [], + "access": "public", + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] +} diff --git a/.changeset/friendly-books-learn.md b/.changeset/friendly-books-learn.md new file mode 100644 index 00000000..e7c4cb31 --- /dev/null +++ b/.changeset/friendly-books-learn.md @@ -0,0 +1,8 @@ +--- +"create-hwy": patch +"@hwy-js/build": patch +"hwy": patch +"@hwy-js/dev": patch +--- + +test diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 00000000..84aa8abb --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,11 @@ +{ + "mode": "pre", + "tag": "next", + "initialVersions": { + "@hwy-js/build": "0.4.0-beta.33", + "hwy": "0.4.0-beta.33", + "create-hwy": "0.4.0-beta.33", + "@hwy-js/dev": "0.4.0-beta.33" + }, + "changesets": [] +} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..d65e98a5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,21 @@ +name: CI +on: + push: + branches: + - "**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + with: + version: 7 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: "pnpm" + + - run: pnpm install --frozen-lockfile + - run: pnpm run lint && pnpm run build diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..78efb43a --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,35 @@ +name: Publish +on: + workflow_run: + workflows: ["CI"] + types: + - completed + push: + branches: + - "main" + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + publish: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + with: + version: 7 + - uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: "pnpm" + + - run: pnpm install --frozen-lockfile + - name: Create Release Pull Request or Publish + id: changesets + uses: changesets/action@v1 + with: + publish: pnpm run release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/CHANGESETS_DIRECTIONS.md b/CHANGESETS_DIRECTIONS.md new file mode 100644 index 00000000..0048ac1b --- /dev/null +++ b/CHANGESETS_DIRECTIONS.md @@ -0,0 +1,3 @@ +# Pre-release workflow + +https://github.com/changesets/changesets/blob/main/docs/prereleases.md diff --git a/docs/package.json b/docs/package.json index 72674abf..81604b23 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,11 +12,11 @@ "@hono/node-server": "^1.2.0", "highlight.js": "^11.8.0", "hono": "^3.7.5", - "hwy": "0.4.0-beta.33" + "hwy": "workspace:*" }, "devDependencies": { - "@hwy-js/build": "0.4.0-beta.33", - "@hwy-js/dev": "0.4.0-beta.33", + "@hwy-js/build": "workspace:*", + "@hwy-js/dev": "workspace:*", "@types/node": "^20.8.3", "@types/nprogress": "^0.2.1", "htmx.org": "^1.9.6", diff --git a/docs/src/pages/_index.client.ts b/docs/src/pages/_index.client.ts deleted file mode 100644 index 33b866b8..00000000 --- a/docs/src/pages/_index.client.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// - -const el = document.getElementById("test"); - -if (el) el.innerHTML = "Hello World!"; diff --git a/docs/src/pages/_index.page.tsx b/docs/src/pages/_index.page.tsx index 26033e06..c991655e 100644 --- a/docs/src/pages/_index.page.tsx +++ b/docs/src/pages/_index.page.tsx @@ -7,10 +7,7 @@ import { ListItem, UnorderedList } from "../components/unordered-list.js"; export default function () { return ( <> -

+

Hwy is a simple,{" "} lightweight, and flexible{" "} web framework, built on Hono and{" "} diff --git a/docs/src/pages/jeff/_index.client.ts b/docs/src/pages/jeff/_index.client.ts new file mode 100644 index 00000000..7d0761b3 --- /dev/null +++ b/docs/src/pages/jeff/_index.client.ts @@ -0,0 +1 @@ +alert("bob"); diff --git a/package.json b/package.json index 292759cd..96777838 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,11 @@ "build:dev": "pnpm -r --filter @hwy-js/dev run build", "build:create-hwy": "pnpm -r --filter create-hwy run build", "build": "npm run build:build && npm run build:dev && npm run build:core && npm run build:create-hwy", + "lint:build": "pnpm -r --filter @hwy-js/build run lint", + "lint:core": "pnpm -r --filter hwy run lint", + "lint:dev": "pnpm -r --filter @hwy-js/dev run lint", + "lint:create-hwy": "pnpm -r --filter create-hwy run lint", + "lint": "npm-run-all --parallel lint:*", "dev:build": "pnpm -r --filter @hwy-js/build run dev", "dev:core": "pnpm -r --filter hwy run dev", "dev:dev": "pnpm -r --filter @hwy-js/dev run dev", @@ -19,8 +24,10 @@ "publish-beta": "pnpm run build && pnpm -r publish-beta" }, "devDependencies": { + "@changesets/cli": "^2.26.2", "npm-run-all": "^4.1.5", - "prettier": "^3.0.3" + "prettier": "^3.0.3", + "typescript": "^5.2.2" }, "prettier": {} } diff --git a/packages/build/package.json b/packages/build/package.json index fb6e1028..8aba6fde 100644 --- a/packages/build/package.json +++ b/packages/build/package.json @@ -13,6 +13,7 @@ ], "scripts": { "build": "rm -rf dist && tsup-node index.ts --format esm --dts", + "lint": "tsc", "dev": "rm -rf dist && tsup-node index.ts --format esm --dts --watch --sourcemap", "publish-beta": "npm publish --tag beta" }, diff --git a/packages/build/src/run-build-tasks.ts b/packages/build/src/run-build-tasks.ts index 1e0a32a3..6c2fbb2e 100644 --- a/packages/build/src/run-build-tasks.ts +++ b/packages/build/src/run-build-tasks.ts @@ -54,6 +54,8 @@ async function handle_prebuild({ is_dev }: { is_dev: boolean }) { } } +let is_first_run = true; + async function runBuildTasks({ log, isDev }: { isDev: boolean; log?: string }) { hwyLog(`New build initiated${log ? ` (${log})` : ""}`); @@ -68,9 +70,18 @@ async function runBuildTasks({ log, isDev }: { isDev: boolean; log?: string }) { const standard_tasks_p0 = performance.now(); - await fs.promises.mkdir(path.join(process.cwd(), "dist"), { - recursive: true, - }); + const dist_path = path.join(process.cwd(), "dist"); + + if (is_first_run) { + is_first_run = false; + + if (fs.existsSync(dist_path)) { + hwyLog("Removing old dist folder..."); + fs.rmSync(dist_path, { recursive: true, force: true }); + } + } + + await fs.promises.mkdir(dist_path, { recursive: true }); // needs to happen once first pre-css bundling await generate_public_file_map(); diff --git a/packages/build/src/walk-pages.ts b/packages/build/src/walk-pages.ts index e7e1c9a9..ebb7a7e8 100644 --- a/packages/build/src/walk-pages.ts +++ b/packages/build/src/walk-pages.ts @@ -33,7 +33,7 @@ async function walk_pages() { endsInSplat: boolean; endsInDynamic: boolean; hasSiblingClientFile: boolean; - filename: string; + fileRefFromPagesDirWithJsExt: string; }[] = []; for await (const entry of readdirp(path.resolve("./src/pages"))) { @@ -127,7 +127,7 @@ async function walk_pages() { endsInSplat: segments[segments.length - 1].isSplat, endsInDynamic: segments[segments.length - 1].isDynamic, hasSiblingClientFile: has_sibling_client_file, - filename: _path + ".js", + fileRefFromPagesDirWithJsExt: _path + ".js", }); } diff --git a/packages/build/tsconfig.json b/packages/build/tsconfig.json index 14eaa9a9..1f6fca4e 100644 --- a/packages/build/tsconfig.json +++ b/packages/build/tsconfig.json @@ -8,6 +8,7 @@ "noImplicitAny": true, "skipLibCheck": true, "verbatimModuleSyntax": true, + "noEmit": true, "jsx": "react-jsx", "jsxImportSource": "hono/jsx" }, diff --git a/packages/core/package.json b/packages/core/package.json index 8d7e5482..acd8bcc6 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -13,6 +13,7 @@ ], "scripts": { "build": "rm -rf dist && tsup-node index.ts --format esm --dts", + "lint": "tsc", "dev": "rm -rf dist && tsup-node index.ts --format esm --dts --watch --sourcemap", "publish-beta": "npm publish --tag beta" }, diff --git a/packages/core/src/components/client-entry-script.tsx b/packages/core/src/components/client-entry-script.tsx index 9f9ec7cc..5ae68ab4 100644 --- a/packages/core/src/components/client-entry-script.tsx +++ b/packages/core/src/components/client-entry-script.tsx @@ -19,13 +19,16 @@ function ClientScripts({ {activePathData.matchingPaths ?.filter((x) => { + if (x.hasSiblingClientFile) { + console.log("hasSiblingClientFile", x); + } return x.hasSiblingClientFile; }) .map((x) => { return (