Skip to content
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

build: overhaul tooling with create-typescript-app@1 #142

Merged
merged 7 commits into from
Nov 18, 2023

Conversation

JoshuaKGoldberg
Copy link
Collaborator

@JoshuaKGoldberg JoshuaKGoldberg commented Sep 7, 2023

Brings on a ton of tooling - all the various repository things I've found to be useful. They can all be ripped out if you don't want their overhead in this repo. The major starting areas are:

  • A lot of docs: code of conduct, contributing & development guides, issue & PR templates, ...
  • All Contributors: which should automatically populate over time using all-contributors-auto-action
  • release-it: automatic package bumps & publishes based on semantic commit titles
  • Linting: ESLint with a bunch of plugins, as well as a few other good linters - most notably cspell for spell checking and Knip for unused dependency & export detection
  • pnpm instead of npm for faster cached installs

Most of these changes were generated with create-typescript-app's migration mode:

npx create-typescript-app --mode migrate --author omnidan --base everything --description "Friendly emoji lookups and parsing utilities for Node.js. 😏" --email me@omnidan.net --funding omnidan --owner omnidan --repository node-emoji --skip-github-api true --title node-emoji

Note that I ran with --skip-github-api. That means repository settings weren't populated with the GitHub API. They'll need to be done manually (or with another call to npx create-typescript-app) upon merge.

Fixes #73. Fixes #135.

Copy link
Collaborator Author

@JoshuaKGoldberg JoshuaKGoldberg Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list was generated by https://github.com/JoshuaKGoldberg/all-contributors-for-repository. I then added a few contributions under omnidan that weren't detected automatically.

Is this missing anybody and/or any contributions?

@@ -0,0 +1,149 @@
/** @type {import("@types/eslint").Linter.Config} */
Copy link
Collaborator Author

@JoshuaKGoldberg JoshuaKGoldberg Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick links & descriptions for the plugins this config loads in:

Each of these can totally be reconfigured/removed. I just like all of them and would suggest each in general. 😄

Footnotes

  1. Not to be confused with Markdownlint, which is a separate linter specifically for Markdown files. I haven't investigated using eslint-plugin-md(x) yet (https://github.com/JoshuaKGoldberg/create-typescript-app/issues/567).

Copy link
Collaborator Author

@JoshuaKGoldberg JoshuaKGoldberg Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that some of the links in this and other docs files rely on specific issue label names, such as status: accepting prs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope you enjoy GitHub notifications 😄... note that this uses stabilityDays so that PRs for new packages will wait a few days. That's a good security practice to let the community vet potentially malicious new releases.

"dependencies": {
"@sindresorhus/is": "^3.1.2",
"@sindresorhus/is": "^6.0.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The old version of /is was presenting issues with imports...

src/emojify.ts:25:18 - error TS2339: Property 'undefined' does not exist on type 'typeof import("/Users/josh/repos/node-emoji/node_modules/.pnpm/@sindresorhus+is@3.1.2/node_modules/@sindresorhus/is/dist/index")'.

25   assert.any([is.undefined, is.function], fallbackFunction)

@JoshuaKGoldberg JoshuaKGoldberg marked this pull request as ready for review September 7, 2023 05:45
Copy link
Owner

@omnidan omnidan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks really good - thanks a lot of standardizing the repo! 💖 I do not have any strong opinions on which plugins to use, and the ones you suggested seem fine to me. I also think that adding prettier, eslint, husky/lint-staged are a really good idea to keep the quality and consistency of the project. I also love that we are including all contributors automatically now! 💞 I only have a small comment regarding the emoji to be used in the description. The rest is fine for me. I can set up the required tokens (or give you access so that you can do it too?).

## Emojis & Appreciation

If you made it all the way to the end, bravo dear user, we love you.
Please include your favorite emoji in the bottom of your issues and PRs to signal to us that you did in fact read this file and are trying to conform to it as best as possible.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea ☺️

package.json Outdated
"type": "git",
"url": "https://github.com/omnidan/node-emoji.git"
},
"description": "Friendly emoji lookups and parsing utilities for Node.js. 😏",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small thing but maybe we can use the 💖 emoji here, I feel it is more friendly and universal than 😏 which could be misunderstood.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it! 💖 is my favorite one.

@JoshuaKGoldberg JoshuaKGoldberg merged commit 9a115a3 into omnidan:main Nov 18, 2023
@JoshuaKGoldberg JoshuaKGoldberg deleted the create-typescript-app-1 branch November 18, 2023 22:07
@JoshuaKGoldberg
Copy link
Collaborator Author

JoshuaKGoldberg commented Nov 18, 2023

Note that until we set up the tokens then 1-2 jobs on main will fail (contributor recognition and package publishing). This is expected and won't cause anything negative in the repo.

@Revadike
Copy link

Revadike commented Dec 1, 2023

This overhaul causes the following build error for our nuxt2 app:

Entrypoint app = 0b2fe6a.js 483a9b5.js fa73801.js 7bcbdff.js

ERROR in ./node_modules/node-emoji/lib/index.js 74:33
Module parse failed: Unexpected token (74:33)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| // src/find.ts
| var find = (codeOrName) => {
>   return findByCode(codeOrName) ?? findByName(codeOrName);
| };
| 
 @ ./components/SEmojiSelector.vue?vue&type=script&lang=js (./node_modules/babel-loader/lib??ref--2-0!./node_modules/@nuxt/components/dist/loader.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./components/SEmojiSelector.vue?vue&type=script&lang=js) 2:0-36 32:22-34
 @ ./components/SEmojiSelector.vue?vue&type=script&lang=js
 @ ./components/SEmojiSelector.vue
 @ ./components/Input/ChatMessage.vue
 @ ./node_modules/.cache/nuxt/components/index.js
 @ ./node_modules/.cache/nuxt/components/plugin.js
 @ ./node_modules/.cache/nuxt/index.js
 @ ./node_modules/.cache/nuxt/client.js
 @ multi ./node_modules/@nuxt/components/lib/installComponents.js ./node_modules/.cache/nuxt/client.js

 FATAL  Nuxt build error                                                                                                                                                                                                                                                                                              11:08:33  

  at WebpackBundler.webpackCompile (node_modules\@nuxt\webpack\dist\webpack.js:1868:21)
  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
  at async WebpackBundler.build (node_modules\@nuxt\webpack\dist\webpack.js:1833:5)
  at async Builder.build (node_modules\@nuxt\builder\dist\builder.js:249:5)
  at async ensureBuild (node_modules\@nuxt\cli\dist\cli-generate.js:117:3)
  at async Object.run (node_modules\@nuxt\cli\dist\cli-generate.js:234:7)
  at async NuxtCommand.run (node_modules\@nuxt\cli\dist\cli-index.js:356:7)


   ╭─────────────────────────────╮
   │                             │
   │   ✖ Nuxt Fatal Error        │
   │                             │
   │   Error: Nuxt build error   │
   │                             │
   ╰─────────────────────────────╯

error Command failed with exit code 1.

@JoshuaKGoldberg
Copy link
Collaborator Author

@Revadike could you please file a new issue? It's hard to help with just a copy & paste of build output.

My guess is you're on an old version of Node that doesn't support the nullish coalescing operator. Per MDN support was added in Node 14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooling: Add in Issue and PR Templates missed CHANGELOG.md file
3 participants