2025/03/15 ~ 2025/03/21 のもくもく日記
もくもく 前回までは
2025/03/08 ~ 2025/03/14 のもくもく日記 をご覧ください。
途中経過
その1
TypeScript でclass 等に定義したメンバーの可視性の記述を強制したいと思って調べてみたら、 eslint の下記ルールを使うことで実現できた!
explicit-member-accessibility | typescript-eslint
その2
Swift でアクセス修飾子を強制するにはSwiftLint の下記ルールを使うと良いみたい
その3
GitHub Actions で同じリポジトリに対してブランチを切り替えたcheckout を行うと、最後に指定したブランチが残る
— Shion@アプリ実装者(仮) (@shion_engineer) March 16, 2025
同時に扱いたいならfetch-depth: 0 するしかないかも…… pic.twitter.com/hE1VMelbx3
この件なんだけど、そもそもGit リポジトリが取得出来ているので、
単純に git fetch
で欲しいブランチを取得すれば良いだけだった。
その4
TypeScript のDecorators を調べているのだけど、実装できそうで実装できてない……。 頭の整理に時間がかかりそうw
TypeScript: Documentation - Decorators
その5
知らなかったのだけど、CocoaPods ってCDN あるのね 👀
https://github.com/CocoaPods/cdn.cocoapods.org
その6
package.json のversion って、node-semver で解釈可能な形式のものを設定する必要があるのだけど、
ざっと見た感じ major
, minor
, patch
が基本っぽい。
…… build
情報をどう扱うか悩むw
https://github.com/npm/node-semver
その7
プログラムから @vercel/ncc
を呼び出して、出力したJavaScript をデバッグしようとしたのだけど上手く動かなかった。
原因は sourcemap-register.js
の配置を忘れていたからだった。結果のassets も大事なのね……。
それにしても sourceMap: true
にした際、出力されたJavaScript が参照するのは index.js.map
固定っぽい。
任意のファイル名に出来たら嬉しいかもw
ちなみに実装例はこんな感じ。
const isDebug = true;
const result = await require('@vercel/ncc')(
join(__dirname, 'src', `${filename}.ts`),
{
minify: !isDebug,
sourceMap: isDebug,
},
);
const outputDirPath = join(__dirname, 'build');
await writeFile(join(outputDirPath, `${filename}.js`), result.code, {
encoding: 'utf-8',
});
if (isDebug) {
await writeFile(join(outputDirPath, 'index.js.map'), result.map, {
encoding: 'utf-8',
});
await writeFile(
join(outputDirPath, 'sourcemap-register.js'),
result.assets['sourcemap-register.js'].source,
{encoding: 'utf-8'},
);
}
※ https://github.com/tshion/mkcmd/blob/develop/build.js より引用
今回の進捗
- GitHub
- Nintendo Switch でトレーニングを進めた
※関連SNS
- https://x.com/shion_engineer/status/1900743902531121430
- https://x.com/shion_engineer/status/1900855544711442949
- https://x.com/shion_engineer/status/1901077234829717711
- https://x.com/shion_engineer/status/1901203083042103518
- https://x.com/shion_engineer/status/1901604750833095167
- https://x.com/shion_engineer/status/1901981618631594179
- https://x.com/shion_engineer/status/1902376876783571117
- https://x.com/shion_engineer/status/1902378596607651947