-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4133f56f.8e504c11.js
1 lines (1 loc) · 5.86 KB
/
4133f56f.8e504c11.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{162:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){return a})),n.d(t,"metadata",(function(){return i})),n.d(t,"rightToc",(function(){return l})),n.d(t,"default",(function(){return b}));var r=n(2),s=n(11),c=(n(0),n(174)),a={id:"schematics-library",title:"schematics-library",sidebar_label:"schematics-library"},i={id:"schematics/schematics-library",title:"schematics-library",description:"Use the `schematics-library` schematic to publish your own schematics!",source:"@site/docs/schematics/schematics-library.md",permalink:"/docs/schematics/schematics-library",editUrl:"https://github.com/nxpm/nxpm/edit/master/apps/docs/docs/schematics/schematics-library.md",sidebar_label:"schematics-library",sidebar:"someSidebar",previous:{title:"nxpm release",permalink:"/docs/commands/release"},next:{title:"Releasing packages",permalink:"/docs/guides/releasing-packages"}},l=[],o={rightToc:l};function b(e){var t=e.components,n=Object(s.a)(e,["components"]);return Object(c.b)("wrapper",Object(r.a)({},o,n,{components:t,mdxType:"MDXLayout"}),Object(c.b)("p",null,"Use the ",Object(c.b)("inlineCode",{parentName:"p"},"schematics-library")," schematic to publish your own schematics!"),Object(c.b)("h1",{id:"creating-the-library"},"Creating the library"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{className:"language-shell",metastring:"script",script:!0}),"yarn add -D @nxpm/schematics\nnx g @nxpm/schematics:schematics-libary schematics\n")),Object(c.b)("p",null,"This will create a library based on ",Object(c.b)("inlineCode",{parentName:"p"},"@nrwl/node:lib")," with some extra configuration\nto make it a valid schematic."),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{}),"CREATE tslint.json (1671 bytes)\nCREATE libs/schematics/tslint.json (97 bytes)\nCREATE libs/schematics/README.md (174 bytes)\nCREATE libs/schematics/tsconfig.json (123 bytes)\nCREATE libs/schematics/tsconfig.lib.json (253 bytes)\nCREATE libs/schematics/src/index.ts (0 bytes)\nCREATE jest.config.js (250 bytes)\nCREATE libs/schematics/jest.config.js (244 bytes)\nCREATE libs/schematics/tsconfig.spec.json (273 bytes)\nCREATE libs/schematics/package.json (294 bytes)\nCREATE libs/schematics/src/lib/collection.json (242 bytes)\nCREATE libs/schematics/src/lib/hello-world/hello-world.spec.ts (478 bytes)\nCREATE libs/schematics/src/lib/hello-world/hello-world.ts (307 bytes)\nUPDATE tsconfig.json (573 bytes)\nUPDATE angular.json (3512 bytes)\nUPDATE nx.json (541 bytes)\nUPDATE package.json (1528 bytes)\n\u2714 Packages installed successfully.\n")),Object(c.b)("h1",{id:"building-the-library"},"Building the library"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{className:"language-shell",metastring:"script",script:!0}),"yarn build schematics\n")),Object(c.b)("h1",{id:"publishing-to-npm"},"Publishing to npm"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{className:"language-shell",metastring:"script",script:!0}),"cd dist/libs/schematics\nnpm publish\n\n\nnpm notice\nnpm notice \ud83d\udce6 @nxpm-playground/[email protected]\nnpm notice === Tarball Contents ===\nnpm notice ...\nnpm notice === Tarball Details ===\nnpm notice name: @nxpm-playground/schematics\nnpm notice version: 1.1.1\n+ @nxpm-playground/[email protected]\n")),Object(c.b)("h1",{id:"using-your-schematics"},"Using your schematics"),Object(c.b)("pre",null,Object(c.b)("code",Object(r.a)({parentName:"pre"},{className:"language-shell",metastring:"script",script:!0}),"# In some Nx Workspace or Angular CLI project...\nyarn add -D @nxpm-playground/schematics\nnx g @nxpm-playground/schematics:hello-world\nCREATE hello (5 bytes)\n")))}b.isMDXComponent=!0},174:function(e,t,n){"use strict";n.d(t,"a",(function(){return p})),n.d(t,"b",(function(){return h}));var r=n(0),s=n.n(r);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){c(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,r,s=function(e,t){if(null==e)return{};var n,r,s={},c=Object.keys(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r<c.length;r++)n=c[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var o=s.a.createContext({}),b=function(e){var t=s.a.useContext(o),n=t;return e&&(n="function"==typeof e?e(t):i({},t,{},e)),n},p=function(e){var t=b(e.components);return s.a.createElement(o.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return s.a.createElement(s.a.Fragment,{},t)}},u=Object(r.forwardRef)((function(e,t){var n=e.components,r=e.mdxType,c=e.originalType,a=e.parentName,o=l(e,["components","mdxType","originalType","parentName"]),p=b(n),u=r,h=p["".concat(a,".").concat(u)]||p[u]||m[u]||c;return n?s.a.createElement(h,i({ref:t},o,{components:n})):s.a.createElement(h,i({ref:t},o))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var c=n.length,a=new Array(c);a[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,a[1]=i;for(var o=2;o<c;o++)a[o]=n[o];return s.a.createElement.apply(null,a)}return s.a.createElement.apply(null,n)}u.displayName="MDXCreateElement"}}]);