feat(js): new workspace uses scoped named in root package.json (#28271)
This PR changes the root `package.json` to use a scoped name when using `create-nx-workspace`. This was already done in most presets, but we missed the old "package-based" setup. e.g. These ``` create-nx-workspace acme --preset=ts create-nx-workspace acme --preset=npm ``` Should all result in `@acme/source` being used in root `package.json`, not `acme`. The scope will be used when generating projects if the user doesn't pass `--importPath`.
This commit is contained in:
parent
5be5ad8a74
commit
f22c63de2d
@ -68,7 +68,7 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
});
|
||||
}, 1_000_000);
|
||||
|
||||
@ -83,7 +83,7 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
});
|
||||
});
|
||||
|
||||
@ -120,7 +120,7 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
});
|
||||
});
|
||||
|
||||
@ -146,8 +146,8 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`${libName}/server`]: [`packages/${libName}/src/server.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}/server`]: [`packages/${libName}/src/server.ts`],
|
||||
});
|
||||
});
|
||||
|
||||
@ -177,7 +177,7 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
});
|
||||
});
|
||||
|
||||
@ -203,7 +203,7 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
});
|
||||
});
|
||||
|
||||
@ -229,7 +229,7 @@ describe('create-nx-workspace --preset=npm', () => {
|
||||
checkFilesExist('tsconfig.base.json');
|
||||
const tsconfig = readJson(`tsconfig.base.json`);
|
||||
expect(tsconfig.compilerOptions.paths).toEqual({
|
||||
[libName]: [`packages/${libName}/src/index.ts`],
|
||||
[`@${wsName}/${libName}`]: [`packages/${libName}/src/index.ts`],
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "<%= formattedNames.fileName %>",
|
||||
"name": "@<%= formattedNames.fileName %>/source",
|
||||
"version": "0.0.0",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
|
||||
@ -227,7 +227,7 @@ describe('@nx/workspace:generateWorkspaceFiles', () => {
|
||||
"nx": "0.0.1",
|
||||
},
|
||||
"license": "MIT",
|
||||
"name": "proj",
|
||||
"name": "@proj/source",
|
||||
"private": true,
|
||||
"scripts": {},
|
||||
"version": "0.0.0",
|
||||
@ -256,7 +256,7 @@ describe('@nx/workspace:generateWorkspaceFiles', () => {
|
||||
"nx": "0.0.1",
|
||||
},
|
||||
"license": "MIT",
|
||||
"name": "proj",
|
||||
"name": "@proj/source",
|
||||
"private": true,
|
||||
"scripts": {},
|
||||
"version": "0.0.0",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user