1
- import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry' ;
2
- import { releasePublish , releaseVersion } from 'nx/release' ;
1
+ import { startLocalRegistry } from '@nx/js/plugins/jest/local-registry.js ' ;
2
+ import { releasePublish , releaseVersion } from 'nx/release/index.js ' ;
3
3
import { execSync } from 'node:child_process' ;
4
- import { rmSync } from 'node:fs' ;
4
+ import { mkdirSync } from 'node:fs' ;
5
5
import { join } from 'node:path' ;
6
+ import { exists } from '@nx/plugin/testing.js' ;
6
7
7
8
// Related to the target generated in the root project.json
8
9
const localRegistryTarget = '@huge-nx/source:local-registry' ;
9
10
11
+ const devTmpRepository = join ( process . cwd ( ) , 'tmp' , 'huge-nx-dev' ) ;
12
+
13
+ if ( ! exists ( devTmpRepository ) ) {
14
+ mkdirSync ( devTmpRepository , { recursive : true } ) ;
15
+ }
16
+
10
17
// Callback used to stop Verdaccio process
11
18
// eslint-disable-next-line @typescript-eslint/no-empty-function
12
19
let stopLocalRegistry = ( ) => { } ;
13
20
14
- const hugeNxConventionsArgv = process . argv [ 2 ] ;
15
- const nxVersion = process . argv [ 3 ] ?? 'latest' ;
16
- const workspaceName = hugeNxConventionsArgv . split ( '/' ) ?. pop ( ) ?. replace ( '.conventions.ts' , `-${ nxVersion } ` ) ;
17
- if ( ! hugeNxConventionsArgv || ! workspaceName ) {
18
- throw new Error ( 'Provide the conventions name like npx ts-node ./tools/scripts/publish-local.ts huge-angular-monorep' ) ;
19
- }
20
-
21
21
( async ( ) => {
22
22
try {
23
23
execSync ( 'pkill -f verdaccio' , { stdio : 'inherit' } ) ;
@@ -46,15 +46,9 @@ if (!hugeNxConventionsArgv || !workspaceName) {
46
46
firstRelease : true ,
47
47
} ) ;
48
48
49
- rmSync ( workspaceName , { force : true , recursive : true } ) ;
50
-
51
- const createCmd = `npx --yes create-huge-nx@latest ${ workspaceName } --hugeNxConventions=${ hugeNxConventionsArgv } --nxVersion ${ nxVersion } --nxCloud skip --interactive false --verbose` ;
52
-
53
- console . log ( createCmd ) ;
54
-
55
- execSync ( createCmd , {
49
+ execSync ( `npx create-huge-nx@latest` , {
56
50
stdio : 'inherit' ,
57
- cwd : join ( process . cwd ( ) , '..' ) ,
51
+ cwd : devTmpRepository ,
58
52
env : {
59
53
...process . env ,
60
54
npm_config_registry : 'http://localhost:4873' ,
@@ -63,7 +57,7 @@ if (!hugeNxConventionsArgv || !workspaceName) {
63
57
} ,
64
58
} ) ;
65
59
66
- stopLocalRegistry ( ) ;
60
+ // stopLocalRegistry();
67
61
68
62
const exitStatus = Object . values ( publishStatus ) . reduce ( ( acc , result ) => result . code + acc , 0 ) ;
69
63
process . exit ( exitStatus ) ;
0 commit comments