1111 * See the License for the specific language governing permissions and
1212 * limitations under the License.
1313 */
14- const { readFileSync, writeFileSync, existsSync, mkdirSync, rmSync } = require ( 'fs' ) ;
15- const tar = require ( 'tar' ) ;
16- const path = require ( 'path' ) ;
14+ import { readFileSync , writeFileSync , existsSync , mkdirSync , rmSync } from 'fs' ;
1715
18- function ensureDirSync ( path ) {
19- ! existsSync ( path ) && mkdirSync ( path , { recursive : true } ) ;
16+ function ensureDirSync ( dirPath ) {
17+ if ( ! existsSync ( dirPath ) ) { mkdirSync ( dirPath , { recursive : true } ) ; }
2018}
21-
22- function removeSync ( path ) {
23- rmSync ( path , { recursive : true , force : true } ) ;
19+ function removeSync ( dirPath ) {
20+ rmSync ( dirPath , { recursive : true , force : true } ) ;
2421}
25-
2622const HEADER = `/*
2723 * Licensed under the Apache License, Version 2.0 (the "License");
2824 * you may not use this file except in compliance with the License.
@@ -36,32 +32,18 @@ const HEADER = `/*
3632 * See the License for the specific language governing permissions and
3733 * limitations under the License.
3834 */
39-
4035/* eslint-disable quotes */
4136// file generated by ./scripts/updateRuntimeDependencies.js
4237` ;
43-
44- /**
45- * Package the TypeScript declarations for dayjs, jsonpath and SmartLegalContract
46- * These are needed at runtime to compile user TypeScript code and template logic to JS
47- */
48- const dayjs = readFileSync ( './node_modules/dayjs/index.d.ts' ) . toString (
49- 'base64'
50- ) ;
51- const jsonpath = readFileSync (
52- './node_modules/@types/jsonpath/index.d.ts'
53- ) . toString ( 'base64' ) ;
54- const smartLegalContract = readFileSync (
55- './src/slc/SmartLegalContract.d.ts'
56- ) . toString ( 'base64' ) ;
57-
38+ const dayjs = readFileSync ( './node_modules/dayjs/index.d.ts' ) . toString ( 'base64' ) ;
39+ const jsonpath = readFileSync ( './node_modules/@types/jsonpath/index.d.ts' ) . toString ( 'base64' ) ;
40+ const smartLegalContract = readFileSync ( './src/slc/SmartLegalContract.d.ts' ) . toString ( 'base64' ) ;
5841removeSync ( './src/runtime/' ) ;
5942ensureDirSync ( './src/runtime/' ) ;
6043writeFileSync (
6144 './src/runtime/declarations.ts' ,
6245 `
6346${ HEADER }
64-
6547export const DAYJS_BASE64 = '${ dayjs } ';
6648export const JSONPATH_BASE64 = '${ jsonpath } ';
6749export const SMART_LEGAL_CONTRACT_BASE64 = '${ smartLegalContract } ';
0 commit comments