File tree Expand file tree Collapse file tree 7 files changed +38
-18
lines changed Expand file tree Collapse file tree 7 files changed +38
-18
lines changed Original file line number Diff line number Diff line change 22
22
- uses : actions/checkout@v3
23
23
- uses : pnpm/action-setup@v2.1.0
24
24
with :
25
- version : 6.32.3
25
+ version : 7.0.0
26
26
- uses : actions/setup-node@v2
27
27
with :
28
28
node-version : " 16"
Original file line number Diff line number Diff line change 19
19
ref : main
20
20
- uses : pnpm/action-setup@v2.1.0
21
21
with :
22
- version : 6.32.3
22
+ version : 7.0.0
23
23
- uses : actions/setup-node@v2
24
24
with :
25
25
node-version : " 16"
29
29
- run : pnpm i --frozen-lockfile
30
30
- run : |
31
31
pnpm build
32
+ env:
33
+ CI: true
32
34
33
35
release-github-registry :
34
36
runs-on : ubuntu-latest
44
46
ref : main
45
47
- uses : pnpm/action-setup@v2.1.0
46
48
with :
47
- version : 6.32.3
49
+ version : 7.0.0
48
50
- uses : actions/setup-node@v2
49
51
with :
50
52
node-version : " 16"
57
59
pnpm -C ./lib release:github:registry
58
60
env:
59
61
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
+ CI: true
60
63
61
64
release-npm-registry :
62
65
runs-on : ubuntu-latest
@@ -66,14 +69,16 @@ jobs:
66
69
ref : main
67
70
- uses : pnpm/action-setup@v2.1.0
68
71
with :
69
- version : 6.32.3
72
+ version : 7.0.0
70
73
- uses : actions/setup-node@v2
71
74
with :
72
75
node-version : " 16.x"
73
76
registry-url : " https://registry.npmjs.org"
74
77
cache : " pnpm"
75
78
- run : pnpm install
76
79
- run : pnpm build
80
+ env :
81
+ CI : true
77
82
- run : pnpm -C ./lib release:npm:registry
78
83
env :
79
84
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 20
20
ref : main
21
21
- uses : pnpm/action-setup@v2.1.0
22
22
with :
23
- version : 6.32.3
23
+ version : 7.0.0
24
24
- uses : actions/setup-node@v2
25
25
with :
26
26
node-version : " 16.x"
Original file line number Diff line number Diff line change 1
1
import "./clean" ;
2
2
3
+ import pkg from "../package.json" ;
4
+ import * as fs from "fs" ;
5
+ import { EOL } from "os" ;
3
6
import { cherryPick } from "./tools/cherry-pick" ;
4
7
import { copyPackageSet } from "./tools/copyPackageSet" ;
5
8
import { generateExportsField } from "./tools/dualPackageSupport" ;
6
9
import { shell } from "./tools/shell" ;
7
10
11
+ const generateVersionTsFile = ( ) => {
12
+ const codes : string [ ] = [ `export const Name = "${ pkg . name } ";` , `export const Version = "${ pkg . version } ";` ] ;
13
+ const tscCode = codes . join ( EOL ) ;
14
+ if ( process . env . CI ) {
15
+ console . log ( "`Update src/meta.ts file." ) ;
16
+ fs . writeFileSync ( "src/meta.ts" , tscCode , "utf-8" ) ;
17
+ }
18
+ } ;
19
+
8
20
const main = async ( ) => {
21
+ generateVersionTsFile ( ) ;
22
+
9
23
await Promise . all ( [
10
24
shell ( "pnpm tsc -p tsconfig.esm.json -d --emitDeclarationOnly --outDir ./lib/\\$types" ) ,
11
25
shell ( "pnpm tsc -p tsconfig.cjs.json" ) ,
Original file line number Diff line number Diff line change @@ -2,13 +2,12 @@ import { EOL } from "os";
2
2
3
3
import type { OpenApi } from "../../types" ;
4
4
5
- // eslint-disable-next-line @typescript-eslint/no-var-requires
6
- const pkg = require ( "../../../package.json" ) ;
5
+ import { Version , Name } from "../../meta" ;
7
6
8
7
export const generateLeading = ( schema : OpenApi . Document ) : string => {
9
8
const messages : string [ ] = [ ] ;
10
9
messages . push ( "" ) ;
11
- messages . push ( `Generated by ${ pkg . name } v${ pkg . version } ` ) ;
10
+ messages . push ( `Generated by ${ Name } v${ Version } ` ) ;
12
11
messages . push ( "" ) ;
13
12
messages . push ( `OpenApi : ${ schema . openapi } ` ) ;
14
13
messages . push ( "" ) ;
Original file line number Diff line number Diff line change
1
+ export const Name = "dummy-name" ;
2
+ export const Version = "dummy" ;
You can’t perform that action at this time.
0 commit comments