Skip to content

Commit

Permalink
Merge branch 'main' into add-examples-projects
Browse files Browse the repository at this point in the history
# Conflicts:
#	package-lock.json
#	package.json
  • Loading branch information
BioPhoton committed Sep 17, 2024
2 parents 55a8b38 + 5480cb7 commit 935d001
Show file tree
Hide file tree
Showing 12 changed files with 368 additions and 1,806 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Thumbs.db
.code-pushup
.nx
.nx/cache
.nx/workspace-data
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/.nx/cache
/.nx/cache
/.nx/workspace-data
2 changes: 1 addition & 1 deletion code-pushup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const taskTimeTasks = [
'core-e2e:e2e',
'utils-e2e:e2e',
'models-e2e:e2e',
'cli-e2e-original:original-e2e',
//'cli-e2e-original:original-e2e',
];
const cacheSizeTasks = [
'models-e2e:setup-env',
Expand Down
2 changes: 1 addition & 1 deletion examples-e2e/cli-e2e-original/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"sourceRoot": "examples-e2e/cli-e2e-original/test",
"projectType": "application",
"tags": ["type:e2e", "scope:internal", "type:example"],
"implicitDependencies": ["cli"],
"implicitDependencies": ["cli", "test-utils"],
"targets": {
"lint": {},
"original-e2e": {
Expand Down
15 changes: 6 additions & 9 deletions examples-e2e/cli-e2e-original/setup/global-setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { rm } from 'node:fs/promises';
import { executeProcess, objectToCliArgs } from '@org/test-utils';
import { executeProcess, objectToCliArgs } from '@push-based/test-utils';
import {
RegistryResult,
startVerdaccioServer,
Expand All @@ -11,14 +11,16 @@ import {

const isVerbose = process.env['NX_VERBOSE_LOGGING'] === 'true' ?? false;
const projectName = process.env['NX_TASK_TARGET_PROJECT'];
let registryResult: RegistryResult;
let stopFn: () => void;

export async function setup() {
if (projectName == null) {
throw new Error('Project name required.');
}
console.info(`Set up ${projectName}`);

const registryResult = await startVerdaccioServer({
registryResult = await startVerdaccioServer({
targetName: 'original-local-registry',
verbose: isVerbose,
clear: true,
Expand Down Expand Up @@ -52,23 +54,18 @@ export async function setup() {
}),
verbose: isVerbose,
});

// @TODO figure out why named exports don't work https://vitest.dev/config/#globalsetup
stopFn = () => teardownSetup(registryResult);
return () => stopFn();
}

export async function teardown() {
stopFn();
}
export async function teardownSetup({ registry, stop }: RegistryResult) {
console.info(`Teardown ${projectName}`);
const { registry } = registryResult;
// uninstall all projects
await executeProcess({
command: 'nx',
args: objectToCliArgs({
_: ['run-many'],
targets: 'original-npm-uninstall',
parallel: 1,
}),
verbose: isVerbose,
});
Expand Down
4 changes: 2 additions & 2 deletions examples-e2e/cli-e2e-original/test/cli-command-sort.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { dirname, join } from 'node:path';
import { afterEach, describe, expect, it } from 'vitest';
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import { executeProcess, objectToCliArgs } from '@org/test-utils';
import { executeProcess, objectToCliArgs } from '@push-based/test-utils';

describe('CLI command - sort', () => {
const workspaceRoot = join('tmp', 'cli-e2e-original');
Expand All @@ -22,7 +22,7 @@ describe('CLI command - sort', () => {
const { code } = await executeProcess({
command: 'npx',
args: objectToCliArgs({
_: ['@org/cli', 'sort'],
_: ['@push-based/cli', 'sort'],
filePath: testPath,
}),
verbose: true,
Expand Down
5 changes: 4 additions & 1 deletion examples-e2e/cli-e2e-original/tooling/original.plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ function npmTargets(
},
},
'original-npm-uninstall': {
command: `npm uninstall ${packageName}`,
command: `npm uninstall ${packageName}@{args.pkgVersion}`,
options: {
pkgVersion,
},
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { rm, writeFile } from 'node:fs/promises';
import { setupNpmWorkspace } from '../utils/npm';
import { error, info } from '../utils/logging';
import { objectToCliArgs } from '@org/test-utils';
import { objectToCliArgs } from '@push-based/test-utils';
import { execSync } from 'node:child_process';

function logInfo(msg: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { gray, bold, red } from 'ansis';
import { join } from 'node:path';
import { error, info } from '../utils/logging';
import { VerdaccioExecutorSchema } from '@nx/js/src/executors/verdaccio/schema';
import { executeProcess, objectToCliArgs } from '@org/test-utils';
import { executeProcess, objectToCliArgs } from '@push-based/test-utils';

export function logInfo(msg: string) {
info(msg, 'Verdaccio: ');
Expand Down
43 changes: 43 additions & 0 deletions migrations.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"migrations": [
{
"cli": "nx",
"version": "19.2.0-beta.2",
"description": "Updates the default workspace data directory to .nx/workspace-data",
"implementation": "./src/migrations/update-19-2-0/move-workspace-data-directory",
"package": "nx",
"name": "19-2-0-move-graph-cache-directory"
},
{
"cli": "nx",
"version": "19.2.2-beta.0",
"description": "Updates the nx wrapper.",
"implementation": "./src/migrations/update-17-3-0/update-nxw",
"package": "nx",
"name": "19-2-2-update-nx-wrapper"
},
{
"version": "19.2.4-beta.0",
"description": "Set project name in nx.json explicitly",
"implementation": "./src/migrations/update-19-2-4/set-project-name",
"x-repair-skip": true,
"package": "nx",
"name": "19-2-4-set-project-name"
},
{
"cli": "nx",
"version": "19.1.0-beta.6",
"description": "Migrate no-extra-semi rules into user config, out of nx extendable configs",
"implementation": "./src/migrations/update-19-1-0-migrate-no-extra-semi/migrate-no-extra-semi",
"package": "@nx/eslint-plugin",
"name": "update-19-1-0-rename-no-extra-semi"
},
{
"version": "19.6.0-beta.0",
"description": "Add dependsOn: [build] to preview targets using preview-server",
"implementation": "./src/migrations/update-19-6-0/add-depends-on-for-preview",
"package": "@nx/vite",
"name": "update-19-6-0-add-depends-on-for-preview-server"
}
]
}
Loading

0 comments on commit 935d001

Please sign in to comment.