@trpc/upgrade 0.0.0-alpha.6 → 0.0.0-alpha.8

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.
package/dist/cli.cjs CHANGED
@@ -10,21 +10,21 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
10
 
11
11
  var path__default = /*#__PURE__*/_interopDefault(path);
12
12
 
13
- var version = "0.0.0-alpha.6";
13
+ var version = "0.0.0-alpha.7";
14
14
 
15
- const assertCleanGitTree = platform.Command.string(platform.Command.make('git', 'status')).pipe(effect.Effect.filterOrFail(effect.String.includes('nothing to commit'), ()=>'Git tree is not clean, please commit your changes and try again, or run with `--force`'));
15
+ const assertCleanGitTree = platform.Command.string(platform.Command.workingDirectory(process.cwd())(platform.Command.make('git', 'status'))).pipe(effect.Effect.filterOrFail(effect.String.includes('nothing to commit'), ()=>'Git tree is not clean, please commit your changes and try again, or run with `--force`'));
16
16
  const getPackageManager = ()=>effect.Match.value(process.env.npm_config_user_agent ?? 'npm').pipe(effect.Match.when(effect.String.startsWith('pnpm'), ()=>'pnpm'), effect.Match.when(effect.String.startsWith('yarn'), ()=>'yarn'), effect.Match.when(effect.String.startsWith('bun'), ()=>'bun'), effect.Match.orElse(()=>'npm'));
17
17
  const installPackage = (packageName)=>{
18
18
  const packageManager = getPackageManager();
19
- return platform.Command.streamLines(platform.Command.make(packageManager, 'install', packageName)).pipe(effect.Stream.mapEffect(effect.Console.log), effect.Stream.runDrain);
19
+ return platform.Command.streamLines(platform.Command.workingDirectory(process.cwd())(platform.Command.make(packageManager, 'install', packageName))).pipe(effect.Stream.mapEffect(effect.Console.log), effect.Stream.runDrain);
20
20
  };
21
21
  const uninstallPackage = (packageName)=>{
22
22
  const packageManager = getPackageManager();
23
23
  const uninstallCmd = packageManager === 'yarn' ? 'remove' : 'uninstall';
24
- return platform.Command.streamLines(platform.Command.make(packageManager, uninstallCmd, packageName)).pipe(effect.Stream.mapEffect(effect.Console.log), effect.Stream.runDrain);
24
+ return platform.Command.streamLines(platform.Command.workingDirectory(process.cwd())(platform.Command.make(packageManager, uninstallCmd, packageName))).pipe(effect.Stream.mapEffect(effect.Console.log), effect.Stream.runDrain);
25
25
  };
26
26
  const filterIgnored = (files)=>effect.Effect.gen(function*() {
27
- const ignores = yield* platform.Command.string(platform.Command.make('git', 'check-ignore', '**/*')).pipe(effect.Effect.map((_)=>_.split('\n')));
27
+ const ignores = yield* platform.Command.string(platform.Command.workingDirectory(process.cwd())(platform.Command.make('git', 'check-ignore', '**/*'))).pipe(effect.Effect.map((_)=>_.split('\n')));
28
28
  yield* effect.Effect.logDebug('All files in program:', files.map((_)=>_.fileName));
29
29
  yield* effect.Effect.logDebug('Ignored files:', ignores);
30
30
  // Ignore "common files"
@@ -92,7 +92,7 @@ const rootComamnd = cli$1.Command.make('upgrade', {
92
92
  yield* effect.Effect.log('Uninstalling @trpc/react-query');
93
93
  yield* uninstallPackage('@trpc/react-query');
94
94
  }
95
- }));
95
+ }).pipe(effect.Logger.withMinimumLogLevel(args.verbose ? effect.LogLevel.Debug : effect.LogLevel.Info)));
96
96
  const cli = cli$1.Command.run(rootComamnd, {
97
97
  name: 'tRPC Upgrade CLI',
98
98
  version: `v${version}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trpc/upgrade",
3
- "version": "0.0.0-alpha.6",
3
+ "version": "0.0.0-alpha.8",
4
4
  "description": "Upgrade scripts for tRPC",
5
5
  "author": "juliusmarminge",
6
6
  "license": "MIT",
package/src/bin/cli.ts CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  Array,
8
8
  Console,
9
9
  Effect,
10
+ Logger,
11
+ LogLevel,
10
12
  Match,
11
13
  Order,
12
14
  pipe,
@@ -24,7 +26,9 @@ import {
24
26
  } from 'typescript';
25
27
  import { version } from '../../package.json';
26
28
 
27
- const assertCleanGitTree = Command.string(Command.make('git', 'status')).pipe(
29
+ const assertCleanGitTree = Command.string(
30
+ Command.workingDirectory(process.cwd())(Command.make('git', 'status')),
31
+ ).pipe(
28
32
  Effect.filterOrFail(
29
33
  String.includes('nothing to commit'),
30
34
  () =>
@@ -42,7 +46,9 @@ const getPackageManager = () =>
42
46
  const installPackage = (packageName: string) => {
43
47
  const packageManager = getPackageManager();
44
48
  return Command.streamLines(
45
- Command.make(packageManager, 'install', packageName),
49
+ Command.workingDirectory(process.cwd())(
50
+ Command.make(packageManager, 'install', packageName),
51
+ ),
46
52
  ).pipe(Stream.mapEffect(Console.log), Stream.runDrain);
47
53
  };
48
54
 
@@ -50,14 +56,18 @@ const uninstallPackage = (packageName: string) => {
50
56
  const packageManager = getPackageManager();
51
57
  const uninstallCmd = packageManager === 'yarn' ? 'remove' : 'uninstall';
52
58
  return Command.streamLines(
53
- Command.make(packageManager, uninstallCmd, packageName),
59
+ Command.workingDirectory(process.cwd())(
60
+ Command.make(packageManager, uninstallCmd, packageName),
61
+ ),
54
62
  ).pipe(Stream.mapEffect(Console.log), Stream.runDrain);
55
63
  };
56
64
 
57
65
  const filterIgnored = (files: readonly SourceFile[]) =>
58
66
  Effect.gen(function* () {
59
67
  const ignores = yield* Command.string(
60
- Command.make('git', 'check-ignore', '**/*'),
68
+ Command.workingDirectory(process.cwd())(
69
+ Command.make('git', 'check-ignore', '**/*'),
70
+ ),
61
71
  ).pipe(Effect.map((_) => _.split('\n')));
62
72
 
63
73
  yield* Effect.logDebug(
@@ -208,7 +218,9 @@ const rootComamnd = CLICommand.make(
208
218
  yield* Effect.log('Uninstalling @trpc/react-query');
209
219
  yield* uninstallPackage('@trpc/react-query');
210
220
  }
211
- }),
221
+ }).pipe(
222
+ Logger.withMinimumLogLevel(args.verbose ? LogLevel.Debug : LogLevel.Info),
223
+ ),
212
224
  );
213
225
 
214
226
  const cli = CLICommand.run(rootComamnd, {