Skip to main content

Upgrade Script

If you are preparing an upgrade to ewam 7 it is can first package your current ewam version with artifacts. Here is an example of how to apply it :

  • put .bat files from './bin' in @ewam/kernel/bin
  • put all files from ./Dll in @ewam/kernel/bin
  • put all files from ./BMP in @ewam/kernel/bmp
  • ...

The list of rules to apply is defined here:

transco.json
{
"executables": {
"from": "Bin",
"to": "@ewam/kernel/bin",
"exclude": ".bat"
},
"dlls": {
"from": "Dll",
"to": "@ewam/kernel/bin"
},
"bmp": {
"from": "Bmp",
"to": "@ewam/kernel/bmp"
},
"CppDll": {
"from": "CppDll",
"to": "@ewam/library/bin",
"exclude": ".pdb"
},
"Lib": {
"from": "Lib",
"to": "@ewam/kernel/Lib"
},
"map": {
"from": ".",
"to": "@ewam/kernel",
"include": ".map"
},
"tgvs": {
"from": "TGV",
"to": "@ewam/tgv-standalone",
"include": ".tgv"
}
}

You can the script below to read this json and make the move into artifacts:

  • Create a folder name eWamUpgrade

  • Copy eWAM6.1.5 content inside (all folders bin, dll, cppdll, etc...)

  • Create a subfolder UpgradeScript

  • create files below under eWamUpgrade\UpgradeScript with

    • index.js from below script
    • transco.json from above
    • package.json as below : { "name": "ewam-demo", "version": "1.0.0", "dependencies": { "@ewam/script.cli": "^1.0.1" }, "devDependencies": {}, "scripts": {} }
  • With Visual Studio code : go under eWamUpgrade\UpgradeScript

  • launch npm install

  • launch node index.js have a look on TrainingScript\UpgradeScript\@ewam : ensure the content fit to the new tree of eWAM

index.js
const { directory, file, command } = require("@ewam/script.cli")
const transco = require("./transco.json")
const version = "6.15.32-beta1"
const Path = require('path')

for (const key in transco) {
const rule = transco[key];
directory.copy(Path.resolve("../" + rule.from), rule.to, (name => {
const lname = name.toLowerCase()
return (!rule.include || lname.indexOf(rule.include) > 0) &&
(!rule.exclude || lname.indexOf(rule.exclude) == -1)
}))
}

// Add the different package.json
file.write.json('./@ewam/kernel/package.json', { version, name: "@ewam/kernel" })
file.write.json('./@ewam/library/package.json', { version, name: "@ewam/library" })
file.write.json('./@ewam/tgv-standalone/package.json', { version, name: "@ewam/tgv-standalone" })

// Publish : uncomment to publish in a repository
// command.exec("npm publish --strict-ssl false --access restricted --tag ewam6.1.5", { cwd: Path.resolve("./@ewam/kernel") })
// command.exec("npm publish --strict-ssl false --access restricted --tag ewam6.1.5", { cwd: Path.resolve("./@ewam/library") })
// command.exec("npm publish --strict-ssl false --access restricted --tag ewam6.1.5", { cwd: Path.resolve("./@ewam/tgv-standalone") })