Last active
October 9, 2025 06:25
-
-
Save jordansissel/8851a82aa9be1c34501d3926485b78db to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# A rough demo demo following the instructions | |
# on https://docs.github.com/en/actions/tutorials/create-actions/create-a-javascript-action | |
# | |
define rollup_content = | |
import commonjs from "@rollup/plugin-commonjs"; | |
import { nodeResolve } from "@rollup/plugin-node-resolve"; | |
const config = { | |
input: "index.js", | |
output: { | |
esModule: true, | |
file: "dist/index.js", | |
format: "es", | |
sourcemap: true, | |
}, | |
plugins: [commonjs(), nodeResolve({ preferBuiltins: true })], | |
}; | |
export default config; | |
endef | |
export rollup_content | |
demo-cache demo-exec: package.json rollup.config.js | |
demo-cache demo-exec: node_modules/rollup/package.json | |
demo-exec: node_modules/@actions/exec/package.json | |
demo-cache: node_modules/@actions/cache/package.json | |
demo-exec: | |
echo 'import * as exec from "@actions/exec";' > index.js | |
npm exec -- rollup --config rollup.config.js | |
demo-cache: | |
echo 'import * as cache from "@actions/cache";' > index.js | |
npm exec -- rollup --config rollup.config.js | |
package.json: Makefile | |
npm init -y | |
jq '.type = "module"' <package.json >package.json.new | |
mv package.json.new package.json | |
node_modules/rollup/package.json: Makefile | |
npm install --save-dev rollup @rollup/plugin-commonjs @rollup/plugin-node-resolve | |
node_modules/@actions/exec/package.json: Makefile | |
npm install @actions/exec | |
node_modules/@actions/cache/package.json: Makefile | |
npm install @actions/cache | |
rollup.config.js: Makefile | |
echo "$$rollup_content" > $@ |
This file contains hidden or 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
% make demo-exec | |
echo 'import * as exec from "@actions/exec";' > index.js | |
npm exec -- rollup --config rollup.config.js | |
index.js → dist/index.js... | |
created dist/index.js in 235ms |
This file contains hidden or 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
echo 'import * as cache from "@actions/cache";' > index.js | |
npm exec -- rollup --config rollup.config.js | |
index.js → dist/index.js... | |
[!] (plugin commonjs--resolver) RollupError: node_modules/@actions/cache/package.json (2:8): Expected ';', '}' or <eof> (Note that you need @rollup/plugin-json to import JSON files) | |
node_modules/@actions/cache/package.json (2:8) | |
1: { | |
2: "name": "@actions/cache", | |
^ | |
3: "version": "4.1.0", | |
4: "preview": true, | |
at Object.getRollupError (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/parseAst.js:285:41) | |
at ParseError.initialise (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:16064:40) | |
at convertNode (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:17947:10) | |
at convertProgram (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:17187:12) | |
at Module.setSource (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:18935:24) | |
at async ModuleLoader.addModuleSource (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:22581:13) | |
[cause] RollupError: Expected ';', '}' or <eof> | |
at Object.getRollupError (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/parseAst.js:285:41) | |
at ParseError.initialise (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:16064:40) | |
at convertNode (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:17947:10) | |
at convertProgram (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:17187:12) | |
at Module.setSource (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:18935:24) | |
at async ModuleLoader.addModuleSource (/home/jls/projects/experiments/nodejs/gha-rollup/node_modules/rollup/dist/shared/rollup.js:22581:13) | |
make: *** [Makefile:32: demo-cache] Error 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment