-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into support-new-unity-versioning-scheme
- Loading branch information
Showing
7 changed files
with
92 additions
and
127 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
const index = require('./index.js'); | ||
|
||
index.main(); |
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 was deleted.
Oops, something went wrong.
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 @@ | ||
const index = require('./index.js'); | ||
|
||
index.post(); |
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 |
---|---|---|
@@ -1,30 +1,2 @@ | ||
import { run as main } from './main'; | ||
import path from 'path'; | ||
import { run as post } from './post'; | ||
|
||
/* | ||
* GitHub Action can provide multiple executable entrypoints (pre, main, post), | ||
* but it is complicated process to generate multiple `.js` files with `ncc`. | ||
* So we rather generate just one entrypoint, that is symlinked to multiple locations (main.js and post.js). | ||
* Then when GitHub Action Runner executes it as `node path/to/main.js` and `node path/to/post.js`, | ||
* it can read arguments it was executed with and decide which file to execute. | ||
* The argv[0] is going to be a full path to `node` executable and | ||
* the argv[1] is going to be the full path to the script. | ||
* In case index.js would be marked executable and executed directly without the argv[1] it defaults to "main.js". | ||
*/ | ||
async function run([, name = 'main.js']: string[]) { | ||
const script = path.basename(name); | ||
|
||
switch (script) { | ||
case 'main.js': | ||
await main(); | ||
break; | ||
case 'post.js': | ||
await post(); | ||
break; | ||
default: | ||
throw new Error(`Unknown script argument: '${script}'`); | ||
} | ||
} | ||
|
||
run(process.argv); | ||
export { run as main } from './main'; | ||
export { run as post } from './post'; |