Skip to content

Commit

Permalink
feat: config TS considering testing and cli environments
Browse files Browse the repository at this point in the history
  • Loading branch information
slavarazum committed Jan 9, 2025
1 parent c524969 commit cefd7b7
Show file tree
Hide file tree
Showing 10 changed files with 1,665 additions and 1,218 deletions.
3 changes: 3 additions & 0 deletions .czrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"path": "@commitlint/cz-commitlint"
}
2,825 changes: 1,624 additions & 1,201 deletions package-lock.json

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,22 @@
"packages/vue"
],
"scripts": {
"prepare": "husky && run-p type-check lint format",
"commit": "commit",
"prepare": "husky",
"validate": "run-p type-check lint format",
"commit": "cz",
"docs:dev": "vitepress dev docs",
"story:dev": "histoire dev",
"docs:build": "vitepress build docs",
"story:build": "histoire build",
"docs:preview": "vitepress preview docs",
"story:preview": "histoire preview",
"format": "prettier --write docs/.vitepress packages/vue/src",
"lint": "eslint . --fix",
"style": "eslint . --fix && prettier --write docs/.vitepress",
"lint": "eslint .",
"format": "prettier docs/.vitepress",
"type-check": "vue-tsc --build --force",
"vue": "npm run --workspace=@webui/vue"
},
"dependencies": {
"@commitlint/prompt-cli": "^19.6.0",
"@fontsource-variable/jura": "^5.1.0",
"@fontsource-variable/nunito": "^5.1.0",
"@heroicons/vue": "^2.1.5",
Expand All @@ -41,15 +42,19 @@
"devDependencies": {
"@commitlint/cli": "^19.6.0",
"@commitlint/config-conventional": "^19.6.0",
"@commitlint/cz-commitlint": "^19.5.0",
"@vue/eslint-config-prettier": "^10.1.0",
"@vue/eslint-config-typescript": "^14.1.3",
"commitizen": "^4.3.1",
"eslint": "^9.14.0",
"eslint-plugin-cypress": "^4.1.0",
"eslint-plugin-vue": "^9.31.0",
"husky": "^9.1.7",
"inquirer": "^9.3.7",
"prettier": "^3.3.3",
"prettier-plugin-organize-imports": "^4.1.0",
"prettier-plugin-tailwindcss": "^0.6.8",
"typescript": "5.6.2",
"vue-tsc": "2.0.29"
"vue-tsc": "^2.1"
}
}
2 changes: 1 addition & 1 deletion packages/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"build-cli": "vite build --config vite.cli.config.ts",
"build:cli": "tsup",
"watch:cli": "tsup --watch",
"cli:type-check": "tsc --build --force --config tsconfig.cli.json",
"type-check:cli": "tsc --build --force --config tsconfig.cli.json",
"type-check": "vue-tsc --build --force",
"test:unit": "vitest --run",
"test:coverage": "vitest --coverage --run",
Expand Down
9 changes: 5 additions & 4 deletions packages/vue/tests/bin/use.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { describe, it } from 'vitest'
import { describe, it, expect } from 'vitest'

import program from '@/bin/program'
import program from '$/program'
// import prompts from 'prompts'
import type { AvailableCommands } from '@/bin/cli'
import type { AvailableCommands } from '$/cli'

function run(name: AvailableCommands, prompts?: string[]) {
program.parse(['node', 'webui', name])
console.log(prompts)
}

describe('CLI testing', () => {
it('copies all components with `use` command', () => {
// prompts.inject([''])
program.action(() => console.log('It works!'))
program.parse(['node', 'webui', 'use'])
run('use')
expect(2).toBe(2)
})
})
6 changes: 3 additions & 3 deletions packages/vue/tsconfig.cli.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@tsconfig/node22/tsconfig.json",

"include": ["src/bin/**/*", "src/bin/**/*.ts"],
"include": ["package.json", "src/bin/**/*.ts"],

"compilerOptions": {
"target": "ESNext",
Expand All @@ -10,9 +10,9 @@
"skipLibCheck": true,

/* Alias */
"baseUrl": ".",
"baseUrl": "./src/bin",
"paths": {
"$/*": ["src/bin/*"]
"$/*": ["./*"]
},

/* Bundler mode */
Expand Down
3 changes: 3 additions & 0 deletions packages/vue/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
{
"path": "./tsconfig.vitest.json"
},
{
"path": "./tsconfig.vitest.cli.json"
},
{
"path": "./tsconfig.cli.composite.json"
}
Expand Down
4 changes: 2 additions & 2 deletions packages/vue/tsconfig.lib.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extends": "@vue/tsconfig/tsconfig.dom.json",
"include": ["package.json", "env.d.ts", "src/**/*", "src/**/*.vue", "tests/**/*"],
"exclude": ["src/bin/**/*.ts", "tests/*"],
"include": ["package.json", "env.d.ts", "src/**/*", "src/**/*.vue"],
"exclude": ["src/bin/**/*.ts"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.lib.tsbuildinfo",
Expand Down
11 changes: 11 additions & 0 deletions packages/vue/tsconfig.vitest.cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"extends": "./tsconfig.cli.json",
"include": ["package.json", "env.d.ts", "tests/bin/**/*", "src/bin/**/*"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.vitest.tsbuildinfo",

"lib": [],
"types": ["node", "jsdom"]
}
}
3 changes: 2 additions & 1 deletion packages/vue/tsconfig.vitest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "./tsconfig.lib.json",
"exclude": [],
"include": ["package.json", "env.d.ts", "tests/**/*", "src/**/*", "src/**/*.vue"],
"exclude": ["src/bin/**/*", "tests/bin/**/*"],
"compilerOptions": {
"composite": true,
"tsBuildInfoFile": "../../node_modules/.tmp/tsconfig.vitest.tsbuildinfo",
Expand Down

0 comments on commit cefd7b7

Please sign in to comment.