当前位置: 首页 > 软件库 > 手机/移动开发 > >

symlink-resolver

授权协议 MIT License
开发语言 JavaScript TypeScript
所属分类 手机/移动开发
软件类型 开源软件
地区 不详
投 递 者 缪晋
操作系统 iOS
开源组织
适用人群 未知
 软件概览

Symlink Resolver

This tool allows to replace symbolic links by real files in given directory and revert the changes back to symlinks. All the magic in a simple cli command!

Installation

npm install symlink-resolver --save-dev

Node.js v6.4+ and POSIX-standarized operating system are required.

To your package.json scripts section add the following rule:

"scripts": {
    "symlink-resolver": "symlink-resolver",
}

Basic Usage

For fast usage you can simply run:

  • npm run symlink-resolver build ./symlinks/path to replace symlinks by real files in ./symlinks/path
  • npm run symlink-resolver clear ./symlinks/path to restore all symlinks

First command will create ./symlinks/path/.symlinks.json file which contains changes that have been made in this directory. It will be removed by the second command, however you can still add to your .gitignore the following rule: .symlinks.json

How to create a symlink?

Use ln -s target source command, i.e.:

ln -s ../../source/path/linked-dir ./project/src/linked-dir

Advanced usage

If you need this feature to make a build, then I strongly recommend to automatize your building process:

"scripts": {
        "symlink-resolver": "symlink-resolver",
        "prebuild": "npm run symlink-resolver build ./symlinks/path",
        "postbuild": "npm run symlink-resolver clear ./symlinks/path",
        "build": "your build command should be under this name"
}

This way you will be able to make a build and edit your files without worries.

However, in some cases like emulating a device, the "post" script will not be executed. If this is also your case then take a look at example workaround for NativeScript:

  "scripts": {
    "symlink-resolver": "symlink-resolver",
    "prens-bundle": "npm run symlink-resolver build ./symlinks/path",
    "delay-clear": "sleep 22 && npm run symlink-resolver clear ./symlinks/path",
    "ns-bundle": "npm run delay-clear | ns-bundle",
    "start-android-bundle": "npm run ns-bundle --android --start-app",
    "start-ios-bundle": "npm run ns-bundle --ios --start-app",
    "build-android-bundle": "npm run ns-bundle --android --build-app",
    "build-ios-bundle": "npm run ns-bundle --ios --build-app"
  },

Advanced configuration

You can adjust Config to your needs.

  • Want to use custom symlinks file name? No problem, just set Config.symlinksFile to whatever you want.
  • Need some custom behavior? Simply extend SymlinkHelper class and set Config.helperClass to yours.
export interface ConfigInterface {
    rootDir: string;
    symlinksFile: string;
    helperClass: typeof SymlinkHelper;
}
Happy developing!
 相关资料
  • 创建一个流(stream),用于连接 Vinyl 对象到文件系统。 用法 const { src, symlink } = require('gulp'); function link() { return src('input/*.js') .pipe(symlink('output/')); } exports.link = link; 函数原型 symlink(directo

  • 描述 (Description) 此函数在OLDFILE和NEWFILE之间创建符号链接。 在不支持符号链接的系统上,会导致致命错误。 语法 (Syntax) 以下是此函数的简单语法 - symlink ( OLDFILE, NEWFILE ) 返回值 (Return Value) 此函数在失败时返回0,在成功时返回1。 例子 (Example) 下面是显示其基本用法的示例代码,首先在/ tmp

  • symlink(建立文件符号连接) 相关函数 link,unlink 表头文件 #include<unistd.h> 定义函数 int symlink( const char * oldpath,const char * newpath); 函数说明 symlink()以参数newpath指定的名称来建立一个新的连接(符号连接)到参数oldpath所指定的已存在文件。参数oldpath指定的文件不

  • symlink 建立文件符号连接 相关函数 link,unlink 表头文件 #include<unistd.h> 定义函数 int symlink(const char *oldpath, const char *newpath); 函数说明 symlink()以参数newpath指定的名称来建立一个新的连接(符号连接)到参数oldpath所指定的已存在文件。参数oldpath指定的文件不一

  • 本文向大家介绍PHP中的symlink()函数,包括了PHP中的symlink()函数的使用技巧和注意事项,需要的朋友参考一下 该函数创建一个符号链接。成功返回TRUE,失败返回FALSE。 语法 参数 -目标要创建的链接的目标。 链接-链接的名称。 返回 如果成功,该函数将返回TRUE,否则将返回FALSE。 示例 输出结果

  • 我目前正在尝试将APK纳入我的AOSP 10版本。为此,我在< code>packages/apps下创建了一个新的模块文件夹,并将我的APK和一个Android.mk文件放入其中。然后,我将模块添加到PRODUCT_PACKAGES变量中。当< code>packages/apps下的模块是一个真正的文件夹时,这非常有用。然而,当我通过符号链接替换is时,该应用程序不会出现在新版本中。我的And