Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Oct 18, 2024
2 parents 671d84f + 3465e16 commit 97c8d30
Show file tree
Hide file tree
Showing 64 changed files with 1,031 additions and 1,348 deletions.
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@
- 'esbuild.config.js'
- '.github/ISSUE_TEMPLATE/**'
- '.husky/**'
- 'commitlint.config.js'
- 'commitlint.config.mjs'
- '.verdaccio/config.yml'
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"singleQuote": true,
"arrowParens": "avoid",
"trailingComma": "all",
"plugins": ["@trivago/prettier-plugin-sort-imports"],
"importOrder": [
"^@code-pushup/portal-client$",
"^@code-pushup/(.*)$",
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
## 0.53.1 (2024-10-18)

### 🚀 Features

- add keywords for NPM to display ([17a0c498](https://github.com/code-pushup/cli/commit/17a0c498))

### 🩹 Fixes

- **ci:** handle monorepo mode in non-PR flow ([d7ba5a3f](https://github.com/code-pushup/cli/commit/d7ba5a3f))

### ❤️ Thank You

- Matěj Chalk
- Vojtech Masek @vmasek

## 0.53.0 (2024-10-17)

### 🚀 Features
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ npm install

This table provides a quick overview of the environmental setup, with detailed explanations in the corresponding sections.

| Feature | Local Default | CI Default | Description |
| -------------------------------- | ------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. |
| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). |
| Quality Pipeline | Off | On | Runs all plugins against the codebase. |
| Feature | Local Default | CI Default | Description |
| ------------------------------- | ------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `env.INCLUDE_SLOW_TESTS` **❗️** | `false` | `true` | Controls inclusion of long-running tests. Overridden by setting. Details in the [Testing](#Testing) section. |
| `env.CUSTOM_CHROME_PATH` | N/A | Windows **❗️❗️** | Path to Chrome executable. See [plugin-lighthouse/CONTRIBUTING.md](./packages/plugin-lighthouse/CONTRIBUTING.md#chrome-path). |
| Quality Pipeline | Off | On | Runs all plugins against the codebase. |

**❗️** Test Inclusion Logic

Expand Down
18 changes: 7 additions & 11 deletions commitlint.config.js → commitlint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
const { RuleConfigSeverity } = require('@commitlint/types');
const { rules } = require('@commitlint/config-conventional');
const {
utils: { getProjects },
} = require('@commitlint/config-nx-scopes');
import config from '@commitlint/config-conventional';
import nxScopes from '@commitlint/config-nx-scopes';
import { RuleConfigSeverity } from '@commitlint/types';

/** @type {import('@commitlint/types').UserConfig} */
const configuration = {
export default {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-tense'],
rules: {
'scope-enum': async ctx => {
const projects = await getProjects(
const projects = nxScopes.utils.getProjects(
ctx,
({ name, projectType, tags }) =>
({ projectType }) =>
projectType === 'library' || projectType === 'application',
);
const scopes = [...projects, 'tools', 'workflows', 'testing'].sort();
return [RuleConfigSeverity.Error, 'always', scopes];
},
'type-enum': () => {
const defaultTypes = rules['type-enum'][2];
const defaultTypes = config.rules['type-enum'][2];
const types = [
...defaultTypes,
'release', // custom type for release commits
Expand All @@ -33,5 +31,3 @@ const configuration = {
],
},
};

module.exports = configuration;
10 changes: 5 additions & 5 deletions docs/e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Root/
// nx.json
{
// ...
"plugins": ["tools/src/npm/npm.plugin.ts", "tools/src/publish/publish.plugin.ts", "tools/src/verdaccio/verdaccio.plugin.ts"]
"plugins": ["tools/src/npm/npm.plugin.ts", "tools/src/publish/publish.plugin.ts", "tools/src/verdaccio/verdaccio.plugin.ts"],
}
```

Expand All @@ -115,10 +115,10 @@ Root/
"e2e": {
"executor": "@nx/vite:test",
"options": {
"configFile": "e2e/<project-name>-e2e/vite.config.e2e.ts"
}
}
}
"configFile": "e2e/<project-name>-e2e/vite.config.e2e.ts",
},
},
},
}
```

Expand Down
2 changes: 1 addition & 1 deletion e2e/cli-e2e/tests/collect.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('CLI collect', () => {
audits: audits.map(
pluginReport.slug === 'lighthouse' ? omitVariableAuditData : p => p,
) as AuditReport[],
} as PluginReport);
}) as PluginReport;
const omitVariableReportData = ({
commit,
date,
Expand Down
69 changes: 1 addition & 68 deletions esbuild.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { readFile, writeFile, stat } = require('node:fs/promises');
const { exec } = require('node:child_process');
const { promisify } = require('node:util');

Expand Down Expand Up @@ -45,7 +44,7 @@ module.exports = {

try {
await promisify(exec)(
`tsc --emitDeclarationOnly --project ${tsConfig} --outDir dist`,
`npx tsc --emitDeclarationOnly --project ${tsConfig} --outDir dist`,
);
} catch (err) {
console.error(err);
Expand All @@ -54,71 +53,5 @@ module.exports = {
});
},
},
{
name: 'PackageJSON',
setup(build) {
build.onEnd(async result => {
if (result.errors.length > 0) return;

const project = await getNxProject();
const { outputPath } = getESBuildExecutorOptions(project);

const sourcePackageJsonPath = `${project.data.root}/package.json`;
const outputPackageJsonPath = `${outputPath}/package.json`;

const isPublishable = await stat(sourcePackageJsonPath)
.then(stats => stats.isFile())
.catch(() => false);

if (!isPublishable) {
/** @type {import('nx/src/utils/package-json').PackageJson} */
const newPackageJson = {
name: `@code-pushup/${project.name}`,
private: true,
type: 'module',
main: 'index.js',
types: 'src/index.d.ts',
};
await writeFile(
outputPackageJsonPath,
JSON.stringify(newPackageJson, null, 2),
);
return;
}

/** @type {import('nx/src/utils/package-json').PackageJson} */
const packageJson = JSON.parse(
await readFile(sourcePackageJsonPath, 'utf8'),
);

/** @type {import('nx/src/utils/package-json').PackageJson} */
const rootPackageJson = JSON.parse(
await readFile('package.json', 'utf8'),
);

packageJson.license = rootPackageJson.license;
if (project.name === 'cli') {
packageJson.homepage = rootPackageJson.homepage;
} else {
packageJson.homepage = `https://github.com/code-pushup/cli/tree/main/packages/${project.name}#readme`;
}
packageJson.bugs = rootPackageJson.bugs;
packageJson.repository = {
...rootPackageJson.repository,
directory: project.data.root,
};
packageJson.contributors = rootPackageJson.contributors;
packageJson.publishConfig = { access: 'public' };
packageJson.type = 'module';
packageJson.main = './index.js';
packageJson.types = './src/index.d.ts';

await writeFile(
outputPackageJsonPath,
JSON.stringify(packageJson, null, 2),
);
});
},
},
],
};
2 changes: 1 addition & 1 deletion examples/react-todos-app/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
4 changes: 2 additions & 2 deletions knip.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
KnipConfigPlugin,
type KnipConfigPlugin,
combineNxKnipPlugins,
withEsbuildApps,
withEsbuildPublishableLibs,
Expand Down Expand Up @@ -48,7 +48,7 @@ const withNxStandards = (): KnipConfigPlugin => () => {
project: ['**/*.{ts,js,tsx,jsx}'],
ignore: ['tmp/**', 'node_modules/**'],
commitlint: {
config: ['commitlint.config.js'],
config: ['commitlint.config.mjs'],
},
exclude: ['duplicates'],
entry: [
Expand Down
Loading

0 comments on commit 97c8d30

Please sign in to comment.