@trpc/upgrade 0.0.0-alpha.7 → 0.0.0-alpha.9
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 +5 -5
- package/package.json +1 -1
- package/src/bin/cli.ts +16 -5
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.
|
|
13
|
+
var version = "0.0.0-alpha.8";
|
|
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.tap(effect.Effect.log), 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"
|
package/package.json
CHANGED
package/src/bin/cli.ts
CHANGED
|
@@ -26,7 +26,9 @@ import {
|
|
|
26
26
|
} from 'typescript';
|
|
27
27
|
import { version } from '../../package.json';
|
|
28
28
|
|
|
29
|
-
const assertCleanGitTree = Command.string(
|
|
29
|
+
const assertCleanGitTree = Command.string(
|
|
30
|
+
Command.workingDirectory(process.cwd())(Command.make('git', 'status')),
|
|
31
|
+
).pipe(
|
|
30
32
|
Effect.filterOrFail(
|
|
31
33
|
String.includes('nothing to commit'),
|
|
32
34
|
() =>
|
|
@@ -44,7 +46,9 @@ const getPackageManager = () =>
|
|
|
44
46
|
const installPackage = (packageName: string) => {
|
|
45
47
|
const packageManager = getPackageManager();
|
|
46
48
|
return Command.streamLines(
|
|
47
|
-
Command.
|
|
49
|
+
Command.workingDirectory(process.cwd())(
|
|
50
|
+
Command.make(packageManager, 'install', packageName),
|
|
51
|
+
),
|
|
48
52
|
).pipe(Stream.mapEffect(Console.log), Stream.runDrain);
|
|
49
53
|
};
|
|
50
54
|
|
|
@@ -52,15 +56,22 @@ const uninstallPackage = (packageName: string) => {
|
|
|
52
56
|
const packageManager = getPackageManager();
|
|
53
57
|
const uninstallCmd = packageManager === 'yarn' ? 'remove' : 'uninstall';
|
|
54
58
|
return Command.streamLines(
|
|
55
|
-
Command.
|
|
59
|
+
Command.workingDirectory(process.cwd())(
|
|
60
|
+
Command.make(packageManager, uninstallCmd, packageName),
|
|
61
|
+
),
|
|
56
62
|
).pipe(Stream.mapEffect(Console.log), Stream.runDrain);
|
|
57
63
|
};
|
|
58
64
|
|
|
59
65
|
const filterIgnored = (files: readonly SourceFile[]) =>
|
|
60
66
|
Effect.gen(function* () {
|
|
61
67
|
const ignores = yield* Command.string(
|
|
62
|
-
Command.
|
|
63
|
-
|
|
68
|
+
Command.workingDirectory(process.cwd())(
|
|
69
|
+
Command.make('git', 'check-ignore', '**/*'),
|
|
70
|
+
),
|
|
71
|
+
).pipe(
|
|
72
|
+
Effect.tap(Effect.log),
|
|
73
|
+
Effect.map((_) => _.split('\n')),
|
|
74
|
+
);
|
|
64
75
|
|
|
65
76
|
yield* Effect.logDebug(
|
|
66
77
|
'All files in program:',
|