Skip to content

Commit

Permalink
feat: polish, update versions, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlwn123 committed Dec 16, 2024
1 parent 2f6c018 commit f153c39
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 37 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"test:setup": "bash testing/setup_test_shell.sh",
"test:coverage": "vitest run --coverage",
"test:lib": "vitest",
"test:create": "vitest create-fedimint",
"test:create": "vitest --watch=false create-fedimint",
"test:ui": "vitest --browser.headless=false --ui",
"format": "prettier --write .",
"watch": "pnpm run --r --parallel --filter \"./packages/**\" watch"
Expand Down
8 changes: 4 additions & 4 deletions packages/create-fedimint-app/__tests__/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ test('accepts command line override for --overwrite', () => {
expect(stdout).not.toContain(`Current directory is not empty.`)
})

test('return help usage how to use create-vite', () => {
test('return help usage how to use create-fedimint-app', () => {
const { stdout } = run(['--help'], { cwd: __dirname })
const message = 'Usage: create-vite [OPTION]... [DIRECTORY]'
const message = 'Usage: create-fedimint-app [OPTION]... [DIRECTORY]'
expect(stdout).toContain(message)
})

test('return help usage how to use create-vite with -h alias', () => {
test('return help usage how to use create-fedimint-app with -h alias', () => {
const { stdout } = run(['--h'], { cwd: __dirname })
const message = 'Usage: create-vite [OPTION]... [DIRECTORY]'
const message = 'Usage: create-fedimint-app [OPTION]... [DIRECTORY]'
expect(stdout).toContain(message)
})
33 changes: 17 additions & 16 deletions packages/create-fedimint-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import colors from 'picocolors'

const {
blue,
blueBright,
// blueBright,
cyan,
green,
// green,
// greenBright,
magenta,
// magenta,
red,
redBright,
// redBright,
reset,
yellow,
// yellow,
} = colors

// Avoids autoconversion to number of the project name by defining that the args
Expand All @@ -33,23 +33,24 @@ const cwd = process.cwd()

// prettier-ignore
const helpMessage = `\
Usage: create-vite [OPTION]... [DIRECTORY]
Usage: create-fedimint-app [OPTION]... [DIRECTORY]
Create a new Vite project in JavaScript or TypeScript.
Create a new Fedimint project in JavaScript or TypeScript.
With no arguments, start the CLI in interactive mode.
Options:
-t, --template NAME use a specific template
Available templates:
${yellow ('vanilla-ts vanilla' )}
${green ('vue-ts vue' )}
${cyan ('vite-react-ts react' )}
${magenta ('preact-ts preact' )}
${redBright ('lit-ts lit' )}
${red ('svelte-ts svelte' )}
${blue ('solid-ts solid' )}
${blueBright('qwik-ts qwik' )}`
${cyan ('vite-react-ts react' )}`
// ${yellow ('vanilla-ts vanilla' )}
// ${green ('vue-ts vue' )}
// ${cyan ('vite-react-ts react' )}
// ${magenta ('preact-ts preact' )}
// ${redBright ('lit-ts lit' )}
// ${red ('svelte-ts svelte' )}
// ${blue ('solid-ts solid' )}
// ${blueBright('qwik-ts qwik' )}`

type ColorFunc = (str: string | number) => string
type Framework = {
Expand Down Expand Up @@ -287,7 +288,7 @@ const renameFiles: Record<string, string | undefined> = {
_gitignore: '.gitignore',
}

const defaultTargetDir = 'vite-project'
const defaultTargetDir = 'fedimint-project'

async function init() {
const argTargetDir = formatTargetDir(argv._[0])
Expand Down
10 changes: 5 additions & 5 deletions packages/create-fedimint-app/template-vite-react-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "fedimint-vite-react-typescript-starter",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -10,9 +11,9 @@
"clean:deep": "pnpm run clean && rm -rf node_modules"
},
"dependencies": {
"@fedimint/core-web": "canary",
"react": "19.0.1",
"react-dom": "19.0.2"
"@fedimint/core-web": "latest",
"react": "19.0.0",
"react-dom": "19.0.0"
},
"devDependencies": {
"@types/react": "19.0.0",
Expand All @@ -22,6 +23,5 @@
"typescript": "^5.6.2",
"vite": "^5.4.8",
"vite-plugin-wasm": "^3.3.0"
},
"packageManager": "[email protected]"
}
}
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

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

1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { defineConfig } from 'vitest/config'

export default defineConfig({
test: {
watch: false,
coverage: {
provider: 'v8',
include: ['packages/**/*.ts'],
Expand Down
13 changes: 4 additions & 9 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,11 @@ export default defineWorkspace([
{
test: {
name: 'cli',
include: ['packages/create-fedimint-app/**/*.test.ts'],
isolate: false,
environment: 'happy-dom',
include: ['packages/create-fedimint-app/__tests__/*.test.ts'],
exclude: ['packages/create-fedimint-app/__tests__/subfolder'],
isolate: true,
testTimeout: 20000,
},
optimizeDeps: {
exclude: ['execa'],
},
esbuild: {
target: 'node18',
},
publicDir: false,
},
])

0 comments on commit f153c39

Please sign in to comment.