Skip to content

Commit

Permalink
chore: qwik-city release (QwikDev#430)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley authored May 1, 2022
1 parent 2d84d77 commit 0584e22
Showing 14 changed files with 195 additions and 62 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ on:
workflow_dispatch:
inputs:
disttag:
description: 'Publish to NPM using this dist-tag, push the git-tag to the repo and create a Github release. A "latest" and "next" dist-tags will use the version number already committed in package.json.'
description: 'Publish to NPM using this dist-tag, push the git-tag to the repo and create a Github release. The "latest" and "next" dist-tags will use the version number already committed in package.json.'
required: true
type: choice
default: 'dev'
43 changes: 43 additions & 0 deletions .github/workflows/release-qwik-city.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release Qwik City

on:
workflow_dispatch:
inputs:
disttag:
description: 'Publish to NPM using this dist-tag. The version number will come from version found in package.json.'
required: true
type: choice
default: 'dev'
options:
- dev
- next
- latest

jobs:
publish:
name: Publish Qwik City
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: 'yarn'
registry-url: https://registry.npmjs.org/

- run: corepack enable

- name: Install NPM Dependencies
run: yarn install --immutable --network-timeout 300000

- name: Build Qwik City
run: cd packages/qwik-city && yarn build

- name: Test Qwik City
run: cd packages/qwik-city && yarn test

- name: Publish Qwik City
run: cd packages/qwik-city && yarn node -r esbuild-register scripts/release.ts --set-dist-tag="${{ github.event.inputs.disttag }}"
22 changes: 16 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -74,15 +74,25 @@ to [@builder.io/qwik](https://www.npmjs.com/package/@builder.io/qwik).

## Releasing `@builder.io/qwik`

1. Run `yarn release.prepare`, which will test, lint and build locally.
2. Use the interactive UI to select the next version, which will update the `package.json` `version` property, adds the git change, and starts a commit message.
3. Create a PR with the `package.json` file change to merge to `main`.
4. After the updated `package.json` with the next version is in `main`, click the [Run Workflow](https://github.com/BuilderIO/qwik/actions/workflows/ci.yml) button for the Qwik CI Github Action workflow.
1. Run `yarn release.prepare`, which will test, lint and build.
2. Use the interactive UI to select the next version, which will update the `package.json` `version` property, add the git change, and start a commit message.
3. Create a PR with the `package.json` change to merge to `main`.
4. After the `package.json` with the updated version is in `main`, click the [Run Workflow](https://github.com/BuilderIO/qwik/actions/workflows/ci.yml) button from the "Qwik CI" Github Action workflow.
5. Select the NPM dist-tag that should be used for this version, then click "Run Workflow".
6. The Github Action will dispatch the CI workflow to build each of the submodules, build WASM and native bindings, combine them into one package, and validate the package before publishing to NPM.
7. If the build is successful and all tests and validation passes, the CI workflow will automatically publish to NPM, commit a git tag to the repo, and create a Github release.
6. The Github Action will dispatch the workflow to build `@builder.io/qwik` and each of the submodules, build WASM and native bindings, combine them into one package, and validate the package before publishing to NPM.
7. If the build is successful and all tests and validation passes, the workflow will automatically publish to NPM, commit a git tag to the repo, and create a Github release.
8. 🚀

## Releasing `@builder.io/qwik-city`

1. Run `yarn release.prepare.qwik-city`, which will test and build.
2. Use the interactive UI to select the next version, which will update the `package.json` `version` property, add the git change, and start a commit message.
3. Create a PR with the `package.json` change to merge to `main`.
4. After the `package.json` with the updated version is in `main`, click the [Run Workflow](https://github.com/BuilderIO/qwik/actions/workflows/release-qwik-city.yml) button from the "Release Qwik City" Github Action workflow.
5. The Github Action will dispatch the workflow to build and publish `@builder.io/qwik-city`.
6. If the build is successful and all tests and validation passes, the workflow will automatically publish to NPM.
7. ⚡️

## Starter CLI `create-qwik`

- [Starter CLI](https://github.com/BuilderIO/qwik/blob/main/starters/README.md)
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@
"tsc.watch": "tsc --noEmit --watch --preserveWatchOutput",
"start": "concurrently \"npm:build.watch\" \"npm:test.watch\" \"npm:tsc.watch\" -n build,test,tsc -c green,magenta,cyan",
"release.prepare": "yarn lint && yarn test.unit && yarn node scripts --tsc --build --api --eslint --platform-binding --wasm --prepare-release",
"release.prepare.qwik-city": "cd packages/qwik-city && yarn test && yarn build && yarn node -r esbuild-register scripts/prepare-release.ts",
"test": "yarn build && jest && yarn test.e2e",
"test.unit": "jest",
"test.rust": "make test",
@@ -99,7 +100,7 @@
{
"name": "Miško Hevery",
"email": "misko@hevery.com",
"url": "https://github.com/BuilderIO/qwik"
"url": "https://twitter.com/mhevery"
},
{
"name": "Adam Bradley",
9 changes: 7 additions & 2 deletions packages/qwik-city/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"name": "@builder.io/qwik-city",
"version": "0.0.0",
"description": "Static Site Generator for Qwik",
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"build": "yarn node scripts/build.mjs && npm run build.api",
"build": "yarn node -r esbuild-register scripts/build.ts && npm run build.api",
"build.api": "tsc && api-extractor run -c src/runtime/api-extractor.json --local && api-extractor run -c src/vite/api-extractor.json --local",
"test": "uvu -r tsm src/vite/tests"
},
@@ -33,6 +34,7 @@
"slugify": "^1.6.5",
"source-map": "^0.7.3",
"tsm": "^2.2.1",
"typescript": "4.6.3",
"unified": "^10.1.2",
"unist-util-visit": "^4.1.0",
"uvu": "^0.5.3",
@@ -56,13 +58,16 @@
"./dist"
],
"license": "MIT",
"homepage": "https://github.com/BuilderIO/qwik#readme",
"homepage": "https://qwik.builder.io/",
"repository": {
"type": "git",
"url": "https://github.com/BuilderIO/qwik.git",
"directory": "packages/qwik-city"
},
"bugs": {
"url": "https://github.com/BuilderIO/qwik/issues"
},
"publishConfig": {
"access": "public"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { build } from 'esbuild';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';

const __dirname = dirname(fileURLToPath(import.meta.url));
import { resolve } from 'path';

async function run() {
try {
42 changes: 42 additions & 0 deletions packages/qwik-city/scripts/prepare-release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* eslint-disable no-console */
import { checkExistingNpmVersion, releaseVersionPrompt } from '../../../scripts/release';
import { readPackageJson, writePackageJson } from '../../../scripts/package-json';
import { join } from 'path';
import { panic, run } from '../../../scripts/util';
import semver from 'semver';

async function prepareReleaseQwikCity() {
const pkgRootDir = join(__dirname, '..');
const pkg = await readPackageJson(pkgRootDir);

console.log(`⛴ preparing ${pkg.name} ${pkg.version} release`);

const answers = await releaseVersionPrompt(pkg.name, pkg.version);
if (!semver.valid(answers.version)) {
panic(`Invalid version`);
}

pkg.version = answers.version;

await checkExistingNpmVersion(pkg.name, pkg.version);

await writePackageJson(pkgRootDir, pkg);

// git add the changed package.json
const gitAddArgs = ['add', join(pkgRootDir, 'package.json')];
await run('git', gitAddArgs);

// git commit the changed package.json
const commitMessage = `qwik-city ${pkg.version}`;
const gitCommitArgs = ['commit', '--message', commitMessage];
await run('git', gitCommitArgs);

console.log(``);
console.log(`Next:`);
console.log(` - Submit a PR to main with the package.json update`);
console.log(` - Once merged, run the "Release Qwik City" workflow`);
console.log(` - https://github.com/BuilderIO/qwik/actions/workflows/release-qwik-city.yml`);
console.log(``);
}

prepareReleaseQwikCity();
21 changes: 21 additions & 0 deletions packages/qwik-city/scripts/release.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-disable no-console */
import mri from 'mri';
import { join } from 'path';
import { run } from '../../../scripts/util';
import { readPackageJson } from '../../../scripts/package-json';

async function releaseQwikCity() {
const args = mri(process.argv.slice(2));

const distTag = args['set-dist-tag'];

const pkgRootDir = join(__dirname, '..');
const pkg = await readPackageJson(pkgRootDir);

console.log(`🚢 publishing ${pkg.name} ${pkg.version}`);

const npmPublishArgs = ['publish', '--tag', distTag, '--access', 'public'];
await run('npm', npmPublishArgs, false, false, { cwd: pkgRootDir });
}

releaseQwikCity();
2 changes: 1 addition & 1 deletion packages/qwik-city/src/runtime/api-extractor.json
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
"enabled": true,
"reportFileName": "api.md",
"reportFolder": "<projectFolder>/src/runtime/",
"reportTempFolder": "<projectFolder>/dist-dev/api-extractor/qwik-city/"
"reportTempFolder": "<projectFolder>/../../dist-dev/api-extractor/qwik-city/"
},
"docModel": {
"enabled": false
11 changes: 4 additions & 7 deletions packages/qwik-city/src/runtime/api.md
Original file line number Diff line number Diff line change
@@ -4,11 +4,8 @@
```ts

import type { Listener } from 'history';

// @public (undocumented)
type Content_2 = any;
export { Content_2 as Content }
export type Content = any;

// @public (undocumented)
export interface HeadLinkAttributes {
@@ -68,7 +65,7 @@ export type Layout = any;
// @public (undocumented)
export interface MetaOptions {
// (undocumented)
[name: string]: Content_2;
[name: string]: Content;
// (undocumented)
description?: string;
// (undocumented)
@@ -102,7 +99,7 @@ export interface PageHandler {
// (undocumented)
breadcrumbs: PageBreadcrumb[];
// (undocumented)
content: Content_2;
content: Content;
// (undocumented)
headings: PageHeading[];
// (undocumented)
@@ -160,7 +157,7 @@ export const useLocation: (hostElm: any) => {
readonly searchParams: URLSearchParams;
readonly hash: string;
readonly origin: string;
listen(listener: Listener): any;
listen(listener: any): any;
};

// @public (undocumented)
3 changes: 1 addition & 2 deletions packages/qwik-city/src/runtime/location.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { Listener } from 'history';
import { createBrowserHistory } from 'history';
import { getDocument } from './utils';

@@ -30,7 +29,7 @@ export const useLocation = (hostElm: any) => {
get origin() {
return url.origin;
},
listen(listener: Listener) {
listen(listener: any) {
return history.listen(listener);
},
};
2 changes: 1 addition & 1 deletion packages/qwik-city/tsconfig.json
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@
"@builder.io/qwik-city": ["src/runtime/index"],
"@builder.io/qwik-city/build": ["src/runtime/build"]
},
"types": ["vite/client", "@cloudflare/workers-types"],
"types": ["vite/client"],
"outDir": "tsc-out"
},
"include": ["src"]
Loading

0 comments on commit 0584e22

Please sign in to comment.