emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel zip after exporting file
@ 2023-03-16 22:39 suarezmiguelc
  2023-03-17 12:41 ` Max Nikulin
  0 siblings, 1 reply; 2+ messages in thread
From: suarezmiguelc @ 2023-03-16 22:39 UTC (permalink / raw)
  To: emacs-orgmode

Hello Emacs org-mode community, I’m trying this example:

** index.js
:header-args: :tangle index.js :post-tangle (shell-command-to-string "zip index.js.zip index.js && rm index.js")

First endpoint example:

#+begin_src js
exports.handler = async (event, context) => {
  console.log('Received event:', JSON.stringify(event, null, 2));
  return {
    statusCode: 200,
    headers: {
      'Content-Type': 'application/json'
    body: JSON.stringify({
      message: 'Hello, world!'

What I want is to:
1. Tangle the index.js file
2. Zip it as index.js.zip
3. Delete the raw code index.js

The thing is that, the command inserted in :post-tangle is executed before the creation of the file, so it only works if the file already exists, so:
- First run, file doesn’t exist, only index.js is generated.
- Second run, zip file appears, index.js is intact since the rm index.js command ran but then index.js was generated again.

How should I debug this?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-03-17 12:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-16 22:39 Babel zip after exporting file suarezmiguelc
2023-03-17 12:41 ` Max Nikulin

Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).