1
1
#!/usr/bin/env node
2
2
3
- import { CliConfig } from '@effect/cli' ;
3
+ import { CliConfig , Span } from '@effect/cli' ;
4
4
import { make , run } from '@effect/cli/Command' ;
5
5
import { layer as NodeFileSystemLayer } from '@effect/platform-node-shared/NodeFileSystem' ;
6
6
import { layer as NodePathLayer } from '@effect/platform-node-shared/NodePath' ;
7
7
import { runMain } from '@effect/platform-node-shared/NodeRuntime' ;
8
8
import { layer as NodeTerminalLayer } from '@effect/platform-node-shared/NodeTerminal' ;
9
9
import { provide } from 'effect/Effect' ;
10
10
import { pipe } from 'effect/Function' ;
11
+ import pkg from './package.json' with { type : 'json' } ;
11
12
import {
12
13
destinationPathCLIOptionBackedByEnv ,
13
14
downloadEntityFromRepo ,
@@ -18,14 +19,8 @@ import {
18
19
repoOwnerCLIOptionBackedByEnv ,
19
20
} from './src/index.ts' ;
20
21
21
- // Those values updated automatically. If you edit names of constants or
22
- // move them to a different file, update ./scripts/build.sh
23
- const PACKAGE_VERSION = '0.1.22' ;
24
- // TODO: read from ./package.json
25
- const PACKAGE_NAME = 'fetch-github-folder' ;
26
-
27
22
const appCommand = make (
28
- PACKAGE_NAME ,
23
+ pkg . name ,
29
24
{
30
25
repo : {
31
26
owner : repoOwnerCLIOptionBackedByEnv ,
@@ -40,9 +35,9 @@ const appCommand = make(
40
35
) ;
41
36
42
37
const cli = run ( appCommand , {
43
- // those values will be filled automatically from package.json
44
- name : PACKAGE_NAME ,
45
- version : PACKAGE_VERSION ,
38
+ name : pkg . name ,
39
+ version : pkg . version ,
40
+ summary : Span . text ( pkg . description ) ,
46
41
} ) ;
47
42
48
43
pipe (
0 commit comments