Skip to content

Commit

Permalink
Merge pull request #9 from 12deg/fix/misc-20240822
Browse files Browse the repository at this point in the history
Fix/misc 20240822
  • Loading branch information
opichon authored Aug 25, 2024
2 parents f9d710e + f144bd4 commit fd6244b
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 30 deletions.
21 changes: 21 additions & 0 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ export default class LibraryGenerator extends Generator {
name: "version",
type: "input",
},
{
default: "",
message: "Author name",
name: "authorName",
type: "input",
},
{
default: "",
message: "Author email",
name: "authorEmail",
type: "input",
},
{
default: "",
message: "Author website",
name: "authorWebsite",
type: "input",
},
{
default: true,
message: "Include fastify plugin?",
Expand Down Expand Up @@ -53,6 +71,9 @@ export default class LibraryGenerator extends Generator {
path: "../fastify-plugin/index.js"
},
{
authorEmail: this.props.authorEmail,
authorName: this.props.authorName,
authorWebsite: this.props.authorWebsite,
baseName: this.props.name,
description: `A fastify plugin for the ${this.props.name} library`,
destinationPath: "packages/fastify",
Expand Down
2 changes: 1 addition & 1 deletion generators/app/templates/.github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 18, 20]
node-version: [20, 21]
steps:
- uses: actions/checkout@v4
name: Use node ${{ matrix.node-version }}
Expand Down
21 changes: 0 additions & 21 deletions generators/app/templates/LICENSE

This file was deleted.

4 changes: 2 additions & 2 deletions generators/app/templates/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ outdated:

publish:
@printf "\033[0;32m>>> Publish packages\033[0m\n"
shipjs trigger
pnpm publish

release:
@printf "\033[0;32m>>> Prepare packages for release\033[0m\n"
shipjs prepare
pnpm release

sort-package:
@printf "\033[0;32m>>> Format package.json\033[0m\n"
Expand Down
11 changes: 10 additions & 1 deletion generators/app/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
"name": "@<%= scope %>/<%= name %>",
"version": "<%= version %>",
"homepage": "https://github.com/<%= scope %>/<%= name %>#readme",
<%_ if (authorName) { _%>
"author": {
"name": "<%= authorName %>"<%_ if (authorEmail) { %>,
"email": "<%= authorEmail %>"<% } %><%_ if (authorWebsite) { %>,
"url": "<%= authorWebsite %>"<% } %>
},
<%_ } _%>
"private": true,
"repository": {
"type": "git",
Expand All @@ -15,6 +22,8 @@
"lint": "turbo run lint",
"lint:fix": "turbo run lint:fix",
"prepare": "husky",
"publish": "npx shipjs trigger",
"release": "npx shipjs prepare",
"sort-package": "npx sort-package-json && turbo run sort-package",
"test": "turbo run test --parallel",
"typecheck": "turbo run typecheck"
Expand All @@ -23,7 +32,7 @@
"@commitlint/cli": "19.4.0",
"@commitlint/config-conventional": "19.2.2",
"@types/node": "22.4.0",
"husky": "9.1.4",
"husky": "9.1.5",
"shipjs": "0.26.4",
"turbo": "2.0.14",
"typescript": "5.5.4"
Expand Down
30 changes: 30 additions & 0 deletions generators/fastify-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,36 @@ export default class FastifyPluginGenerator extends Generator {
this.props.version = this.options.version;
}

if (!this.options.authorName) {
prompts.push({
message: "Author name",
name: "authorName",
type: "input",
});
} else {
this.props.authorName = this.options.authorName;
}

if (!this.options.authorEmail) {
prompts.push({
message: "Author email",
name: "authorEmail",
type: "input",
});
} else {
this.props.authorEmail = this.options.authorEmail;
}

if (!this.options.authorWebsite) {
prompts.push({
message: "Author website",
name: "authorWebsite",
type: "input",
});
} else {
this.props.authorWebsite = this.options.authorWebsite;
}

if (!this.options.installationType) {
prompts.push({
message: "Choose the type of installation:",
Expand Down
9 changes: 8 additions & 1 deletion generators/fastify-plugin/templates/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@
<%_ } _%>
<%_ if (installationType == 'standalone') { _%>
"homepage": "https://github.com/<%= scope %>/<%= name %>#readme",
"private": true,
"repository": {
"type": "git",
"url": "git+https://github.com/<%= scope %>/<%= name %>.git"
},
<%_ } _%>
"license": "MIT",
<%_ if (authorName) { _%>
"author": {
"name": "<%= authorName %>"<%_ if (authorEmail) { %>,
"email": "<%= authorEmail %>"<% } %><%_ if (authorWebsite) { %>,
"url": "<%= authorWebsite %>"<% } %>
},
<%_ } _%>
"type": "module",
"exports": {
".": {
Expand Down
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ outdated:

publish:
@printf "\033[0;32m>>> Publish packages\033[0m\n"
npx shipjs trigger
npm run publish

release:
@printf "\033[0;32m>>> Prepare packages for release\033[0m\n"
npx shipjs prepare
npm run release

sort-package:
@printf "\033[0;32m>>> Format package.json\033[0m\n"
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
"lint": "eslint",
"lint:fix": "eslint --fix",
"prepare": "husky",
"release": "shipjs prepare",
"sort-package": "npx sort-package-json",
"pretest": "eslint .",
"publish": "npx shipjs trigger",
"release": "npx shipjs prepare",
"sort-package": "npx sort-package-json",
"test": "jest --passWithNoTests"
},
"jest": {
Expand Down

0 comments on commit fd6244b

Please sign in to comment.