From 67b4d9b438b027cde10f655432b73e571cddecfd Mon Sep 17 00:00:00 2001 From: Holden Hoover Date: Mon, 16 Mar 2026 21:17:15 -0400 Subject: [PATCH] Create Tatin Package Build System --- .gitignore | 1 + BuildPackage.apls | 55 +++++++++++++++++++++++++++++++++++++++++++++++ EWC/Init.aplf | 4 ++++ apl-package.json | 24 +++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100755 BuildPackage.apls create mode 100644 apl-package.json diff --git a/.gitignore b/.gitignore index df3eb238..bde7974f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ EWC/server/* /demo/images/ribbonimages/* .DS_Store .linkconfig +Dist/ diff --git a/BuildPackage.apls b/BuildPackage.apls new file mode 100755 index 00000000..220a6a44 --- /dev/null +++ b/BuildPackage.apls @@ -0,0 +1,55 @@ +#!/usr/bin/dyalogscript +⎕PW←500 +⎕SE.(⍎⊃2⎕FIX'/StartupSession.aplf',⍨2⎕NQ#'GetEnvironment' 'DYALOG') +⎕ML ⎕IO←1 0 +⎕←⎕SE.UCMD 'ureset' +⎕←⎕SE.UCMD 'Tatin.Version' + +⍝ Save current directory +cwd←⊃1⎕NPARTS '' + +⍝ Create a temp directory +tmp←739⌶0 +builddir←tmp,'/ewc-build-',(⍕⎕AI[2]) +3 ⎕MKDIR builddir + +⍝ Clone ewc-client into temp directory +⎕←⎕SHELL 'git clone https://github.com/Dyalog/ewc-client.git "',builddir,'/ewc-client-repo"' + +⍝ Checkout devt branch +⎕←⎕SHELL 'cd "',builddir,'/ewc-client-repo" && git checkout devt' + +⍝ Build ewc-client +⎕←⎕SHELL 'cd "',builddir,'/ewc-client-repo" && npm install && npm run build' + +⍝ Generate third-party license notices for npm dependencies +⎕←⎕SHELL 'cd "',builddir,'/ewc-client-repo" && npx license-checker --production --out THIRD-PARTY-LICENSES.txt' + +⍝ Copy the dist folder into ewc-client/dist (matching the client lookup path in Init) +3 ⎕MKDIR builddir,'/ewc-client' +⎕←⎕SHELL 'cp -r "',builddir,'/ewc-client-repo/dist" "',builddir,'/ewc-client/dist"' + +⍝ Include the third-party license notices in the ewc-client folder +⎕←⎕SHELL 'cp "',builddir,'/ewc-client-repo/THIRD-PARTY-LICENSES.txt" "',builddir,'/ewc-client/THIRD-PARTY-LICENSES.txt"' + +⍝ Remove the cloned repo, no longer needed +3 ⎕NDELETE builddir,'/ewc-client-repo' + +⍝ Copy EWC source folder to temp dir +⎕←⎕SHELL 'cp -r "',cwd,'EWC" "',builddir,'/EWC"' + +⍝ Copy apl-package.json and LICENSE to temp dir +⎕←⎕SHELL 'cp "',cwd,'apl-package.json" "',builddir,'/apl-package.json"' +⎕←⎕SHELL 'cp "',cwd,'LICENSE" "',builddir,'/LICENSE"' + +⍝ Build the Tatin package +parms←⎕SE.Tatin.CreateBuildParms builddir +parms.targetPath←cwd,'Dist' +parms.dependencyFolder←'' +3 ⎕MKDIR parms.targetPath +⎕←⎕SE.Tatin.BuildPackage parms + +⍝ Clean up temp directory +3 ⎕NDELETE builddir + +⎕←'Done. Package built to: ',cwd,'Dist' diff --git a/EWC/Init.aplf b/EWC/Init.aplf index 64c35e05..83d3584f 100644 --- a/EWC/Init.aplf +++ b/EWC/Init.aplf @@ -1,6 +1,7 @@ {prefix}Init args;mode;z;i;t;fn;folder;⎕TRAP;DPR_FORM;_EWC;dc ⎕IO←⎕ML←1 :If '#.EWC'≢⍕⎕THIS + :AndIf ~{9≠#.⎕NC '#.EWC':0 ⋄ (⍕⎕THIS)≡⍕#.EWC}⍬ 'EWC must be loaded as #.EWC' ⎕SIGNAL 11 :EndIf @@ -11,6 +12,7 @@ :If 0=≢folder←⊃⎕NPARTS ¯1↓⊃⎕NPARTS 4⊃5179⌶⊃⎕SI :AndIf 0=≢folder←FOLDER + :AndIf 0=≢folder←{0≠⎕NC 'TatinVars': TatinVars.HOME ⋄ ⍵}'' 'Please set EWC.FOLDER to identify the EWC source folder' ⎕SIGNAL 11 :EndIf @@ -67,6 +69,8 @@ JSClientFolder←folder :ElseIf ⎕NEXISTS folder←FOLDER,'client/dist/' JSClientFolder←folder + :ElseIf ⎕NEXISTS folder←'ewc-client/dist/',⍨⊃⎕NPARTS FOLDER + JSClientFolder←folder :Else 'Unable to locate EWC Client'⎕SIGNAL 11 :EndIf diff --git a/apl-package.json b/apl-package.json new file mode 100644 index 00000000..68973118 --- /dev/null +++ b/apl-package.json @@ -0,0 +1,24 @@ +{ + api: "", + assets: "ewc-client", + checkLICENSEfile: 1, + description: "A JavaScript-based emulation of Dyalog APL ⎕WC GUI.", + documentation: "", + files: "", + group: "dyalog", + io: 1, + license: "MIT", + lx: "", + maintainer: "support@dyalog.com", + minimumAplVersion: "18.2", + ml: 1, + name: "EWC", + os_lin: 1, + os_mac: 1, + os_win: 1, + project_url: "https://github.com/dyalog/ewc", + source: "EWC", + tags: "gui,javascript,linux,windows,mac,ewc,crossplatform", + userCommandScript: "", + version: "0.1.0+0", +}