标签: npm-publish

在保留文件夹结构的同时将html和css文件复制到dist

我正在尝试npm发布具有以下结构的angular2应用程序。

search-app
  config
  node_modules
  src
    api
      --index.ts
      --ping.ts
      --search.ts  
    model
      --index.ts
      --model.ts
    web
      app
        ping
          --index.ts
          --ping.css
          --ping.html
          --ping.ts
        search
          --index.ts
          --search.css
          --search.html
          --search.ts
        --app.css
        --app.html
        --app.module.ts
        --app.ts
      --index.html
      --index.ts
package.json
tsconfig.json
Run Code Online (Sandbox Code Playgroud)

现在,我的“ npm run dist”命令是

"dist": "npm run rimraf -- dist && tsc src/index.ts src/web/index.ts src/model/index.ts -m commonjs --outDir dist --sourcemap --target es6 -d --pretty --noImplicitAny --experimentalDecorators --skipLibCheck"
Run Code Online (Sandbox Code Playgroud)

运行npm run dist将产生以下dist目录。

search-app
  dist
    api
      --*.d.ts
      --*.js 
    model
      --*.d.ts
      --*.js
    web
      app
        ping
          --*.d.ts
          --*.js
        search
          --*.d.ts
          --*.js
        --*.d.ts
        --*.js …
Run Code Online (Sandbox Code Playgroud)

linux macos npm npm-publish angular

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

在 Gitlab-ci 中使用 NPM 发布节点模块不起作用

我正在使用 gitlab-ci 为我的 CI/CD 发布一个 NPM 模块到注册表。以下是我的 gitlab-ci.yml 文件

image: docker:latest

variables:
  DOCKER_DRIVER: overlay2

services:
- docker:dind

cache:
  untracked: true
  key: "$CI_COMMIT_REF_NAME"
  paths:
    - node_modules/
stages:
    - setup

job-setup:
   stage: setup
   tags:
    - angular
   image: node:alpine
   except: 
    - tags
   script:
     - npm set registry https://registry.npmjs.org
     - npm i
     - cp .npmrc ~/.npmrc
     - npm publish --registry https://registry.npmjs.org
Run Code Online (Sandbox Code Playgroud)

我在发布命令上收到以下警告消息。模块已发布,但模块中的 /dist 文件夹丢失。

npm WARN prepublish-on-install As of npm@5, `prepublish` scripts are deprecated.
npm WARN prepublish-on-install Use `prepare` for build steps and `prepublishOnly` …
Run Code Online (Sandbox Code Playgroud)

npm gitlab-ci-runner npm-publish

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

无法验证 github 和 npm

 $ npm login --scope=@username --registry=https://npm.pkg.github.com
 
 $ Username: username
 
 $ Password: ********
 
 $ Email: (this IS public) example@gmail.com
 
 $ npm ERR! code E401
 
 $ npm ERR! 401 Unauthorized - PUT $ https://npm.pkg.github.com/-/user/org.couchdb.user:forinda - Error authenticating user: Requires authentication
 
 $npm ERR! A complete log of this run can be found in:
 
 $npm ERR!     /home/orinda/.npm/_logs/2021-10-15T02_25_19_104Z-debug.log
Run Code Online (Sandbox Code Playgroud)

无法验证 npm 注册表和 github 我在填写密码时收到 401 错误 如何解决此问题

github npm-request npm-publish

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

npm 发布 429 请求过多

我正在尝试 npm 发布我的包https://github.com/kofifus/HyperappComponent

在 Windows cmd 中,我克隆了包,登录到 npm 然后尝试npm publish

我得到:

C:\Temp\HyperappComponent>npm publish
npm notice
npm notice package: hyperappcomponent@0.1.0
npm notice === Tarball Contents ===
npm notice 11.6kB LICENSE
npm notice 3.7kB  index.js
npm notice 235B   package.json
npm notice 4.2kB  README.md
npm notice === Tarball Details ===
npm notice name:          hyperappcomponent
npm notice version:       0.1.0
npm notice package size:  6.8 kB
npm notice unpacked size: 19.7 kB
npm notice shasum:        48dab5ae762c43ae9afe3a24df79edf07942082c
npm notice integrity:     sha512-Xgf3YoCRPd68v[...]eLWhg8GH2wqWg==
npm notice total …
Run Code Online (Sandbox Code Playgroud)

npm npm-publish

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

当用户安装 TypeScript 模块时,如何使用 npm install 将其编译为 JS?

我构建了一个 TypeScript 模块并将其推送到 GitHub。我现在想在我的内部使用这个模块MyApp作为依赖项,它也是用 TypeScript 编写的。该包已在我的中注册MyApp/package.json

  "dependencies": {
    "foo": "github:organization-xyz/foo",
  }
Run Code Online (Sandbox Code Playgroud)

我添加了一个命令build-tsJavaScript在我的foo模块中创建相应的绑定foo/package.json

  "scripts": {
    "build-ts": "tsc"
    ...
  },
Run Code Online (Sandbox Code Playgroud)

当然,当我调用npm i主应用程序时,不会执行该命令。我如何正确准备我的模块foo才能将其成功导入到我的应用程序中?

node.js typescript npm-publish npm-install npm-scripts

0
推荐指数
1
解决办法
3543
查看次数