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 2222 - uses : actions/checkout@v3
2323 - uses : pnpm/action-setup@v2.1.0
2424 with :
25- version : 6.32.3
25+ version : 7.0.0
2626 - uses : actions/setup-node@v2
2727 with :
2828 node-version : " 16"
Original file line number Diff line number Diff line change 1919 ref : main
2020 - uses : pnpm/action-setup@v2.1.0
2121 with :
22- version : 6.32.3
22+ version : 7.0.0
2323 - uses : actions/setup-node@v2
2424 with :
2525 node-version : " 16"
2929 - run : pnpm i --frozen-lockfile
3030 - run : |
3131 pnpm build
32+ env:
33+ CI: true
3234
3335 release-github-registry :
3436 runs-on : ubuntu-latest
4446 ref : main
4547 - uses : pnpm/action-setup@v2.1.0
4648 with :
47- version : 6.32.3
49+ version : 7.0.0
4850 - uses : actions/setup-node@v2
4951 with :
5052 node-version : " 16"
5759 pnpm -C ./lib release:github:registry
5860 env:
5961 NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+ CI: true
6063
6164 release-npm-registry :
6265 runs-on : ubuntu-latest
@@ -66,14 +69,16 @@ jobs:
6669 ref : main
6770 - uses : pnpm/action-setup@v2.1.0
6871 with :
69- version : 6.32.3
72+ version : 7.0.0
7073 - uses : actions/setup-node@v2
7174 with :
7275 node-version : " 16.x"
7376 registry-url : " https://registry.npmjs.org"
7477 cache : " pnpm"
7578 - run : pnpm install
7679 - run : pnpm build
80+ env :
81+ CI : true
7782 - run : pnpm -C ./lib release:npm:registry
7883 env :
7984 NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change 2020 ref : main
2121 - uses : pnpm/action-setup@v2.1.0
2222 with :
23- version : 6.32.3
23+ version : 7.0.0
2424 - uses : actions/setup-node@v2
2525 with :
2626 node-version : " 16.x"
Original file line number Diff line number Diff line change 11import "./clean" ;
22
3+ import pkg from "../package.json" ;
4+ import * as fs from "fs" ;
5+ import { EOL } from "os" ;
36import { cherryPick } from "./tools/cherry-pick" ;
47import { copyPackageSet } from "./tools/copyPackageSet" ;
58import { generateExportsField } from "./tools/dualPackageSupport" ;
69import { shell } from "./tools/shell" ;
710
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+
820const main = async ( ) => {
21+ generateVersionTsFile ( ) ;
22+
923 await Promise . all ( [
1024 shell ( "pnpm tsc -p tsconfig.esm.json -d --emitDeclarationOnly --outDir ./lib/\\$types" ) ,
1125 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";
22
33import type { OpenApi } from "../../types" ;
44
5- // eslint-disable-next-line @typescript-eslint/no-var-requires
6- const pkg = require ( "../../../package.json" ) ;
5+ import { Version , Name } from "../../meta" ;
76
87export const generateLeading = ( schema : OpenApi . Document ) : string => {
98 const messages : string [ ] = [ ] ;
109 messages . push ( "" ) ;
11- messages . push ( `Generated by ${ pkg . name } v${ pkg . version } ` ) ;
10+ messages . push ( `Generated by ${ Name } v${ Version } ` ) ;
1211 messages . push ( "" ) ;
1312 messages . push ( `OpenApi : ${ schema . openapi } ` ) ;
1413 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