Skip to content

Commit

Permalink
Merge branch 'master' into nx-dev/webinar-banner
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacplmann committed Apr 15, 2024
2 parents 0e19447 + 5429ba4 commit 9cf4b0d
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
12 changes: 6 additions & 6 deletions e2e/remix/tests/nx-remix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ describe('Remix E2E Tests', () => {
it('should check for un-escaped dollar signs in routes', async () => {
await expect(async () =>
runCLI(
`generate @nx/remix:route --project ${plugin} --path my.route.$withParams.tsx`
`generate @nx/remix:route --project ${plugin} --path="my.route.$withParams.tsx"`
)
).rejects.toThrow();

runCLI(
`generate @nx/remix:route --project ${plugin} --path my.route.\\$withParams.tsx`
`generate @nx/remix:route --project ${plugin} --path="my.route.\\$withParams.tsx"`
);

expect(() =>
Expand All @@ -133,7 +133,7 @@ describe('Remix E2E Tests', () => {

it('should pass un-escaped dollar signs in routes with skipChecks flag', async () => {
await runCommandAsync(
`someWeirdUseCase=route-segment && yarn nx generate @nx/remix:route --project ${plugin} --path my.route.$someWeirdUseCase.tsx --force`
`someWeirdUseCase=route-segment && yarn nx generate @nx/remix:route --project ${plugin} --path="my.route.$someWeirdUseCase.tsx" --force`
);

expect(() =>
Expand All @@ -146,12 +146,12 @@ describe('Remix E2E Tests', () => {
it('should check for un-escaped dollar signs in resource routes', async () => {
await expect(async () =>
runCLI(
`generate @nx/remix:resource-route --project ${plugin} --path my.route.$withParams.ts`
`generate @nx/remix:resource-route --project ${plugin} --path="my.route.$withParams.ts"`
)
).rejects.toThrow();

runCLI(
`generate @nx/remix:resource-route --project ${plugin} --path my.route.\\$withParams.ts`
`generate @nx/remix:resource-route --project ${plugin} --path="my.route.\\$withParams.ts"`
);

expect(() =>
Expand All @@ -161,7 +161,7 @@ describe('Remix E2E Tests', () => {

xit('should pass un-escaped dollar signs in resource routes with skipChecks flag', async () => {
await runCommandAsync(
`someWeirdUseCase=route-segment && yarn nx generate @nx/remix:resource-route --project ${plugin} --path my.route.$someWeirdUseCase.ts --force`
`someWeirdUseCase=route-segment && yarn nx generate @nx/remix:resource-route --project ${plugin} --path="my.route.$someWeirdUseCase.ts" --force`
);

expect(() =>
Expand Down
2 changes: 1 addition & 1 deletion nx-dev/ui-home/src/lib/hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export function Hero(): JSX.Element {
</ButtonLink>

<ButtonLink
href="https://nx.app/enterprise?utm_source=nx.dev&utm_medium=hero"
href="/contact"
variant="secondary"
size="large"
title="Contact us"
Expand Down
4 changes: 3 additions & 1 deletion packages/js/src/generators/library/library.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('lib', () => {
name: '@proj/my-lib',
private: true,
version: '0.0.1',
type: 'commonjs',
scripts: {
build: "echo 'implement build'",
test: "echo 'implement test'",
Expand Down Expand Up @@ -977,6 +976,9 @@ describe('lib', () => {
expect(config.targets.build.options.project).toEqual(
`my-lib/package.json`
);

const pkgJson = readJson(tree, 'my-lib/package.json');
expect(pkgJson.type).not.toBeDefined();
});

it('should always set compiler to swc if bundler is rollup', async () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/js/src/generators/library/library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,10 +869,10 @@ function determineEntryFields(
};
case 'rollup':
return {
type: 'commonjs',
// Since we're publishing both formats, skip the type field.
// Bundlers or Node will determine the entry point to use.
main: './index.cjs',
module: './index.js',
// typings is missing for rollup currently
};
case 'vite':
return {
Expand All @@ -891,9 +891,9 @@ function determineEntryFields(
};
default: {
return {
// CJS is the safest optional for now due to lack of support from some packages
// also setting `type: module` results in different resolution behavior (e.g. import 'foo' no longer resolves to 'foo/index.js')
type: 'commonjs',
// Safest option is to not set a type field.
// Allow the user to decide which module format their library is using
type: undefined,
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function updatePackageJson(

packageJson.main = cjsExports['.'];

if (!hasEsmFormat) {
if (!hasEsmFormat && !options.skipTypeField) {
packageJson.type = 'commonjs';
}

Expand Down

0 comments on commit 9cf4b0d

Please sign in to comment.