-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
__filename / __dirname equivalent & pattern for relying on files from typescript modules? #317
Comments
The module I think this is what you want -- see if it works for you .. |
Thanks for the quick response. I don't see @jkcfg/std/resource in any of the published modules in npm or in the source code at std/ in this repository. Is it generated by building this repo? |
@booninite yes, I believe that all of |
Do you know how to make TypeScript code that leverages |
Did you also copy 'tsconfig.json' from the same directory? I recall having
to adjust my 'tscomfig.json' to match that one and actually I had to use
one 'tsconfig.json' for jk part of my project, and then a different on for
another part (GitHub actions in my case). If it would help, I maybe able to
share more details via Slack DM later.
…On Thu, 6 Feb 2020, 11:38 pm alex weidner, ***@***.***> wrote:
Do you know how to make TypeScript code that leverages @jkcfg/std compile
correctly? I have been using the published npm packages based on the
TypeScript example in the jkcfg/kubernetes repository here:
https://github.com/jkcfg/kubernetes/blob/master/examples/guestbook-ts/package.json
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#317?email_source=notifications&email_token=AAB5MS46RRFYNQ2NAHRAF7LRBSNNVA5CNFSM4KM4VZF2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELBGFWA#issuecomment-583164632>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAB5MS4RYDEDB6LIIZAHBGLRBSNNVANCNFSM4KM4VZFQ>
.
|
I filed #319 for documenting how to set TypeScript to generate files you can use with |
Finally circling back to this. Regarding actually finding the file on the filesystem when my code is running via
I ultimately ended up writing a Now that I understand the above, I can see how using My confusion in #317 (comment) and #317 (comment) stemmed from not understanding the relationship between the I believe the only actual problem on this issue was that
Thanks for the help and the great project : ) |
It is really useful to hear how people reason their way through using a piece of software, and this is a fine example of the form :-) Thank you @booninite! |
I'm writing some configurations in TypeScript that rely on reading a file. I transpile the TypeScript first, and then run
jk generate
against the output javascript to build my configuration files.This all works swimmingly, other than one of my jkcfg modules relies on a file,
manifests.yaml
. This file is stored next to the source, but I could move it. I would like to leverage__filename
or__dirname
to build relative paths to the external file -- is there a recommended pattern I can use as an alternative?Additionally, even when I hardcode the path to
manifests.yaml
so that it would be correct from the javascript file, I get errors regarding reading outside of base path. Everything (source, YAML files, generated output, compiled javascript) lives underkubernetes/
. The file exercised byjk generate
iskubernetes/dist/clusters
, which contains anindex.js
. I have tried setting the input directory tokubernetes/
so thatjk generate
can "see"kubernetes/models/cert-manager/manifests.yaml
, but that isn't producing the anticipated result.Am I misunderstanding these flags or totally missing on the correct pattern to do this?
I clean
kubernetes/dist/
andkubernetes/generated/
at the start of the generation script so that I always have the most up to date results, so I would like to avoid something likecp kubernetes/models/cert-manager/manifests.yaml kubernetes/dist/models/cert-manager
after transpiling the javascript.The text was updated successfully, but these errors were encountered: