1.0.2 • Published 6 years ago

ra-wtf v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Creating and publishing an Angular package

Extract your module to ./lib/[packageName]/src folder,

Create a ./lib/[packageName]/public_api.ts file

export * from "./src/moduleName.module;

Create lib/[packageName]/package.json file

{
  "name": "moduleNAme",
  "version": "1.0.0",
  "license": "MIT",
  "private": false,
  "author": {
    "name": "name",
    "email": "email"
  },
  "description": "description",
  "repository": {
    "type": "git",
    "url": "github repo url"
  },
  "peerDependencies": {
    "@angular/core": "^5.2.0"
  }
}

Create lib/[packageName]/ng-package.json file

{
    "$schema": "./../../node_modules/ng-packagr/ng-package.schema.json",
    "lib": {
        "entryFile": "public_api.ts"
    }
}

Create a lib/[packageName]/readme.md file

Add scripts to ./package.json

  • "pack": "ng-packagr -p lib/[packageName]/ng-package.json"
  • "publish": "npm publish lib/[packageName]/dist"

Testing

  • Insert the following code snippet to src/test.ts
const contextLib = require.context('./../lib/', true, /\.spec\.ts$/);
contextLib.keys().map(contextLib);
  • Modify src/tsconfig.spec.json as follows
"include": [
    "**/*.spec.ts",
    "**/*.d.ts",
    "./../lib/**/*.spec.ts",
    "./../lib/**/*.d.ts"
  ]

To create and publish:

  1. ng test
  2. update the version number
  3. npm run pack
  4. npm run publish
1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago