小编Nat*_*ate的帖子

如何运行依赖包的npm脚本

我有一个包本身有一个脚本package.json,我希望能够在我的顶级项目中运行.这个包是我的顶级项目依赖项之一.我正在寻找一种直接或间接调用依赖包脚本的方法.

让我们假设我正在使用的模块名称已命名foo,我想运行的脚本是updateFooData.

我尝试使用语法npm run-script <package> <...>来运行它,但这似乎是不推荐使用的功能,因为我在当前的官方文档中找不到它,但我在其他(非常旧的)搜索结果中看到它.

npm run-script foo updateFooData

# npm ERR! missing script: foo
Run Code Online (Sandbox Code Playgroud)

我也查看了npm api,虽然npm.commands.run-script(args, callback)我会做我想要的,我无法弄清楚如何将模块加载到npm

{
  ...
  "scripts":{
    "foo:updateFooData": "node --eval \"... ??; npm.commands.run-script('updateFooData', callback)\""
  }
}

npm run foo:updateFooData
# Obviously fails
Run Code Online (Sandbox Code Playgroud)

到目前为止,我发现的唯一的工作是CD进入子模块目录并从那里运行npm.这不是我的首选解决方案.

cd node_modules/foo
npm run updateFooData
Run Code Online (Sandbox Code Playgroud)

npm

15
推荐指数
2
解决办法
6785
查看次数

如何在Xcode控制台中打印反汇编寄存器

我在看一些反汇编代码,看到喜欢的东西0x01c8f09b <+0015> mov 0x8(%edx),%edi,我想知道什么的值%edx或者%edi是.

有没有办法打印%edx或其他汇编变量的值?有没有办法在%edx指向的内存地址处打印值(我假设edx是一个寄存器,其中包含一个指向...的东西).

例如,您可以通过po在控制台中键入来打印对象,那么是否有用于在程序集中打印寄存器/变量的命令或语法?

背景:

我正在EXC_BAD_ACCESS上线,我想调试发生了什么.我知道这个错误与内存管理有关,我正在考虑找出可能丢失的地方/太多的保留/释放/自动释放调用.

附加信息:

这是在IOS上,我的应用程序在iPhone模拟器中运行.

xcode gdb objective-c disassembly

12
推荐指数
4
解决办法
8524
查看次数

AWS CloudFormation UserData EC2 环境变量

我正在使用 CloudFormation 开发基础设施。这是我自己的基础架构代码,如下所示。

 AWSRegionArch2AMI:
     us-east-1:
       HVM64: ami-0ff8a91507f77f867
       HVMG2: ami-0a584ac55a7631c0c
 ...
 ..
 .

 Resources:
 EC2Instance:
 Type: AWS::EC2::Instance
 Properties:
 InstanceType:
    Ref: InstanceType
  SecurityGroups:
  - Ref: InstanceSecurityGroup
  KeyName:
    Ref: KeyName
  UserData:
    Fn::Base64: !Sub |
      #!/bin/bash
      export MY_AMI_NAME=${ !GetAtt AWSRegionArch2AMI.us-east-1.HVM64 }

      echo $MY_AMI_NAME > $HOME/user_data.txt
Run Code Online (Sandbox Code Playgroud)

我想将变量设置为 user_data 文件,但它是空的,如何将环境变量放入我的用户数据字段中并在我自己的应用程序端使用它我该怎么做。

请帮忙 !

amazon-web-services aws-cloudformation

7
推荐指数
1
解决办法
3932
查看次数

Bookshelf.js,查询相关表

我有一个类似于以下的模型:

var ScholarlyPaper = Bookshelf.Model.extend({

  tableName: 'papers',

  paragraphs: function() {
    return this.hasMany(Paragraph).through(Section);
  },

  sections: function() {
    return this.hasMany(Section);
  }

});

var Section = Bookshelf.Model.extend({

  tableName: 'sections',

  paragraphs: function() {
    return this.hasMany(Paragraph);
  }

  scholarlyPaper: function() {
    return this.belongsTo(ScholarlyPaper);
  }

});

var Paragraph = Bookshelf.Model.extend({

  tableName: 'paragraphs',

  section: function() {
    return this.belongsTo(Section);
  },

  scholarlyPaper: function() {
    return this.belongsTo(ScholarlyPaper).through(Section);
  },

  author: function() {
    return this.belongsTo(Author);
  }

});

var Author = Bookshelf.Model.extend({

  tableName: 'authors',

  paragraphs: function() {
    return this.hasMany(Paragraph);
  }

});
Run Code Online (Sandbox Code Playgroud)

使用Bookshelf.js,给定一个学术论文ID和作者ID,我如何得到论文中作者没有写一个段落的所有部分?

我面临的特殊挑战是我没有办法在相关的表上添加where子句(例如'where paragraphs.author_id!= …

node.js bookshelf.js knex.js

6
推荐指数
1
解决办法
8495
查看次数

Windows Task Scheduler安装程序

我有一个用C#.net编写的小.exe文件,我希望每24小时在服务器上运行一次。因此,我自然会只使用Windows Task Schedular而不是自己做数学。我已经创建了程序,但是我想创建一个安装程序,它可以完成所有的设置。有没有办法像Visual Studio设置项目那样呢?如果没有的话,可以在安装后运行Powershell /批处理脚本吗?

底线:自动创建任务。

.net c# windows

5
推荐指数
1
解决办法
5257
查看次数

创建分支别名并推送

如何创建分支别名,使其可以被推拉而不被视为单独的分支。一些背景:

我们有一个名为Production. 由于各种原因,我不能只是重命名分支。

$ git branch --all
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/Production
  remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

有时我会git checkout production错误地没有注意到它是一个新分支。没有远程分支production。也没有 ref origin/production

$ git checkout production
Branch production set up to track remote branch production from origin.
Switched to a new branch 'production'
$ git status
On branch production
Your branch is up-to-date with 'origin/production'.

nothing to commit, working directory clean
$ git branch --all
  master
* production
  remotes/origin/HEAD -> origin/master
  remotes/origin/Production
  remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

Git 创建了一个本地分支 …

git version-control github

5
推荐指数
1
解决办法
1608
查看次数