-
Notifications
You must be signed in to change notification settings - Fork 26
feat: add "preset" generator #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add "preset" generator #10
Conversation
dist folder in npm publish was pointing to the wrong folder
update projectDirectory, projectRoot, and projectType as an application" fix qwikifiers#7
added qwik application files to be use to create nx workspace
Hey @reemardelarosa ! 2 questions:
Thanks 🙏 |
create nx with qwik-nx preset
|
thanks brother! 🙏 |
reuse application generator codes and interfaces
reuse addFiles from application generator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reemardelarosa sorry, maybe I didn't explain it correctly: you don't need any logic at all in this generator
Here's how this file can look like while preserving all the functionality
import { Tree } from '@nrwl/devkit';
import { QwikWorkspacePresetGeneratorSchema } from './schema';
import applicationGenerator from '../application/generator';
export default async function (
tree: Tree,
options: QwikWorkspacePresetGeneratorSchema
) {
return applicationGenerator(tree, options);
}
Please also remove extra exports in application generator
We may add something else to the preset generator later if it's needed, but at this point we can only create an app 🤷♂️
reuse existing generator and remove unnecessary codes
@dmitry-stepanenko Updated |
tree: Tree, | ||
options: QwikWorkspacePresetGeneratorSchema | ||
) { | ||
options.directory = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes directory
property basically useless. Is it intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qwik-nx/packages/qwik-nx/src/generators/application/utils/normalize-options.ts
Lines 21 to 25 in 7cb3845
function normalizeDirectory(options: QwikAppGeneratorSchema) { | |
return options.directory | |
? `${names(options.directory).fileName}/${names(options.name).fileName}` | |
: names(options.name).fileName; | |
} |
options.directory = ''
will use the names(options.name).fileName;
There is a bug if I will just reuse the options.directory, it will create org/apps/qwik-app/qwik-app
.
Do you have any suggestions to fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I cannot reproduce this, can you please describe how exactly this comes out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, it's not reproducible for me if I run npx create-nx-workspace org-workspace --preset=qwik-nx
But I can actually reproduce by running npx nx generate qwik-nx:preset abc --no-interactive --dry-run
in an existing repo by replacing actual options with the list of options that is being provided to the preset
generator by create-nx-workspace
:
{ "_": ["neatspace", "Object]"], "preset": "qwik-nx", "allPrompts": false, "a": false, "skipGit": false, "g": false, "commit": "[object", "/bin/sh": "/Users/dmitriy/.npm/_npx/d2207cf76adb22dc/node_modules/.bin/create-nx-workspace", "name": "neatspace", "appName": "", "nxCloud": false, "packageManager": "npm", "defaultBase": "main", "ci": "", "cli": "nx", "style": "css", "skipInstall": false, "linter": "eslint", "directory": "neatspace", "presetVersion": "undefined", "skipFormat": false, "unitTestRunner": "vitest", "strict": true }
Since nx may use/override flags that we're using, it feels like the best what we can do is to modify the schema to have other names there. For example, it can properly generate the app name using this command npx create-nx-workspace --preset=qwik-nx --qwikAppName=neat-qwik-app
.
Here's the list of inputs that will be overridden:
name,
preset,
appName,
style,
cli,
nxCloud,
packageManager,
defaultBase,
ci,
So I propose to rename the following inputs:
- name =>
qwikAppName ?? options.name
- style => qwikAppStyle
and remove the following inputs as they won't be actually used:
- directory
- skipFormat
Then we can map property names to what applicationGenerator
needs.
@reemardelarosa @shairez maybe you have any other thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shairez @reemardelarosa I think it's better to ship whatever we can at this point and enhance it later down the road once we're able to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reemardelarosa did you have a chance to implement this yet?
if not please let us know and we'll do it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with @dmitry-stepanenko, to create separate issue/pr for standalone.
WDYT @shairez ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reemardelarosa yes, standalone could be a separate PR
I was talking about the link in my last comment, about implementing the changes you suggested in your last comment
wanted just to ask if you did that work already and didn't push, because I didn't see it in the commits yet and didn't want us to do duplicated work
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shairez I did not implemented this yet
name => qwikAppName ?? options.name
style => qwikAppStyle
@dmitry-stepanenko @reemardelarosa WDYT about adding a prompt asking if they want the new "standalone" project vs the traditional monorepo project? |
Thanks @reemardelarosa! |
#7
What is it?
Description
Add preset generator to plugin qwik-nx.
Use cases and why
npx create-nx-workspace org-workspace --preset=qwik-nx
Screenshots/Demo
https://github.com/qwikverse/qwiknx-workspace
Checklist: