create-foldkit-app 0.5.15 → 0.5.16

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.
@@ -3,13 +3,14 @@ import chalk from 'chalk';
3
3
  import { Console, Effect, Match } from 'effect';
4
4
  import { createProject } from '../utils/files.js';
5
5
  import { installDependencies } from '../utils/packages.js';
6
+ const isWindows = process.platform === 'win32';
6
7
  const validateProject = (name, projectPath, packageManager) => Effect.gen(function* () {
7
8
  const fs = yield* FileSystem.FileSystem;
8
9
  const exists = yield* fs.exists(projectPath);
9
10
  if (exists) {
10
11
  return yield* Effect.fail(`Directory ${name} already exists!`);
11
12
  }
12
- const checkCommand = Command.make('which', packageManager).pipe(Command.stdout('pipe'), Command.stderr('pipe'));
13
+ const checkCommand = Command.make(isWindows ? 'where' : 'which', packageManager).pipe(Command.stdout('pipe'), Command.stderr('pipe'));
13
14
  return yield* Command.exitCode(checkCommand).pipe(Effect.filterOrFail(exitCode => exitCode === 0, () => `Package manager '${packageManager}' is not available. Please install it first.`));
14
15
  });
15
16
  const setupProject = (name, projectPath, example) => Effect.gen(function* () {
@@ -1,6 +1,7 @@
1
1
  import { Command, HttpClient, HttpClientRequest } from '@effect/platform';
2
2
  import { Array, Effect, Match, Record, Schema, pipe } from 'effect';
3
3
  const GITHUB_RAW_BASE_URL = 'https://raw.githubusercontent.com/foldkit/foldkit/main/examples';
4
+ const isWindows = process.platform === 'win32';
4
5
  const getInstallArgs = (packageManager, isDev = false) => pipe(Match.value(packageManager), Match.when('npm', () => ['install']), Match.when('yarn', () => ['add']), Match.when('pnpm', () => ['add']), Match.exhaustive, args => (isDev ? [...args, '-D'] : args));
5
6
  const StringRecord = Schema.Record({ key: Schema.String, value: Schema.String });
6
7
  const PackageJson = Schema.Struct({
@@ -22,9 +23,9 @@ const fetchExampleDeps = (example) => Effect.gen(function* () {
22
23
  export const installDependencies = (projectPath, packageManager, example) => Effect.gen(function* () {
23
24
  const exampleDeps = yield* fetchExampleDeps(example);
24
25
  const installArgs = getInstallArgs(packageManager);
25
- const installDeps = Command.make(packageManager, ...installArgs, 'foldkit', ...exampleDeps.dependencies).pipe(Command.workingDirectory(projectPath), Command.stdout('inherit'), Command.stderr('inherit'));
26
+ const installDeps = Command.make(packageManager, ...installArgs, 'foldkit', ...exampleDeps.dependencies).pipe(Command.runInShell(isWindows), Command.workingDirectory(projectPath), Command.stdout('inherit'), Command.stderr('inherit'));
26
27
  yield* Command.exitCode(installDeps);
27
28
  const installDevArgs = getInstallArgs(packageManager, true);
28
- const installDevDeps = Command.make(packageManager, ...installDevArgs, '@foldkit/vite-plugin', 'vitest', 'happy-dom', ...exampleDeps.devDependencies).pipe(Command.workingDirectory(projectPath), Command.stdout('inherit'), Command.stderr('inherit'));
29
+ const installDevDeps = Command.make(packageManager, ...installDevArgs, '@foldkit/vite-plugin', 'vitest', 'happy-dom', ...exampleDeps.devDependencies).pipe(Command.runInShell(isWindows), Command.workingDirectory(projectPath), Command.stdout('inherit'), Command.stderr('inherit'));
29
30
  yield* Command.exitCode(installDevDeps);
30
31
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-foldkit-app",
3
- "version": "0.5.15",
3
+ "version": "0.5.16",
4
4
  "description": "Create Foldkit applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",