Skip to content

Commit 13e0d6b

Browse files
committed
fix(verdaccio): e2e pipeline, nx-cmake still needs fixing
1 parent 60cb5e2 commit 13e0d6b

29 files changed

+91
-76
lines changed

.commitlintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ module.exports = {
1010
2,
1111
'always',
1212
[
13-
...(await getProjects(
13+
...getProjects(
1414
ctx,
1515
({ name }) => !name.includes('e2e') && !name.includes('sb'),
16-
)),
16+
),
1717
],
1818
],
1919
},

e2e/e2e-create-nx-cmake/project.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@
55
"sourceRoot": "e2e/e2e-create-nx-cmake/tests",
66
"targets": {
77
"run-e2e": {
8-
"dependsOn": ["^start-local-registry", "^publish"],
8+
"dependsOn": ["^publish"],
99
"executor": "@nx/jest:jest",
1010
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
1111
"options": {
1212
"jestConfig": "e2e/{projectName}/jest.config.ts",
1313
"runInBand": true
1414
}
1515
},
16-
"finish-e2e": {
17-
"dependsOn": ["run-e2e"],
18-
"command": "nx stop-local-registry verdaccio"
19-
},
2016
"e2e": {
21-
"dependsOn": ["finish-e2e"],
22-
"executor": "nx:noop"
17+
"dependsOn": ["^e2e"],
18+
"command": "nx single-e2e verdaccio --e2e={projectName}"
2319
},
2420
"lint": {
2521
"executor": "@nx/eslint:lint",
@@ -34,5 +30,5 @@
3430
}
3531
}
3632
},
37-
"implicitDependencies": ["verdaccio", "create-nx-cmake"]
33+
"implicitDependencies": ["verdaccio", "create-nx-cmake", "e2e-nx-cmake"]
3834
}

e2e/e2e-create-nx-cmake/tests/create-nx-cmake.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function createTestProject(extraArgs = '') {
4343
recursive: true,
4444
});
4545

46-
execSync(`npx --yes create-nx-cmake@e2e ${projectName} ${extraArgs}`, {
46+
execSync(`npx create-nx-cmake@e2e ${projectName} ${extraArgs}`, {
4747
cwd: dirname(projectDirectory),
4848
stdio: 'inherit',
4949
env: process.env,

e2e/e2e-nx-cmake/project.json

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,17 @@
55
"sourceRoot": "e2e/e2e-nx-cmake/tests",
66
"targets": {
77
"run-e2e": {
8-
"dependsOn": ["^start-local-registry", "^publish"],
8+
"dependsOn": ["^publish"],
99
"executor": "@nx/jest:jest",
1010
"outputs": ["{workspaceRoot}/coverage/{projectRoot}"],
1111
"options": {
1212
"jestConfig": "e2e/{projectName}/jest.config.ts",
1313
"runInBand": true
1414
}
1515
},
16-
"finish-e2e": {
17-
"dependsOn": ["run-e2e"],
18-
"command": "nx stop-local-registry verdaccio"
19-
},
2016
"e2e": {
21-
"dependsOn": ["finish-e2e"],
22-
"executor": "nx:noop"
17+
"dependsOn": ["^e2e"],
18+
"command": "nx single-e2e verdaccio --e2e={projectName}"
2319
},
2420
"lint": {
2521
"executor": "@nx/eslint:lint",
@@ -34,5 +30,5 @@
3430
}
3531
}
3632
},
37-
"implicitDependencies": ["verdaccio", "nx-cmake"]
33+
"implicitDependencies": ["nx-cmake"]
3834
}

e2e/e2e-nx-cmake/tests/nx-cmake.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ function createTestProject() {
367367
});
368368

369369
execSync(
370-
`npx --yes create-nx-workspace@latest ${projectName} --preset=${plugin} --nxCloud=skip --no-interactive`,
370+
`npx create-nx-workspace@latest ${projectName} --preset=${plugin} --ci=skip --interactive=false --verbose`,
371371
{
372372
cwd: dirname(projectDirectory),
373373
stdio: 'inherit',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"@types/node": "20.11.25",
3939
"@typescript-eslint/eslint-plugin": "7.1.1",
4040
"@typescript-eslint/parser": "7.1.1",
41+
"@verdaccio/types": "^10.8.0",
4142
"commitizen": "^4.3.0",
4243
"commitlint": "^19.0.3",
4344
"cz-git": "^1.9.0",

packages/verdaccio/config.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# path to a directory with all packages
2-
storage: ../tmp/local-registry/storage
2+
storage: ../../tmp/local-registry/storage
33

44
# a list of other known repositories we can talk to
55
uplinks:
@@ -34,3 +34,5 @@ server:
3434

3535
listen:
3636
- 0.0.0.0:4873
37+
38+
_debug: true

packages/verdaccio/project.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@
5252
"command": "ts-node {projectRoot}/src/bin/publish.ts {args.name} {args.ver} {args.tag}"
5353
}
5454
},
55+
"single-e2e": {
56+
"executor": "nx:run-commands",
57+
"options": {
58+
"color": true,
59+
"command": "ts-node {projectRoot}/src/bin/single-e2e.ts {args.e2e}"
60+
}
61+
},
5562
"run-many-e2e": {
5663
"executor": "nx:run-commands",
5764
"options": {

packages/verdaccio/src/bin/publish.ts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function invariant(condition: boolean, message: string) {
99
}
1010
}
1111

12+
const registry = 'http://localhost:4873';
13+
1214
// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag}
1315
// Default "tag" to "next" so we won't publish the "latest" tag by accident.
1416
const [, , name, version, tag = 'next'] = process.argv;
@@ -36,7 +38,6 @@ invariant(
3638

3739
process.chdir(outputPath);
3840

39-
// Updating the version in "package.json" before publishing
4041
try {
4142
const json = JSON.parse(readFileSync(`package.json`).toString());
4243
json.version = version;
@@ -45,21 +46,14 @@ try {
4546
console.error(`Error reading package.json file from library build output.`);
4647
}
4748

48-
const host = 'localhost';
49-
const port = 4873;
50-
const registry = `http://${host}:${port}`;
51-
52-
execSync(
53-
`npm config set //${host}:${port}/:_authToken "secretVerdaccioToken"`,
54-
{
55-
encoding: 'utf-8',
56-
stdio: 'inherit',
57-
env: {
58-
...process.env,
59-
npm_config_registry: registry,
60-
},
49+
execSync(`npm config set //localhost:4873/:_authToken "secretVerdaccioToken"`, {
50+
encoding: 'utf-8',
51+
stdio: 'inherit',
52+
env: {
53+
...process.env,
54+
npm_config_registry: registry,
6155
},
62-
);
56+
});
6357

6458
// Execute "npm publish" to publish
6559
execSync(`npm publish --access public --tag ${tag} --registry ${registry}`, {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { e2eSingle } from '../lib/single-e2e';
2+
const [, , target] = process.argv;
3+
e2eSingle(target);

0 commit comments

Comments
 (0)