浏览代码

[subpackage] Add option to save .npmrc file for publishing other packages at the same time

/main
Peter Bay Bastian 7 年前
当前提交
ffe95b56
共有 1 个文件被更改,包括 8 次插入8 次删除
  1. 16
      subpackage.py

16
subpackage.py


from pprint import pprint
def create_or_increment(map, key):
if key not in map:
map[key] = 1
else:
map[key] += 1
def main():
parser = argparse.ArgumentParser()

help="don't clean-up files")
parser.add_argument("-s", "--silent", action="store_true",
help="don't tell me what's going on here")
parser.add_argument("--save-npmrc", action="store_true",
help="save the downloaded .npmrc file to the current working directory")
args = parser.parse_args()
silent = args.silent
base_folder = os.path.realpath(args.folder)

res = c.getresponse()
npm_config = res.read().decode(res.headers.get_content_charset("ascii"))
print(textwrap.indent(npm_config, " >"))
info_print("Writing config to sub-package folders:")
info_print("Writing config to files:")
with open(path, 'w') as file:
file.write(npm_config)
info_print(" {}".format(path))
if args.save_npmrc:
path = os.path.join(os.getcwd(), ".npmrc")
with open(path, 'w') as file:
file.write(npm_config)
info_print(" {}".format(path))

正在加载...
取消
保存