Skip to content

Commit

Permalink
refactor: Simplify module structure
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Apr 1, 2021
1 parent e3dcf7d commit 1207683
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 8 deletions.
File renamed without changes.
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# Generated files
/docs/
/src/generated/
/esm/
/esm/**/*.js
/esm/**/*.ts
/esm/**/*.map
!/esm/package.json
/cjs/**/*.js
/cjs/**/*.ts
/cjs/**/*.map
!/cjs/tests/**/*.js
!/cjs/codegen.js
!/cjs/package.json

# Vim shit
*.swp
Expand Down
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Mauna SDK

_Version: 0.2.7_

## Features

- Docs can be found [here](https://mauna-ai.github.io/sdk).
Expand Down Expand Up @@ -282,4 +284,36 @@ Takes text (`string`) as input and returns audio encoded as a base64 string.
api.textToSpeech: (text: string) => {
audio // base64 encoded audio
}

```

*****

## Building

### Note on package style commonjs vs esm

- The `esm/` directory is marked as a nodejs-native ES module using `esm/package.json`

### Instructions for building package

- Edit files in `src/` directory
- Run `npm run build`
- Add test cases in `cjs/tests/` directory. File names need to start with `test_`.
- Make sure to set env vars: `export MAUNA_DEVELOPER_ID=XX MAUNA_API_KEY=XXX`
- Run `npm test`

### Instructions for publishing package

- If build successful, **before committing results**, run `npm run version bump`.
- `npm publish --access public`

### Instructions for updating docs

Docs are built using `typedoc` and published on github pages.

- Update version on this README
- Run `npm run docs`
- Commit all changes,
- Then `git checkout gh-pages` and `git merge <original-branch>`
- `git push origin gh-pages`
3 changes: 0 additions & 3 deletions cjs/package.json

This file was deleted.

3 changes: 3 additions & 0 deletions esm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
File renamed without changes.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Code generated from Mauna API schema for CLI, SDK etc",
"main": "./cjs/index.js",
"module": "./esm/index.js",
"type": "module",
"type": "commonjs",
"exports": {
"./esm": "./esm/index.js",
".": "./cjs/index.js"
Expand All @@ -20,8 +20,8 @@
"codegen": "graphql-codegen --config cjs/codegen.js",
"tsc": "tsc && tsc -p tsconfig-cjs.json",
"docs": "typedoc src/index.ts --out ./docs",
"prepublishOnly": "npm run lint && npm run build && npm test",
"build": "npm run codegen && npm run tsc && npm run docs"
"prepublishOnly": "npm run build && npm test",
"build": "npm run codegen && npm run tsc && npm run lint && npm run docs"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 1207683

Please sign in to comment.