Skip to content

Commit

Permalink
ci: disable docs & tests, and add CLI placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvera committed May 22, 2024
1 parent 9b5777e commit ad6225f
Show file tree
Hide file tree
Showing 11 changed files with 175 additions and 1,840 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- name: Lint
run: yarn lint

- name: Run tests
run: yarn test

- name: Build
run: yarn build

Expand Down
26 changes: 0 additions & 26 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
#!/usr/bin/env sh

# Do not run docs on CI
yarn is-ci || yarn docs

yarn lint-staged

# Check if there are unstaged changes to README.md
DOCS_ADDED=$(git ls-files --others --exclude-standard docs)
DOCS_MODIFIED=$(git ls-files --modified docs)
DOCS_DELETED=$(git ls-files --deleted docs)

if [ "$DOCS_ADDED" != "" ] || [ "$DOCS_MODIFIED" != "" ] || [ "$DOCS_DELETED" != "" ]; then
echo "---------------------------------------------------------------------"
echo "Commit blocked by pre-commit hook."
echo "---------------------------------------------------------------------"
echo "WHY?"
echo "There are unstaged changes in the /docs directory which means that"
echo "those changes won't be committed. In order to ensure that the "
echo "documentation stays up to date with the code documentation is"
echo "generated using tsdoc as a precommit hook."
echo ""
echo "FIX"
echo " 1. Review the changes to files in the docs directory"
echo " 2. Stage the changes"
echo " 3. Commit the changes"
echo "---------------------------------------------------------------------"
exit 1
fi
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2024 I Forgot To Add My Name Here
Copyright (c) 2024 Eric Vera

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
65 changes: 4 additions & 61 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,6 @@
# TypeScript library repo template
# firebase-index-gen

**Template repo for building a modern TypeScript library optimized for minimal setup and maintenance effort**
**Generate a Firestore Index file from indexes used during a Firebase emulator run.**

An opinionated template repo configured with the following:

- Typescript
- ESM only
- Node >= 20
- Test using Vitest
- Prettier (see `package.json` for config)
- Typescript ESLint (strict & typed mode)
- Github Actions deployment to npm on push to `main` branch
- Github dependabot configured for weekly updates
- Auto-approve dependabot changes after lint, built, and tests pass
- Auto package version bump on push to `main` branch (based on [Conventional Commits](https://www.conventionalcommits.org/) conventions)
- Github Release generation on deployment (based on [Conventional Commits](https://www.conventionalcommits.org/) conventions)
- Yarn with `nodeLinker: node-modules`
- Block commits on lint/format issues (using `lint-staged`)
- VS Code config with suggested eslint and prettier extensions
- VS Code configured for auto-save

## Configuration before you start:

### Update the `LICENSE` file

- Replace `I Forgot To Add My Name Here` on the copyright line with your name

### Update the `package.json` file

- `name`: Your package name
- `repository`: Your repo info
- `keywords`: Keywords to help people find your package

### Add NPM_TOKEN to the repo secrets

NOTE: The package must have been published at least once with `npm publish` in order to be able to generate a granular token scoped to the specific package.

1. [Get a token](https://docs.npmjs.com/creating-and-viewing-access-tokens#creating-granular-access-tokens-on-the-website) from npmjs.com
2. [Add a secret with the npm token to be used by Github Actions](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). The secret must be named `NPM_TOKEN`.

### Enable auto-merge for dependabot pull-requests

There are actually two options:

1. [Enable auto-merge for the repo](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-auto-merge-for-pull-requests-in-your-repository) (only avaylable for public repos or paid accounts as of this writing)
1. Disable the auto-merge option by removing it from `.github/workflows/dependabot.yml`

## Things to know

- Run `yarn` at the root to install all the dependencies and register the new package name before pushing the initial commit
- Ensure that any commits follow [Conventional Commits](https://www.conventionalcommits.org/) conventions in order for the version bump and release notes to work appropriately.

## Yarn Scripts

- `yarn build`
- `yarn lint`
- `yarn test`
- `yarn smoke` - runs build, lint, and test

# API Reference

See [docs](docs/README.md)
[![github license](https://img.shields.io/github/license/ericvera/firebase-index-gen.svg?style=flat-square)](https://github.com/ericvera/firebase-index-gen/blob/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/firebase-index-gen.svg?style=flat-square)](https://npmjs.org/package/firebase-index-gen)
9 changes: 0 additions & 9 deletions docs/README.md

This file was deleted.

24 changes: 0 additions & 24 deletions docs/functions/add.md

This file was deleted.

23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "i-forgot-to-rename-my-package",
"name": "firestore-index-gen",
"version": "0.0.1",
"type": "module",
"exports": {
".": "./dist/index.js"
},
"bin": "./dist/index.js",
"files": [
"dist",
"!/**/__test__",
Expand All @@ -17,9 +18,7 @@
"scripts": {
"build": "tsc --build",
"lint": "eslint .",
"test": "vitest run",
"smoke": "yarn build && yarn lint && yarn test",
"docs": "typedoc && prettier --ignore-unknown --write docs/",
"smoke": "yarn build && yarn lint",
"-- PRE-COMMIT HOOKS --": "",
"postinstall": "husky || true",
"prepublishOnly": "pinst --disable",
Expand All @@ -33,15 +32,11 @@
"@types/node": "^20.12.12",
"eslint": "^9.3.0",
"husky": "^9.0.11",
"is-ci": "^3.0.1",
"lint-staged": "^15.2.4",
"pinst": "^3.0.0",
"prettier": "^3.2.5",
"typedoc": "^0.25.13",
"typedoc-plugin-markdown": "^4.0.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.10.0",
"vitest": "^1.6.0"
"typescript-eslint": "^7.10.0"
},
"prettier": {
"tabWidth": 2,
Expand All @@ -50,9 +45,15 @@
},
"repository": {
"type": "git",
"url": "https://github.com/user/i-forgot-to-rename-my-package"
"url": "https://github.com/ericvera/firestore-index-gen"
},
"keywords": [],
"keywords": [
"firestore",
"index",
"generator",
"cli",
"emulator"
],
"license": "MIT",
"lint-staged": {
"*.{ts,tsx,mjs}": "eslint --cache",
Expand Down
6 changes: 0 additions & 6 deletions src/index.test.ts

This file was deleted.

6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export const add = (a: number, b: number) => a + b
#! /usr/bin/env node

console.log('Hello!')
console.log('@:', __dirname)
console.log('Bye!')
13 changes: 0 additions & 13 deletions typedoc.json

This file was deleted.

Loading

0 comments on commit ad6225f

Please sign in to comment.