Skip to content

Commit

Permalink
fix(react): app generator should handle crystal workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Feb 2, 2024
1 parent 4a5a92f commit bd46ba8
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 401 deletions.
8 changes: 0 additions & 8 deletions docs/generated/manifests/menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -9284,14 +9284,6 @@
"children": [],
"isExternal": false,
"disableCollapsible": false
},
{
"id": "cypress",
"path": "/nx-api/remix/generators/cypress",
"name": "cypress",
"children": [],
"isExternal": false,
"disableCollapsible": false
}
],
"isExternal": false,
Expand Down
9 changes: 0 additions & 9 deletions docs/generated/manifests/nx-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -2645,15 +2645,6 @@
"originalFilePath": "/packages/remix/src/generators/error-boundary/schema.json",
"path": "/nx-api/remix/generators/error-boundary",
"type": "generator"
},
"/nx-api/remix/generators/cypress": {
"description": "Generate a project for testing Remix apps using Cypress",
"file": "generated/packages/remix/generators/cypress.json",
"hidden": false,
"name": "cypress",
"originalFilePath": "/packages/remix/src/generators/cypress/schema.json",
"path": "/nx-api/remix/generators/cypress",
"type": "generator"
}
},
"path": "/nx-api/remix"
Expand Down
9 changes: 0 additions & 9 deletions docs/generated/packages-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2618,15 +2618,6 @@
"originalFilePath": "/packages/remix/src/generators/error-boundary/schema.json",
"path": "remix/generators/error-boundary",
"type": "generator"
},
{
"description": "Generate a project for testing Remix apps using Cypress",
"file": "generated/packages/remix/generators/cypress.json",
"hidden": false,
"name": "cypress",
"originalFilePath": "/packages/remix/src/generators/cypress/schema.json",
"path": "remix/generators/cypress",
"type": "generator"
}
],
"githubRoot": "https://github.com/nrwl/nx/blob/master",
Expand Down
66 changes: 0 additions & 66 deletions docs/generated/packages/remix/generators/cypress.json

This file was deleted.

1 change: 0 additions & 1 deletion docs/shared/reference/sitemap.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@
- [storybook-configuration](/nx-api/remix/generators/storybook-configuration)
- [meta](/nx-api/remix/generators/meta)
- [error-boundary](/nx-api/remix/generators/error-boundary)
- [cypress](/nx-api/remix/generators/cypress)
- [rollup](/nx-api/rollup)
- [executors](/nx-api/rollup/executors)
- [rollup](/nx-api/rollup/executors/rollup)
Expand Down
10 changes: 4 additions & 6 deletions e2e/remix/tests/nx-remix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
uniq,
updateFile,
runCommandAsync,
listFiles,
} from '@nx/e2e/utils';

describe('remix e2e', () => {
Expand Down Expand Up @@ -62,25 +63,22 @@ describe('remix e2e', () => {
runCLI(
`generate @nx/remix:app ${plugin} --directory=sub --projectNameAndRootFormat=derived --rootProject=false --no-interactive`
);
const project = readJson(`sub/${plugin}/project.json`);
expect(project.targets.build.options.outputPath).toEqual(
`dist/sub/${plugin}`
);

const result = runCLI(`build ${appName}`);
expect(result).toContain('Successfully ran target build');

checkFilesExist(`dist/apps/sub/${plugin}/build/index.js`);
}, 120000);

it('should create src in the specified directory --projectNameAndRootFormat=as-provided', async () => {
const plugin = uniq('remix');
runCLI(
`generate @nx/remix:app ${plugin} --directory=subdir --projectNameAndRootFormat=as-provided --rootProject=false --no-interactive`
);
const project = readJson(`subdir/project.json`);
expect(project.targets.build.options.outputPath).toEqual(`dist/subdir`);

const result = runCLI(`build ${plugin}`);
expect(result).toContain('Successfully ran target build');
checkFilesExist(`dist/subdir/build/index.js`);
}, 120000);
});

Expand Down
5 changes: 0 additions & 5 deletions packages/remix/generators.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@
"implementation": "./src/generators/error-boundary/error-boundary.impl",
"schema": "./src/generators/error-boundary/schema.json",
"description": "Add an ErrorBoundary to an existing route"
},
"cypress": {
"implementation": "./src/generators/cypress/cypress.impl#cypressGeneratorInternal",
"schema": "./src/generators/cypress/schema.json",
"description": "Generate a project for testing Remix apps using Cypress"
}
}
}
29 changes: 14 additions & 15 deletions packages/remix/generators.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
export * from './src/generators/action/action.impl';
export * from './src/generators/application/application.impl';
export * from './src/generators/cypress-component-configuration/cypress-component-configuration.impl';
export * from './src/generators/cypress/cypress.impl';
export * from './src/generators/error-boundary/error-boundary.impl';
export * from './src/generators/library/library.impl';
export * from './src/generators/loader/loader.impl';
export * from './src/generators/meta/meta.impl';
export * from './src/generators/preset/preset.impl';
export * from './src/generators/resource-route/resource-route.impl';
export * from './src/generators/route/route.impl';
export * from './src/generators/setup-tailwind/setup-tailwind.impl';
export * from './src/generators/storybook-configuration/storybook-configuration.impl';
export * from './src/generators/style/style.impl';
export * from './src/generators/init/init';
export { default as actionGenerator } from './src/generators/action/action.impl';
export { default as applicationGenerator } from './src/generators/application/application.impl';
export { default as cypressComponentConfigurationGenerator } from './src/generators/cypress-component-configuration/cypress-component-configuration.impl';
export { default as errorBoundaryGenerator } from './src/generators/error-boundary/error-boundary.impl';
export { default as libraryGenerator } from './src/generators/library/library.impl';
export { default as loaderGenerator } from './src/generators/loader/loader.impl';
export { default as metaGenerator } from './src/generators/meta/meta.impl';
export { default as presetGenerator } from './src/generators/preset/preset.impl';
export { default as resourceRouteGenerator } from './src/generators/resource-route/resource-route.impl';
export { default as routeGenerator } from './src/generators/route/route.impl';
export { default as setupTailwindGenerator } from './src/generators/setup-tailwind/setup-tailwind.impl';
export { default as storybookConfigurationGenerator } from './src/generators/storybook-configuration/storybook-configuration.impl';
export { default as styleGenerator } from './src/generators/style/style.impl';
export { default as initGenerator } from './src/generators/init/init';
74 changes: 41 additions & 33 deletions packages/remix/src/generators/application/application.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
readJson,
readProjectConfiguration,
runTasksInSerial,
stripIndents,
toJS,
Tree,
updateJson,
Expand Down Expand Up @@ -49,7 +50,6 @@ export function remixApplicationGenerator(
});
}

// TODO(@columferry): update this to use crystal?
export async function remixApplicationGeneratorInternal(
tree: Tree,
_options: NxRemixGeneratorSchema
Expand All @@ -70,38 +70,40 @@ export async function remixApplicationGeneratorInternal(
sourceRoot: `${options.projectRoot}`,
projectType: 'application',
tags: options.parsedTags,
targets: {
build: {
executor: '@nx/remix:build',
outputs: ['{options.outputPath}'],
options: {
outputPath: joinPathFragments('dist', options.projectRoot),
},
},
serve: {
executor: `@nx/remix:serve`,
options: {
command: `${
getPackageManagerCommand().exec
} remix-serve build/index.js`,
manual: true,
port: 4200,
},
},
start: {
dependsOn: ['build'],
command: `remix-serve build/index.js`,
options: {
cwd: options.projectRoot,
},
},
typecheck: {
command: `tsc --project tsconfig.app.json`,
options: {
cwd: options.projectRoot,
},
},
},
targets: !options.addPlugin
? {
build: {
executor: '@nx/remix:build',
outputs: ['{options.outputPath}'],
options: {
outputPath: joinPathFragments('dist', options.projectRoot),
},
},
serve: {
executor: `@nx/remix:serve`,
options: {
command: `${
getPackageManagerCommand().exec
} remix-serve build/index.js`,
manual: true,
port: 4200,
},
},
start: {
dependsOn: ['build'],
command: `remix-serve build/index.js`,
options: {
cwd: options.projectRoot,
},
},
typecheck: {
command: `tsc --project tsconfig.app.json`,
options: {
cwd: options.projectRoot,
},
},
}
: {},
});

const installTask = updateDependencies(tree);
Expand Down Expand Up @@ -226,6 +228,12 @@ export async function remixApplicationGeneratorInternal(
addPlugin: options.addPlugin,
});
tasks.push(eslintTask);

tree.write(
joinPathFragments(options.projectRoot, '.eslintignore'),
stripIndents`build
public/build`
);
}

if (options.js) {
Expand Down
42 changes: 0 additions & 42 deletions packages/remix/src/generators/cypress/cypress.impl.spec.ts

This file was deleted.

Loading

0 comments on commit bd46ba8

Please sign in to comment.