Skip to content

Commit

Permalink
fix: point type def in package json to index
Browse files Browse the repository at this point in the history
  • Loading branch information
boan-anbo committed Nov 14, 2023
1 parent 8d45bf0 commit c073af0
Show file tree
Hide file tree
Showing 13 changed files with 219 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Cantos is in eperimental phase with regular breaking changes.

Changelog will be added with `v0.1.0`. Until then, you can

- check the source code for documentation and commits for changelog, and
- check the [source code](packages/cantos/src) for documentation and commits for changelog, and
- check [tests](packages/cantos/tests) for current working examples.

# Cantos: Write Better Tests
Expand Down
4 changes: 2 additions & 2 deletions packages/cantos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "cantos",
"private": false,
"author": "Bo An",
"version": "0.0.3",
"version": "0.0.4",
"keywords": [
"User Stories",
"TDD",
Expand All @@ -29,7 +29,7 @@
"type": "module",
"main": "./dist/cantos.umd.cjs",
"module": "./dist/cantos.js",
"types": "./dist/cantos.d.ts",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/cantos.js",
Expand Down
38 changes: 38 additions & 0 deletions packages/mermaid-whisper/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-explicit-any": "off",
},
"settings": {

}
}
8 changes: 8 additions & 0 deletions packages/mermaid-whisper/.idea/.gitignore

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

19 changes: 19 additions & 0 deletions packages/mermaid-whisper/design/mermaid-whisper-story.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {CastProfiles, loadCast, StoryScript} from "cantos";

const mwCastProfiles = {
MW: {
role: "Mermaid Whisper",
},
diagramHeader: {
role: 'Header',
}

} satisfies CastProfiles


const mwCast = loadCast(mwCastProfiles);

const mwStoryScript = {
who: ['MW'],
story: 'Mermaid Whisper Tests',
} satisfies StoryScript<typeof mwCast>
54 changes: 54 additions & 0 deletions packages/mermaid-whisper/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "mermaid-whisper",
"private": false,
"author": "Bo An",
"version": "0.0.1",
"keywords": [
"Mermaid"
],
"type": "module",
"main": "./dist/mermaid-whisper.umd.cjs",
"module": "./dist/mermaid-whisper.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"import": "./dist/mermaid-whisper.js",
"require": "./dist/mermaid-whisper.umd.cjs"
}
},
"files": [
"dist"
],
"scripts": {
"dev": "vite",
"build:tsc": "tsc --project tsconfig.build.json",
"build": "yarn build:tsc && vite build",
"dry-run": "npm pack --dry-run",
"preview": "vite preview",
"test": "vitest",
"test:ui": "vitest --ui",
"mermaid": "^10.6.1"
},
"devDependencies": {
"@types/node": "^20.9.0",
"@types/uuid": "^9.0.7",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@vitest/coverage-v8": "^0.34.6",
"@vitest/ui": "^1.0.0-beta.4",
"eslint": "^8.53.0",
"typescript": "^5",
"vite": "^4.4.5",
"vite-plugin-dts": "^3.6.3",
"vite-plugin-eslint": "^1.8.1",
"vitest": "^1.0.0-beta.4"
},
"dependencies": {
"cantos": "^0.0.4",
"mermaid": "^10.6.1"
},
"peerDependencies": {
"typescript": "^5"
},
"license": "MIT"
}
3 changes: 3 additions & 0 deletions packages/mermaid-whisper/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import * as MW from './mermaid-whisper.ts';

export {MW, MW as MermaidWhisper}
17 changes: 17 additions & 0 deletions packages/mermaid-whisper/src/mermaid-types/flowchart/flow-chart.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const DIRECTIONS = {
// Left to right direction
LR: 'LR',
// Right to left direction
RL: 'RL',
// Left to right direction
TD: 'TD',
// Top to bottom direction
TB: 'TB',
} as const;

export const FLOW_CHART_DEF = {
DIAGRAM_TYPE: 'flowchart',
DIRECTIONS
} as const;


5 changes: 5 additions & 0 deletions packages/mermaid-whisper/src/mermaid-whisper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class MermaidWhisper {
constructor() {
console.log('MermaidWhisper constructor');
}
}
7 changes: 7 additions & 0 deletions packages/mermaid-whisper/tests/mermaid-whisper-smoke.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import {describe, expect, it} from "vitest";

describe('mermaid-whisper.ts', () => {
it('should be a thing', () => {
expect(true).toBe(true);
});
})
Empty file.
29 changes: 29 additions & 0 deletions packages/mermaid-whisper/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"],
"skipLibCheck": true,

/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"outDir": "./dist/",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"paths": {
"@src/*": ["./src/*"]
}
},
"include": [
"src",
"tests"
]
}
36 changes: 36 additions & 0 deletions packages/mermaid-whisper/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import {defineConfig, UserConfig} from "vitest/config";
import * as path from "path";
import dts from 'vite-plugin-dts';
import eslintPlugin from "vite-plugin-eslint";
export const viteConfig: UserConfig = {
resolve: {
alias: {
'@src': path.resolve(__dirname, './src')

}
},
build: {
lib: {
entry: path.resolve(__dirname, './src/index.ts'),
name: 'mermaid-whisper.ts',
fileName: 'mermaid-whisper.ts',
},
rollupOptions: {
external: ['./tests']
}
},
plugins: [dts({
tsconfigPath: 'tsconfig.build.json'
}), eslintPlugin()],
test: {
include: ['**/*.test.ts'],
setupFiles: [
'tests/utils/setup.ts'
],
coverage: {
provider: 'v8',
include: ['**/*.ts'],
}
},
}
export default defineConfig(viteConfig);

0 comments on commit c073af0

Please sign in to comment.