-
Notifications
You must be signed in to change notification settings - Fork 138
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 Stackable generator #2016
Conversation
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.
Can you add some docs?
`Generator` is a class extending `BaseGenerator` or any other stackable generator. It's used to generate the Stackable application. You can find an example of a generator in `lib/generator.js`. | ||
|
||
```js | ||
class Generator extends ServiceGenerator { |
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.
the require
for this is missing
|
||
## Consuming a custom application | ||
To create an application based on a Stackable you can run the `npm run create` cli command. This command uses the `cli/create.js` script to generate the application. By default application will be generated in the `./app` folder. As a next step you need to install the dependencies. |
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.
npm run create
sounds a bit odd. I think you want to frame it as
- publish the module
- do a global install
- run the
stackable
command
(the publish/install could be replace with linking
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.
When I'm developing a stackable I want to test it from time to time. The esiest way to do this it to generate a application. If I understand you correctly I would need to publish a stackable every time I make a change to be able to test it. Did I understand you correctly?
About linking. I'm not sure how it can be linked.
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 wouldn't be surprized if 90% of people that would try it don't have an npm account to publish.
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.
npm link
is a thing.
Also running node cli/create.js --dir path/to/myapp
is way nicer.
cli/create.js
should also be set in the bin scripts.
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.
npm link
is a thing.
I mean I don't understand where I can link it. I have a generated stackable project and globally installed platformatic. What it the next step?
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.
npm link --global
would make the bins available globally
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.
Also running
node cli/create.js --dir path/to/myapp
is way nicer.
npm run create executes commmand exactly like this
https://github.com/platformatic/platformatic/pull/2016/files#diff-90f9d2ea47f8756b57ede9621e150c414c1a5963ac1b5c33825fb03942262c72R242
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 would not recommend running a generator inside the same folder I'm currently working on. It just creates a local mess, which could possibly ruin what I'm currently working on. It's better to run it in an external folder.
const config = { | ||
$schema: './stackable.schema.json', | ||
greeting: { | ||
text: this.config.greeting ?? 'Hello world!' |
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.
should be an ENV variable (also show how to add this to the env)
main: 'index.js', | ||
scripts: { | ||
'build:config': 'node lib/schema.js | json2ts > config.d.ts', | ||
create: 'node cli/create.js --dir ./app', |
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.
cli/create.js
must be exposed as a bin
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
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.
lgtm
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.
lgtm
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.
lgtm
Close #1861