Skip to content

Commit

Permalink
chore: update qwik-city release script (QwikDev#4116)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley authored May 9, 2023
1 parent e11b2e2 commit 0e43baf
Show file tree
Hide file tree
Showing 23 changed files with 267 additions and 250 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -443,14 +443,14 @@ jobs:
QWIK_API_TOKEN_GITHUB: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
run: pnpm run qwik-save-artifacts

- name: Dry-Run Publish @builder.io/qwik
- name: Dry-Run Publish
if: ${{ github.event_name != 'workflow_dispatch' }}
run: pnpm tsm scripts/index.ts --set-dist-tag="${{ github.event.inputs.disttag }}" --validate --release --dry-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish @builder.io/qwik
- name: Publish
if: ${{ github.event_name == 'workflow_dispatch' }}
run: pnpm tsm scripts/index.ts --set-dist-tag="${{ github.event.inputs.disttag }}" --validate --release
env:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ lib
etc
external
node_modules
qwik-app
target
output
rollup.config.js
Expand Down
21 changes: 10 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,13 @@ Some issues can be fixed automatically by using:
pnpm fmt
```

## Releasing (core-team only)

1. If there's a new version of Qwik City, first update the `starters/apps/base/package.json` to point to the new version of `@builder.io/qwik-city`.
2. Run `pnpm release.prepare`, which will test, lint and build.
3. 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.
4. Create a PR with the `package.json` change to merge to `main`.
5. 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.
6. Select the NPM dist-tag that should be used for this version, then click "Run Workflow".
7. 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.
8. 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.
9. ⚡️
## Releasing (core-team)

1. Run `pnpm 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 workflow to build `@builder.io/qwik`, `@builder.io/qwik-city` and each of their submodules, build WASM and native bindings, 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. ⚡️
31 changes: 18 additions & 13 deletions scripts/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,40 @@ export async function apiExtractor(config: BuildConfig) {

// core
// Run the api extractor for each of the submodules
createTypesApi(config, join(config.srcDir, 'core'), join(config.distPkgDir, 'core.d.ts'), '.');
createTypesApi(
config,
join(config.srcDir, 'jsx-runtime'),
join(config.distPkgDir, 'jsx-runtime.d.ts'),
join(config.srcQwikDir, 'core'),
join(config.distQwikPkgDir, 'core.d.ts'),
'.'
);
createTypesApi(
config,
join(config.srcDir, 'optimizer'),
join(config.distPkgDir, 'optimizer.d.ts'),
join(config.srcQwikDir, 'jsx-runtime'),
join(config.distQwikPkgDir, 'jsx-runtime.d.ts'),
'.'
);
createTypesApi(
config,
join(config.srcDir, 'server'),
join(config.distPkgDir, 'server.d.ts'),
join(config.srcQwikDir, 'optimizer'),
join(config.distQwikPkgDir, 'optimizer.d.ts'),
'.'
);
createTypesApi(
config,
join(config.srcDir, 'testing'),
join(config.distPkgDir, 'testing', 'index.d.ts'),
join(config.srcQwikDir, 'server'),
join(config.distQwikPkgDir, 'server.d.ts'),
'.'
);
createTypesApi(
config,
join(config.srcQwikDir, 'testing'),
join(config.distQwikPkgDir, 'testing', 'index.d.ts'),
'..'
);
createTypesApi(
config,
join(config.srcDir, 'build'),
join(config.distPkgDir, 'build', 'index.d.ts'),
join(config.srcQwikDir, 'build'),
join(config.distQwikPkgDir, 'build', 'index.d.ts'),
'..'
);
generateServerReferenceModules(config);
Expand Down Expand Up @@ -251,12 +256,12 @@ declare module '*.mdx' {
}
`;

const destServerModulesPath = join(config.distPkgDir, 'server-modules.d.ts');
const destServerModulesPath = join(config.distQwikPkgDir, 'server-modules.d.ts');
writeFileSync(destServerModulesPath, referenceDts);

// manually prepend the ts reference since api extractor removes it
const prependReferenceDts = `/// <reference path="./server-modules.d.ts" />\n\n`;
const distServerPath = join(config.distPkgDir, 'server.d.ts');
const distServerPath = join(config.distQwikPkgDir, 'server.d.ts');
let serverDts = readFileSync(distServerPath, 'utf-8');
serverDts = prependReferenceDts + serverDts;
writeFileSync(distServerPath, serverDts);
Expand Down
4 changes: 2 additions & 2 deletions scripts/binding-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { copyFile, readdir, writeFile } from 'fs/promises';
export async function buildPlatformBinding(config: BuildConfig) {
await new Promise((resolve, reject) => {
try {
ensureDir(config.distPkgDir);
ensureDir(config.distQwikPkgDir);
ensureDir(config.distBindingsDir);

const cmd = `napi`;
Expand Down Expand Up @@ -51,7 +51,7 @@ export async function buildPlatformBinding(config: BuildConfig) {
}

export async function copyPlatformBindingWasm(config: BuildConfig) {
ensureDir(config.distPkgDir);
ensureDir(config.distQwikPkgDir);
ensureDir(config.distBindingsDir);
const cacheDir = join(config.tmpDir, `cached-bindings`);

Expand Down
4 changes: 2 additions & 2 deletions scripts/binding-wasm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { join } from 'node:path';
import { rollup } from 'rollup';

export async function buildWasmBinding(config: BuildConfig) {
const srcWasmDir = join(config.srcDir, `wasm`);
const srcWasmDir = join(config.srcQwikDir, `wasm`);
const tmpBuildDir = join(config.tmpDir, `wasm-out`);

ensureDir(config.distPkgDir);
ensureDir(config.distQwikPkgDir);
ensureDir(config.distBindingsDir);
emptyDir(tmpBuildDir);

Expand Down
4 changes: 2 additions & 2 deletions scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ export async function build(config: BuildConfig) {

if (config.build) {
if (config.dev) {
ensureDir(config.distPkgDir);
ensureDir(config.distQwikPkgDir);
} else {
emptyDir(config.distPkgDir);
emptyDir(config.distQwikPkgDir);
}

// create the dist package.json first so we get the version set
Expand Down
2 changes: 1 addition & 1 deletion scripts/copy-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function copyFiles(config: BuildConfig) {

await Promise.all(
rootFiles.map((f) => {
copyFile(join(config.rootDir, f), join(config.distPkgDir, basename(f)));
copyFile(join(config.rootDir, f), join(config.distQwikPkgDir, basename(f)));
})
);
}
12 changes: 9 additions & 3 deletions scripts/create-qwik-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,15 @@ export async function publishCreateQwikCli(
const baseAppPkg = await readPackageJson(distCliBaseAppDir);
baseAppPkg.devDependencies = baseAppPkg.devDependencies || {};

console.log(` update devDependencies["@builder.io/qwik"] = "${version}"`);
baseAppPkg.devDependencies['@builder.io/qwik'] = version;
baseAppPkg.devDependencies['eslint-plugin-qwik'] = version;
let semverQwik = `^${version}`;
console.log(` update devDependencies["@builder.io/qwik"] = "${semverQwik}"`);
baseAppPkg.devDependencies['@builder.io/qwik'] = semverQwik;

console.log(` update devDependencies["@builder.io/qwik-city"] = "${semverQwik}"`);
baseAppPkg.devDependencies['@builder.io/qwik-city'] = semverQwik;

console.log(` update devDependencies["eslint-plugin-qwik"] = "${semverQwik}"`);
baseAppPkg.devDependencies['eslint-plugin-qwik'] = semverQwik;

const rootPkg = await readPackageJson(config.rootDir);
const typescriptDepVersion = rootPkg.devDependencies!.typescript;
Expand Down
6 changes: 3 additions & 3 deletions scripts/package-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ export async function generatePackageJson(config: BuildConfig) {
engines: rootPkg.engines,
};

await writePackageJson(config.distPkgDir, distPkg);
console.log(config.distPkgDir);
await writePackageJson(config.distQwikPkgDir, distPkg);
console.log(config.distQwikPkgDir);

await generateLegacyCjsSubmodule(config, 'core');
await generateLegacyCjsSubmodule(config, 'jsx-runtime');
Expand Down Expand Up @@ -159,7 +159,7 @@ export async function generateLegacyCjsSubmodule(
},
},
};
const submoduleDistDir = join(config.distPkgDir, pkgName);
const submoduleDistDir = join(config.distQwikPkgDir, pkgName);
ensureDir(submoduleDistDir);
await writePackageJson(submoduleDistDir, pkg);
}
Expand Down
Loading

0 comments on commit 0e43baf

Please sign in to comment.