Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: update Nx 19 & other dependencies #811

Merged
merged 45 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
fc308be
build: update Nx 19 & other dependencies
vmasek Sep 4, 2024
daebb71
test(plugin-eslint): fix nx project graph for mocked monorepo
vmasek Sep 5, 2024
2fc3cb4
build: update to latest nx 19
vmasek Oct 13, 2024
4a587a0
build: update deps lock and minor nx 19
vmasek Nov 25, 2024
e104e1b
refactor: temporary ignore use of deprecated CreteNodes at nx/devkit
vmasek Nov 25, 2024
f53b7d2
build: bump nx optional deps
vmasek Nov 26, 2024
db403a3
build: add rollup optional deps
vmasek Nov 26, 2024
4b67055
test: update integration test check to correspond with reduced lintFi…
vmasek Nov 26, 2024
85575d6
test: update e2e test check to include parallelism option
vmasek Nov 26, 2024
c35f049
test: use fake cache for create-cli e2e
vmasek Nov 28, 2024
f8844dd
test: remove arbitrary nx output prefix to fix test after update
vmasek Nov 29, 2024
3ff6915
build: switch to plain tsc instead of esbuild
vmasek Nov 29, 2024
f6ef55f
build: update to latest minor nx version
vmasek Nov 29, 2024
ce86ee7
build: get rid of explicit main as tsc executor will fill it out
vmasek Nov 29, 2024
7f4b01d
build: remove esbuild file from project configs
vmasek Nov 29, 2024
40c83c0
build: remove esbuild
vmasek Nov 29, 2024
2202dfd
build: use explicit js file extension imports
vmasek Nov 29, 2024
da4c689
refactor: tsx compatible code pushup execution
vmasek Nov 29, 2024
28eeee8
build: fix package lock after rebase
vmasek Nov 29, 2024
32dda1a
build: add explicit tsbuild dependency to all sub packages
vmasek Nov 30, 2024
3384785
refactor: correct project json schema reference
vmasek Nov 30, 2024
6c6cd58
build: fix test-utils buildable lib by adding package json with corre…
vmasek Nov 30, 2024
3499bbe
refactor: temporary remove custom-checks as they require dist folder …
vmasek Nov 30, 2024
f8bb13e
refactor: use with type json notation for package.json imports
vmasek Dec 1, 2024
f3e63f5
fix(plugin-eslint): avoid directory imports
matejchalk Dec 3, 2024
34cc22c
fix: prevent "ExperimentalWarning: Importing JSON" logged to stderr
matejchalk Dec 3, 2024
89d2d88
test(plugin-coverage-e2e): fix import path in test fixture
matejchalk Dec 3, 2024
92c3b5e
test: fix nx-plugin tests and inline custom dummy plugin
vmasek Dec 4, 2024
6aa3e5c
fix: update progress bar gradually as plugin run complete
vmasek Dec 4, 2024
ab04f35
refactor: ignore all config files in eslint
vmasek Dec 5, 2024
814cf46
test(plugin-eslint): add tsconfig for todos-app
vmasek Dec 5, 2024
588ec76
refactor: code pushup core config type import
vmasek Dec 6, 2024
676e1fa
refactor: reformat yargs file
vmasek Dec 7, 2024
321d21f
build: remove unnecessary types property from package json as it is g…
vmasek Dec 7, 2024
60cdd93
build: remove unnecessary tslib dependency form sub packages as we do…
vmasek Dec 7, 2024
8622189
refactor: code pushup merge configs helper direct import
vmasek Dec 7, 2024
f6462e4
refactor: code pushup preset direct imports
vmasek Dec 7, 2024
c9122be
refactor: correct examples dist import
vmasek Dec 7, 2024
1e042e6
test: correct double file extension imports
vmasek Dec 7, 2024
697470e
test: correct path for args testing
vmasek Dec 7, 2024
ef62518
refactor(nx-plugin): target specific deprecation with ignore
vmasek Dec 7, 2024
08fa7b9
build: set import helpers usage to explicit false to mitigate tslib
vmasek Dec 8, 2024
4b70f42
build(nx-plugin): keep supported nx version at >17 and <=19
vmasek Dec 8, 2024
abff296
refactor: remove unnecessary barrel files
vmasek Dec 8, 2024
114625c
test: keep verdaccio server running for create cli e2e
vmasek Dec 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 11 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"root": true,
"ignorePatterns": ["**/*"],
"ignorePatterns": ["**/*", "*.config*"],
"plugins": ["@nx"],
"overrides": [
{
Expand Down Expand Up @@ -91,14 +91,21 @@
"rules": {
"vitest/consistent-test-filename": [
"warn",
{ "pattern": ".*\\.(unit|integration|e2e)\\.test\\.[tj]sx?$" }
]
{
"pattern": ".*\\.(unit|integration|e2e)\\.test\\.[tj]sx?$"
}
],
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:@nx/javascript", "@code-pushup"],
"rules": {}
"rules": {
"@typescript-eslint/no-extra-semi": "error",
"no-extra-semi": "off"
}
},
{
"files": "*.json",
Expand Down
1 change: 0 additions & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
- 'nx.json'
- '.nvmrc'
- '.prettierrc'
- 'esbuild.config.js'
- '.github/ISSUE_TEMPLATE/**'
- '.husky/**'
- 'commitlint.config.mjs'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ Thumbs.db
**/.code-pushup

# Nx workspace cache
.nx/cache
.nx
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
/.nx
__snapshots__
39 changes: 4 additions & 35 deletions code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ import {
eslintCoreConfigNx,
jsPackagesCoreConfig,
lighthouseCoreConfig,
} from './code-pushup.preset';
import {
fileSizePlugin,
fileSizeRecommendedRefs,
packageJsonDocumentationGroupRef,
packageJsonPerformanceGroupRef,
packageJsonPlugin,
} from './dist/examples/plugins';
import { mergeConfigs } from './dist/packages/utils';
import type { CoreConfig } from './packages/models/src';
vmasek marked this conversation as resolved.
Show resolved Hide resolved
} from './code-pushup.preset.js';
import type { CoreConfig } from './packages/models/src/index.js';
import { mergeConfigs } from './packages/utils/src/index.js';

// load upload configuration from environment
const envSchema = z.object({
Expand All @@ -35,31 +28,7 @@ const config: CoreConfig = {
},
}),

plugins: [
fileSizePlugin({
directory: './dist/packages',
pattern: /\.js$/,
budget: 174_080, // 170 kB
}),

packageJsonPlugin({
directory: './dist/packages',
license: 'MIT',
type: 'module',
}),
],

categories: [
{
slug: 'custom-checks',
title: 'Custom checks',
refs: [
...fileSizeRecommendedRefs,
packageJsonPerformanceGroupRef,
packageJsonDocumentationGroupRef,
],
},
],
plugins: [],
};

export default mergeConfigs(
Expand Down
13 changes: 8 additions & 5 deletions code-pushup.preset.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import type {
CategoryConfig,
CoreConfig,
} from './packages/models/src/index.js';
import coveragePlugin, {
getNxCoveragePaths,
} from './dist/packages/plugin-coverage';
} from './packages/plugin-coverage/src/index.js';
import eslintPlugin, {
eslintConfigFromAllNxProjects,
eslintConfigFromNxProject,
} from './dist/packages/plugin-eslint';
import jsPackagesPlugin from './dist/packages/plugin-js-packages';
} from './packages/plugin-eslint/src/index.js';
import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js';
import lighthousePlugin, {
lighthouseGroupRef,
} from './dist/packages/plugin-lighthouse';
import type { CategoryConfig, CoreConfig } from './packages/models/src';
} from './packages/plugin-lighthouse/src/index.js';

export const jsPackagesCategories: CategoryConfig[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion e2e/ci-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "code-pushup.config*.ts"],
"ignorePatterns": ["!**/*", "*.config*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
Expand Down
2 changes: 1 addition & 1 deletion e2e/ci-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases';
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';

export default defineConfig({
cacheDir: '../../node_modules/.vite/ci-e2e',
Expand Down
2 changes: 1 addition & 1 deletion e2e/cli-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "code-pushup.config*.ts"],
"ignorePatterns": ["!**/*", "*.config*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';
import dummyPlugin, { dummyCategory } from './dummy.plugin.js';

export default {
plugins: [dummyPlugin()],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';
import dummyPlugin, { dummyCategory } from './dummy.plugin.js';

export default {
plugins: [dummyPlugin()],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';
import dummyPlugin, { dummyCategory } from './dummy.plugin.js';

vmasek marked this conversation as resolved.
Show resolved Hide resolved
export default {
plugins: [dummyPlugin()],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import dummyPlugin, { dummyCategory } from './dummy.plugin';
import dummyPlugin, { dummyCategory } from './dummy.plugin.js';

vmasek marked this conversation as resolved.
Show resolved Hide resolved
export default {
plugins: [dummyPlugin()],
Expand Down
2 changes: 1 addition & 1 deletion e2e/cli-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases';
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';

export default defineConfig({
cacheDir: '../../node_modules/.vite/cli-e2e',
Expand Down
2 changes: 1 addition & 1 deletion e2e/create-cli-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "code-pushup.config*.ts"],
"ignorePatterns": ["!**/*", "*.config*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
Expand Down
1 change: 1 addition & 0 deletions e2e/create-cli-e2e/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"e2e": {
"executor": "@nx/vite:test",
"options": {
"keepServerRunning": true,
"configFile": "e2e/create-cli-e2e/vite.config.e2e.ts"
}
}
Expand Down
30 changes: 24 additions & 6 deletions e2e/create-cli-e2e/tests/init.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import {
} from '@code-pushup/test-utils';
import { executeProcess, readJsonFile, readTextFile } from '@code-pushup/utils';

describe('create-cli-inti', () => {
const fakeCacheFolderName = () =>
`fake-cache-${new Date().toISOString().replace(/[:.]/g, '-')}`;

describe('create-cli-init', () => {
const workspaceRoot = join(E2E_ENVIRONMENTS_DIR, nxTargetProject());
const testFileDir = join(workspaceRoot, TEST_OUTPUT_DIR, 'init');

Expand All @@ -23,7 +26,12 @@ describe('create-cli-inti', () => {
await createNpmWorkspace(cwd);
const { code, stdout } = await executeProcess({
command: 'npm',
args: ['exec', '@code-pushup/create-cli'],
args: [
'exec',
'--yes',
`--cache=${fakeCacheFolderName()}`,
'@code-pushup/create-cli',
],
cwd,
});

Expand Down Expand Up @@ -58,7 +66,12 @@ describe('create-cli-inti', () => {

const { code, stdout } = await executeProcess({
command: 'npm',
args: ['init', '@code-pushup/cli'],
args: [
'init',
'--yes',
`--cache=${fakeCacheFolderName()}`,
'@code-pushup/cli',
],
cwd,
});

Expand Down Expand Up @@ -87,13 +100,18 @@ describe('create-cli-inti', () => {
);
});

it('should produce an executable setup when running npm init', async () => {
const cwd = join(testFileDir, 'npm-init-executable');
it('should produce an executable setup when running npm exec', async () => {
const cwd = join(testFileDir, 'npm-executable');
await createNpmWorkspace(cwd);

await executeProcess({
command: 'npm',
args: ['init', '@code-pushup/cli'],
args: [
'exec',
'--yes',
`--cache=${fakeCacheFolderName()}`,
'@code-pushup/create-cli',
],
cwd,
});

Expand Down
2 changes: 1 addition & 1 deletion e2e/create-cli-e2e/vite.config.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases';
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';

export default defineConfig({
cacheDir: '../../node_modules/.vite/create-cli-e2e',
Expand Down
2 changes: 1 addition & 1 deletion e2e/nx-plugin-e2e/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*", "code-pushup.config*.ts"],
"ignorePatterns": ["!**/*", "*.config*"],
"overrides": [
{
"files": ["*.ts", "*.tsx"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`nx-plugin > should NOT add config targets dynamically if the project is
"configurations": {},
"executor": "@code-pushup/nx-plugin:cli",
"options": {},
"parallelism": true,
},
}
`;
Expand All @@ -18,6 +19,7 @@ exports[`nx-plugin > should add configuration target dynamically 1`] = `
"options": {
"command": "nx g @code-pushup/nx-plugin:configuration --skipTarget --targetName="code-pushup" --project="my-lib"",
},
"parallelism": true,
},
}
`;
Expand All @@ -28,6 +30,7 @@ exports[`nx-plugin > should add executor target dynamically if the project is co
"configurations": {},
"executor": "@code-pushup/nx-plugin:cli",
"options": {},
"parallelism": true,
},
}
`;
Expand Down
21 changes: 4 additions & 17 deletions e2e/nx-plugin-e2e/tests/executor-cli.e2e.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Tree, updateProjectConfiguration } from '@nx/devkit';
import { join, relative } from 'node:path';
import { join } from 'node:path';
import { readProjectConfiguration } from 'nx/src/generators/utils/project-configuration';
import { afterEach, expect } from 'vitest';
import { generateCodePushupConfig } from '@code-pushup/nx-plugin';
Expand All @@ -12,21 +12,16 @@ import { teardownTestFolder } from '@code-pushup/test-setup';
import {
E2E_ENVIRONMENTS_DIR,
TEST_OUTPUT_DIR,
osAgnosticPath,
removeColorCodes,
} from '@code-pushup/test-utils';
import { executeProcess, readJsonFile } from '@code-pushup/utils';

function relativePathToCwd(testDir: string): string {
return relative(join(process.cwd(), testDir), process.cwd());
}
import { INLINE_PLUGIN } from './inline-plugin.js';

async function addTargetToWorkspace(
tree: Tree,
options: { cwd: string; project: string },
) {
const { cwd, project } = options;
const pathRelativeToPackage = relative(join(cwd, 'libs', project), cwd);
const projectCfg = readProjectConfiguration(tree, project);
updateProjectConfiguration(tree, project, {
...projectCfg,
Expand All @@ -39,18 +34,10 @@ async function addTargetToWorkspace(
});
const { root } = projectCfg;
generateCodePushupConfig(tree, root, {
fileImports: `import type {CoreConfig} from "@code-pushup/models";`,
plugins: [
{
// @TODO replace with inline plugin
fileImports: `import {customPlugin} from "${osAgnosticPath(
join(
relativePathToCwd(cwd),
pathRelativeToPackage,
'dist/testing/test-utils',
),
)}";`,
codeStrings: 'customPlugin()',
fileImports: '',
codeStrings: INLINE_PLUGIN,
},
],
});
Expand Down
21 changes: 21 additions & 0 deletions e2e/nx-plugin-e2e/tests/inline-plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export const INLINE_PLUGIN = `
{
slug: 'good-feels',
title: 'Good feels',
icon: 'javascript',
audits: [
{
slug: 'always-perfect',
title: 'Always perfect',
},
],
runner: () => [
{
slug: 'always-perfect',
score: 1,
value: 100,
displayValue: '✅ Perfect! 👌',
},
],
}
`;
Loading
Loading