go to index

程序员日记20250326

read time 3 min read
deepseek react native boost uniapp bem taro android kotlin

DeepSeek

  • completions(补全)API应用

    使用了补全API对工具匠的描述,内容以及标签进行了自动化完善,虽然生成的内容过于刻板,但是总觉得比让员工去弄靠谱些,完善了200个工具只用了不到1块钱和20分钟。

React Native

  • Boost 安装失败

找到/node_modules/react-native/third-party-podspecs/boost.podspec,替换

plaintext
spec.source = { :http => 'https://boostorg.jfrog.io/artifactory/main/release/1.83.0/source/boost_1_83_0.tar.bz2',
:sha256 => '6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e' }

plaintext
  spec.source = { :http => 'https://archives.boost.io/release/1.83.0/source/boost_1_83_0.tar.bz2',
  :sha256 => '6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e' }

或者

plaintext
  spec.source = { :http => 'https://sourceforge.net/projects/boost/files/boost/1.83.0/boost_1_83_0.tar.bz2',
  :sha256 => '75b1f569134401d178ad2aaf97a2993898dd7ee3' }

具体根据自己的网络情况来。

  • SASS插件 react-native-sass-transformer

    可以在react native里使用`scss样式,当然只能转换react native 支持的样式。

    安装

    shell
    yarn add --dev react-native-sass-transformer sass
    

    配置 metro.config.js

    plaintext
    const { getDefaultConfig, mergeConfig } = require("@react-native/metro-config");
    
    const defaultConfig = getDefaultConfig(__dirname);
    const { assetExts, sourceExts } = defaultConfig.resolver;
    
    /**
     * Metro configuration
     * https://reactnative.dev/docs/metro
     *
     * @type {import('metro-config').MetroConfig}
     */
    const config = {
      transformer: {
        babelTransformerPath: require.resolve("react-native-sass-transformer")
      },
      resolver: {
        sourceExts: [...sourceExts, "scss", "sass"]
      }
    };
    
    module.exports = mergeConfig(defaultConfig, config);
    

Taro

  • 别名配置

config/index.ts 配置

typescript
module.exports = {
  // ...
  alias: {
    '@/components': path.resolve(__dirname, '..', 'src/components'),
    '@/utils': path.resolve(__dirname, '..', 'src/utils'),
  },
}

tsconfig.json配置

typescript
{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@/components/*": ["./src/components/*"],
      "@/utils/*": ["./src/utils/*"],
    }
  }
}

使用

typescript
import A from '@/components/A'
import Utils from '@/utils'

Uniapp

  • 第三方依赖Swift兼容问题

    云打包一个framework提示兼容性报错

    error: failed to build module ‘RingsSDK’; this SDK is not supported by the compiler (the SDK is built with ‘Apple Swift version 6.0 effective-5.10 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)’, while this compiler is ‘Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)’). Please select a toolchain which matches the SDK.

​ 云打包的Xcode版本目前是16.1 如果高于此版本编译的库 就会报错,但是目前好像低版本也会报错,难道必须相同吗?

BEM

  • 熟悉的陌生人

    实际用了很多,但是第一次才知道这种写法叫做BEM。实际就是一种规范和最佳实践。

    Block: nav

    Element: nav__item

    Modifier: nav__item--active

Android

  • kotlin compiler embeddable 下载巨慢的问题

    配置阿里云和腾讯云的仓库貌似不能解决,只能手动下载之后放到下面目录下去

    plaintext
    ~\.gradle\caches\modules-2\files-2.1\org.jetbrains.kotlin\kotlin-compiler-embeddable\版本