Skip to content

Commit

Permalink
Es modules (#6)
Browse files Browse the repository at this point in the history
- added support for `ES Modules`
- created pre publish step
  - This allows us to remove the CI step
  • Loading branch information
Bullrich authored May 4, 2024
1 parent 057e724 commit dac0e8c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 12 deletions.
1 change: 0 additions & 1 deletion .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
- run: npm ci
- name: Set version
run: npm version --no-git-tag-version ${{github.event.release.tag_name}}
- run: npm run build
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Typescript library used to generate the stories for [StoryBot](https://storybot.

[![NPM Release](https://github.com/CodingBull-dev/story-gpt/actions/workflows/npm-publish.yml/badge.svg)](https://github.com/CodingBull-dev/story-gpt/actions/workflows/npm-publish.yml)

![NPM Version](https://img.shields.io/npm/v/story-gpt)
[![NPM Version](https://img.shields.io/npm/v/story-gpt)](https://npmjs.com/story-gpt)

`npm install --save story-gpt`

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,18 @@
"version": "0.0.0-updated-via-gh-releases",
"type": "module",
"description": "Generate a story with an image from a prompt using OpenAI's GPT",
"main": "dist/index.js",
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"files": [
"dist/"
],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"build": "tsc -p tsconfig.json && tsc -p tsconfig.cjs.json",
"lint": "eslint",
"fix": "eslint --fix",
"docs": "typedoc --readme README.md src/index.ts"
"docs": "typedoc --readme README.md src/index.ts",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./dist/cjs"
},
}
7 changes: 2 additions & 5 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
"src/index.ts"
],
"compilerOptions": {
"target": "ES2022",
"lib": [
"ES2020"
],
"module": "ES2022",
"target": "ES2015",
"module": "ES2020",
"moduleResolution": "Node",
"declaration": true,
"outDir": "./dist",
Expand Down

0 comments on commit dac0e8c

Please sign in to comment.