create-foldkit-app 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  import chalk from 'chalk';
2
- import { Console, Effect, FileSystem, Match, Option, Path } from 'effect';
2
+ import { Console, Effect, FileSystem, Option, Path } from 'effect';
3
3
  import { Prompt } from 'effect/unstable/cli';
4
4
  import { spawnSync } from 'node:child_process';
5
5
  import { examples } from '../examples.js';
6
6
  import { createProject } from '../utils/files.js';
7
- import { installDependencies } from '../utils/packages.js';
7
+ import { devCommand, installDependencies, } from '../utils/packages.js';
8
8
  import { validateProjectName } from '../validateName.js';
9
9
  const isWindows = process.platform === 'win32';
10
10
  const promptForName = Prompt.text({
@@ -73,12 +73,11 @@ const installProjectDependencies = (projectPath, packageManager, example) => Eff
73
73
  yield* Console.log(chalk.green('✅ Dependencies installed'));
74
74
  yield* Console.log('');
75
75
  });
76
- const runDevServerCommand = (packageManager) => Match.value(packageManager).pipe(Match.when('pnpm', () => 'pnpm dev'), Match.when('npm', () => 'npm run dev'), Match.when('yarn', () => 'yarn dev'), Match.when('bun', () => 'bun dev'), Match.exhaustive);
77
76
  const displaySuccessMessage = (name, packageManager) => Effect.gen(function* () {
78
77
  yield* Console.log(chalk.bold('All systems nominal.'));
79
78
  yield* Console.log('');
80
79
  yield* Console.log(` > ${chalk.cyan('cd')} ${name}`);
81
- yield* Console.log(` > ${chalk.cyan(runDevServerCommand(packageManager))}`);
80
+ yield* Console.log(` > ${chalk.cyan(devCommand(packageManager))}`);
82
81
  yield* Console.log('');
83
82
  yield* Console.log(chalk.bold('AI-Assisted Development'));
84
83
  yield* Console.log('');
@@ -1,6 +1,7 @@
1
1
  import { Array, Effect, FileSystem, Match, Option, Path, Record, Ref, Schema, String, pipe, } from 'effect';
2
2
  import { HttpClient, HttpClientRequest, } from 'effect/unstable/http';
3
3
  import { fileURLToPath } from 'node:url';
4
+ import { devCommand, installCommand } from './packages.js';
4
5
  const GITHUB_API_BASE_URL = 'https://api.github.com/repos/foldkit/foldkit/contents/examples';
5
6
  const getTemplateRoot = Effect.gen(function* () {
6
7
  const path = yield* Path.Path;
@@ -73,17 +74,20 @@ const createPackageManagerFiles = (projectPath, packageManager) => Effect.gen(fu
73
74
  });
74
75
  export const createProject = (name, projectPath, example, packageManager) => Effect.gen(function* () {
75
76
  yield* createBaseFiles(projectPath);
76
- yield* modifyBaseFiles(projectPath, name);
77
+ yield* modifyBaseFiles(projectPath, name, packageManager);
77
78
  yield* createPackageManagerFiles(projectPath, packageManager);
78
79
  yield* createExampleFiles(projectPath, example);
79
80
  });
80
- const modifyBaseFiles = (projectPath, name) => Effect.gen(function* () {
81
+ export const applyPackageManager = (readme, packageManager) => pipe(readme, String.replace('{{installCommand}}', installCommand(packageManager)), String.replace('{{devCommand}}', devCommand(packageManager)));
82
+ const modifyBaseFiles = (projectPath, name, packageManager) => Effect.gen(function* () {
81
83
  const fs = yield* FileSystem.FileSystem;
82
84
  const path = yield* Path.Path;
83
85
  const packageJsonPath = path.join(projectPath, 'package.json');
84
- const content = yield* fs.readFileString(packageJsonPath);
85
- const updatedContent = String.replace('my-foldkit-app', name)(content);
86
- yield* fs.writeFileString(packageJsonPath, updatedContent);
86
+ const packageJson = yield* fs.readFileString(packageJsonPath);
87
+ yield* fs.writeFileString(packageJsonPath, String.replace('{{name}}', name)(packageJson));
88
+ const readmePath = path.join(projectPath, 'README.md');
89
+ const readme = yield* fs.readFileString(readmePath);
90
+ yield* fs.writeFileString(readmePath, applyPackageManager(readme, packageManager));
87
91
  });
88
92
  const GitHubFileEntry = Schema.Struct({
89
93
  name: Schema.String,
@@ -1,6 +1,14 @@
1
1
  import { Array, Effect, FileSystem, Match, Order, Path, Record, Result, Schema, pipe, } from 'effect';
2
2
  import { HttpClient, HttpClientRequest } from 'effect/unstable/http';
3
3
  import { spawn } from 'node:child_process';
4
+ export const installCommand = (packageManager) => `${packageManager} install`;
5
+ const DEV_COMMANDS = {
6
+ pnpm: 'pnpm dev',
7
+ npm: 'npm run dev',
8
+ yarn: 'yarn dev',
9
+ bun: 'bun dev',
10
+ };
11
+ export const devCommand = (packageManager) => DEV_COMMANDS[packageManager];
4
12
  const GITHUB_RAW_BASE_URL = 'https://raw.githubusercontent.com/foldkit/foldkit/main/examples';
5
13
  const NPM_REGISTRY_BASE_URL = 'https://registry.npmjs.org';
6
14
  const FOLDKIT_SCOPE_PREFIX = '@foldkit/';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-foldkit-app",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "Create Foldkit applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -5,8 +5,8 @@ A Foldkit application built with Effect.
5
5
  ## Getting Started
6
6
 
7
7
  ```bash
8
- pnpm install
9
- pnpm dev
8
+ {{installCommand}}
9
+ {{devCommand}}
10
10
  ```
11
11
 
12
12
  ## Learn More
@@ -23,3 +23,6 @@ Thumbs.db
23
23
 
24
24
  # TypeScript
25
25
  *.tsbuildinfo
26
+
27
+ # Claude Code worktrees
28
+ .claude/worktrees/
@@ -1,5 +1,5 @@
1
1
  {
2
- "name": "my-foldkit-app",
2
+ "name": "{{name}}",
3
3
  "version": "0.1.0",
4
4
  "type": "module",
5
5
  "scripts": {
@@ -9,6 +9,6 @@
9
9
  "typecheck": "tsc --noEmit",
10
10
  "format": "prettier -w .",
11
11
  "test": "vitest run",
12
- "lint": "oxlint"
12
+ "lint": "oxlint src"
13
13
  }
14
14
  }
@@ -2,6 +2,7 @@ import { defineConfig } from 'vitest/config'
2
2
 
3
3
  export default defineConfig({
4
4
  test: {
5
+ include: ['src/**/*.{test,spec}.ts'],
5
6
  environment: 'happy-dom',
6
7
  setupFiles: ['./src/vitest-setup.ts'],
7
8
  server: {