all messages for Emacs-related lists mirrored at yhetil.org
 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
:PROPERTIES:
:header-args: :tangle index.js :post-tangle (shell-command-to-string "zip index.js.zip index.js && rm index.js")
:END:

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!'
    })
  };
};
#+end_src

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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.