Skip to content
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

cnako3のインクルードパス問題 #1747

Open
kujirahand opened this issue Sep 12, 2024 · 3 comments
Open

cnako3のインクルードパス問題 #1747

kujirahand opened this issue Sep 12, 2024 · 3 comments

Comments

@kujirahand
Copy link
Owner

kujirahand commented Sep 12, 2024

うまく取り込めない場合があるとのこと。今でも、パスを探しまくっているけど、もう一度シチュエーションを見直してみる。、

記事みてnadesiko3-officeで試してみたけどnadesiko3とnadesiko3-officeの両方ともnpm installした構成だと既定のプラグインの検索パスでは取り込めないのね。プログラムを./srcに配置している場合。自分的には標準的な配置なので!「nadesiko3-office」を取り込むでそのまま動くと楽なんだけど。

あったらいいなぁと思うのは

  • 環境変数指定以外の既定の検索パスをオフにするオプション。
  • 替わりに指定の検索パスに複数パスの指定方法をもつ(PATH区切りのような;とか:とか)あたりです。

確かに、「取込」の検索パスに関するオプションがあると良いですよね。今だと検索しまくりなので。なでしこ1の時みたいにpluginsフォルダ(Nodeだとnode_modules)だけ見るとか選べるようにすると、間違いがないですね。

以下が実際にパスを検索している関数:

static findJSPluginFile (pname: string, filename: string, srcDir: string, log: string[] = []): string {

@kujirahand
Copy link
Owner Author

kujirahand commented Oct 18, 2024

アイデアとして、下記のように「!環境変数」で環境変数を上書きできるようにすると良いでしょうか。
そして、ソースコードでパスを指定できるようにすると良いかもですね。

# 取り込みパスの指定(区切り記号はmac/linux「:」、winは「;」)
! 環境変数 NAKO_LIB=~/nako_modules:~/repos/node_modules

# 取り込みパスをNAKO_LIBのみに限定する
! 環境変数 NAKO_INCLUDE_ONLY_LIB=1

@weyk
Copy link
Contributor

weyk commented Nov 10, 2024

pluginを取り込めなかったとき状態がわかったので置いておきます。
おそらくですがこれが原因でした。
構成
./package.json
./src/main.nako3
./node_modules/naesiko3
./node_modules/naesiko3-office

実行は./srcをカレントにしてnode.exeとcnako.mjsを絶対パスで指定、main.nako3はファイル名のみ指定。

ダメ『「!「nadesiko3-office.js」を取り込む。』
正解『「!「nadesiko3-office」を取り込む。』

@kujirahand
Copy link
Owner Author

weykさん、ご指摘ありがとうございます。これは、確かに、分かりにくいところですよね。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants