Skip to content

Commit

Permalink
build: transpile: now can transpile one exchange
Browse files Browse the repository at this point in the history
  • Loading branch information
mkutny committed Feb 1, 2018
1 parent f1990f7 commit 12b40bb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions transpile.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ const errors = require ('./js/base/errors.js')

// ---------------------------------------------------------------------------

const [ /* node */, /* script */, filename ] = process.argv

// ---------------------------------------------------------------------------

function replaceInFile (filename, regex, replacement) {
let contents = fs.readFileSync (filename, 'utf8')
const parts = contents.split (regex)
Expand Down Expand Up @@ -591,10 +595,10 @@ const pythonRegexes = [

//-----------------------------------------------------------------------------

function transpileDerivedExchangeFiles (folder) {
function transpileDerivedExchangeFiles (folder, pattern = '.js') {

const classNames = fs.readdirSync (folder)
.filter (file => file.includes ('.js'))
.filter (file => file.includes (pattern))
.map (file => transpileDerivedExchangeFile (folder, file))

let classes = {}
Expand Down Expand Up @@ -700,7 +704,7 @@ const pythonRegexes = [
createFolderRecursively (python3Folder)
createFolderRecursively (phpFolder)

const classes = transpileDerivedExchangeFiles ('./js/')
const classes = transpileDerivedExchangeFiles ('./js/', filename)

// HINT: if we're going to support specific class definitions this process won't work anymore as it will override the definitions.
exportTypeScriptDeclarations (classes)
Expand Down

0 comments on commit 12b40bb

Please sign in to comment.