-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from 4zzz/master
Modularization
- Loading branch information
Showing
30 changed files
with
11,441 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": ["@babel/preset-react"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const fs = require('fs/promises'); | ||
const {exec} = require('child_process'); | ||
|
||
function cmd(command) { | ||
return new Promise((resolve, reject) => { | ||
console.log(command); | ||
const proc = exec(command); | ||
proc.stdout.on('data', function (data) {process.stdout.write(data)}); | ||
proc.stderr.on('data', function (data) {process.stderr.write(data)}); | ||
proc.on('exit', function (code) {code === 0 ? resolve(0) : reject(code)}); | ||
}); | ||
} | ||
|
||
(async () => { | ||
// if exists, remove './lib/dist' folder | ||
await fs.rm('./lib/dist', { | ||
force: true, | ||
recursive: true, | ||
}); | ||
// compile elm app | ||
await cmd("npx elm make src/MainEmbeddable.elm --optimize --output lib/dist/elm-editor.js"); | ||
// compile react component | ||
await cmd("npx babel --extensions '.jsx' src --out-dir lib/dist"); | ||
// isolate css files | ||
await cmd("npx isolate-css-cli -p tableaueditor-Obry4K9MqH -c -o lib/dist/static/css -u 2 src/static"); | ||
// copy font files used by isolated css | ||
await cmd("npx copyfiles -u 3 src/static/webfonts/* lib/dist/static/webfonts"); | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
interface AppProps { | ||
instance: any, | ||
isEdited: boolean, | ||
onStateChange: () => void | ||
} | ||
|
||
interface PrepareResult { | ||
instance: any, | ||
getState: (instance: any) => any, | ||
} | ||
|
||
export function prepare(initialState: any): PrepareResult | ||
export function AppComponent(props: AppProps): JSX.Element |
Oops, something went wrong.