mirror of
https://github.com/carloscuesta/gitmoji.git
synced 2025-12-08 20:14:12 +00:00
✨ Export gitmojis as CJS and ESM (#1280)
* ➕ Install `unbuild` dependency * 🚚 Rename `gitmojis.d.ts` to `index.d.ts` * ✨ Export `cjs` and `esm` with `unbuild` * 👷 Add `build` step to publish action * 🔧 Add `gitmojis` build output to turborepo config * 🔧 Add `build` as a dependency for `lint`, `tscheck` and `build` * ✨ Add `assert { type: json }` for JSON imports * 🧑💻 Watch changes on `gitmojis` to rebuild deps for website (#1282) Co-authored-by: Vinícius Hoyer <contact@vhoyer.dev>
This commit is contained in:
parent
4733717a59
commit
8fd367f259
40
.github/workflows/npm-publish.yml
vendored
40
.github/workflows/npm-publish.yml
vendored
@ -2,26 +2,28 @@ name: NPM Publish
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
- "v*"
|
||||
jobs:
|
||||
npm-publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: 'yarn'
|
||||
node-version: '16'
|
||||
- name: Install dependencies 📦
|
||||
run: yarn install --immutable
|
||||
- name: Publish package to NPM 🚀
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
|
||||
run: |
|
||||
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
||||
yarn turbo publishPackage
|
||||
- name: Publish GitHub Release 📝
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: gitmoji ${{github.ref_name}}
|
||||
generate_release_notes: true
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
cache: "yarn"
|
||||
node-version: "16"
|
||||
- name: Install dependencies 📦
|
||||
run: yarn install --immutable
|
||||
- name: Build 👷♂️
|
||||
run: yarn turbo run build --filter=gitmojis
|
||||
- name: Publish package to NPM 🚀
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }}
|
||||
run: |
|
||||
npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
|
||||
yarn turbo publishPackage
|
||||
- name: Publish GitHub Release 📝
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
name: gitmoji ${{github.ref_name}}
|
||||
generate_release_notes: true
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
],
|
||||
"scripts": {
|
||||
"prepare": "husky install",
|
||||
"dev": "yarn turbo dev"
|
||||
"dev": "yarn turbo --parallel dev"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vercel/analytics": "^0.1.8",
|
||||
|
||||
@ -1,14 +1,22 @@
|
||||
{
|
||||
"name": "gitmojis",
|
||||
"type": "module",
|
||||
"version": "3.13.3",
|
||||
"description": "An emoji guide for your commit messages.",
|
||||
"main": "src/index.js",
|
||||
"main": "./dist/index.cjs",
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.mjs",
|
||||
"require": "./dist/index.cjs"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"src/gitmojis.json",
|
||||
"src/schema.json"
|
||||
"dist"
|
||||
],
|
||||
"types": "src/gitmojis.d.ts",
|
||||
"scripts": {
|
||||
"dev": "nodemon --exec 'yarn build' --watch ./src",
|
||||
"build": "unbuild",
|
||||
"lint:json": "ajv --spec=draft2020 validate -s ./src/schema.json -d ./src/gitmojis.json",
|
||||
"lint": "yarn run lint:json && prettier --check ./src/**/*.{js,json,ts}",
|
||||
"publishPackage": "npm publish"
|
||||
@ -16,7 +24,9 @@
|
||||
"devDependencies": {
|
||||
"ajv-cli": "^5.0.0",
|
||||
"lint-staged": "^13.0.0",
|
||||
"prettier": "2.8.3"
|
||||
"nodemon": "^2.0.20",
|
||||
"prettier": "2.8.3",
|
||||
"unbuild": "^1.1.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "carloscuesta",
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import gitmojisJson from './gitmojis.json'
|
||||
import gitmojisJson from './gitmojis.json' assert { type: 'json' }
|
||||
|
||||
export { default as schema } from './schema.json'
|
||||
export { default as schema } from './schema.json' assert { type: 'json' }
|
||||
|
||||
export const gitmojis = gitmojisJson.gitmojis
|
||||
|
||||
@ -2,19 +2,23 @@
|
||||
"$schema": "https://turbo.build/schema.json",
|
||||
"pipeline": {
|
||||
"dev": {
|
||||
"dependsOn": ["^build"],
|
||||
"cache": false
|
||||
},
|
||||
"lint": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": []
|
||||
},
|
||||
"tscheck": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": []
|
||||
},
|
||||
"test": {
|
||||
"dependsOn": ["^build"],
|
||||
"outputs": ["coverage/**"]
|
||||
},
|
||||
"build": {
|
||||
"outputs": [".next/**", "public/**"]
|
||||
"outputs": [".next/**", "public/**", "dist/**"]
|
||||
},
|
||||
"publishPackage": {
|
||||
"dependsOn": ["^lint"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user