1 Private Module

🛑 👉🏻👉🏻👉🏻 INFORMATION AVAILABLE CLICK HERE👈🏻👈🏻👈🏻
JS Mentor, with 7+ years of experience in software design and dev.
Published Apr 09, 2015Last updated Feb 18, 2017
Creating modules are important, especially when you want your code to be reusable. Node provides an architecture where you can write and reuse your code in the form of modules, through npm registry. The packages can be published publicly or privately according to your needs. Private modules also make you able to distribute your code to intended users, your team mates or private to yourself, accessible from anywhere.
First create a folder MyModule anywhere. Then set the path to MyModule in cmd. Then you only need to create two files to create your first sample package.
now this can be the simplest module we can create, with just two files.
You do not need to explicitly create a package.json file. To create it, write in command prompt.
This should ask you following questions:
Now you don't even need to answer these, few important questions are: version, description, entry point(which can be changed, by default it is index.js file) and author.
Answer those and skip the rest by pressing enter. This will create a package.json file for your module.
Optionally, you can directly create a package.json file, following the next steps:
Now we have created the package.json file, we will create the index.js file, which is the entry point of our module.
Now this is our entry point to the module. We will create a simple to array to object converter. For ex:
write following code in your index.js file.
Done! we have created a module which exports a function to_Object, which will take an array as a parameter, and return converted object.
As we have completed the module, we can now publish it to npm registry. To publish your module, you must have a user on the npm registry. If you don't have one, create it with following command:
This will ask you the username, password to set and your email address. once done, you can login to npm using the following command:
This will store your credentials on client, and you would be now able to publish you module to npm registry.
Now the magic step, use this command
This publish your package. To see if your package is actually puslished on npm or not? You can go to following url from your browser:
Package-Name is the package name you just created and published.
You will need to update your package at some point with some additional feature. If you do, you can the change the version of your module, by using following command:
update-type is one of the semantic versioning release types, patch, minor, or major. This command will change the version number in package.json.
Note that this will also add a tag with this release number to your git repository if you have one.
Additionally, you can also change the version number directly in your package.json file.
After updating the version number, you can npm publish again. You can then see the package updated at the same url: http://npmjs.com/package/
Now, create a node project and change the current directory in _cmd _to your project. You can now install your module directly using
using your own module in you node project is similar to how you use other modules such as express
Now you get access to your module, and the method defined in it as,
write a simple node program, which will use our module.
This is what you get in your console.
When you don't want to publish your module to anyone else except few, you can create a private module.
Publishing the private module is similar to publishing the public module, as discussed above, with just one difference, you publish them in your namespace or your team's namespace (with whom you wish to share your module), just by giving them a name in package.json:
Publish them with npm publish , just like any other package, and you install them by namespace:
Once installed, use them by requiring them by namespace, just like any package:
Creating private or public modules is especially helpful to make you code reusable, distributive and make your code modular, so it's much more readable.
Enjoy this post? Give Naeem a like if it's helpful.
JS Mentor, with 7+ years of experience in software design and dev.
Hello there, I am a Javascript developer and mentor with 7+ years of experience in variety of front end as well as backend JS frameworks. I have tried my hands at different architectures, design patterns, cloud technologies and la...
Discover and read more posts from Naeem
Thanks really useful, clear and concise…
Want to improve your programming skills? Choose from 10,000+ mentors to pair program with.
By using Codementor, you agree to our Cookie Policy.
Private/Modules/Configuration/Configuration.psd1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@{
# Script module or binary module file associated with this manifest.
ModuleToProcess = '.\Configuration.psm1'
# Version number of this module.
ModuleVersion = '0.8'
# ID used to uniquely identify this module
GUID = 'e56e5bec-4d97-4dfd-b138-abbaa14464a6'
# Author of this module
Author = @('Joel Bennett')
# Company or vendor of this module
CompanyName = 'HuddledMasses.org'
# HelpInfo URI of this module
# HelpInfoURI = ''
# Copyright statement for this module
Copyright = 'Copyright (c) 2014-2016 by Joel Bennett, all rights reserved.'
# Description of the functionality provided by this module
Description = 'A module for storing and reading configuration values, with full PS Data serialization, automatic configuration for modules and scripts, etc.'
# We explicitly name the functions we want to be visible, but we export everything with '*'
FunctionsToExport = 'Import-Configuration','Export-Configuration','Get-StoragePath','Add-MetadataConverter',
'ConvertFrom-Metadata','ConvertTo-Metadata','Export-Metadata','Import-Metadata',
'Update-Manifest','Get-ManifestValue','*'
# Cmdlets to export from this module
CmdletsToExport = '*'
# Variables to export from this module
VariablesToExport = '*'
# Aliases to export from this module
AliasesToExport = '*'
# List of all files packaged with this module
FileList = @('Configuration.psd1','Configuration.psm1','Metadata.psm1','README.md','LICENSE')
PrivateData = @{
# PSData is module packaging and gallery metadata embedded in PrivateData
# It's for the PoshCode and PowerShellGet modules
# We had to do this because it's the only place we're allowed to extend the manifest
# https://connect.microsoft.com/PowerShell/feedback/details/421837
PSData = @{
# Keyword tags to help users find this module via navigations and search.
Tags = @('Development','Configuration','Settings','Storage')
# The web address of this module's project or support homepage.
ProjectUri = "https://github.com/PoshCode/Configuration"
# The web address of this module's license. Points to a page that's embeddable and linkable.
LicenseUri = "http://opensource.org/licenses/MIT"
# Release notes for this particular version of the module
ReleaseNotes = 'Added a new converter for ConsoleColor and fixed some ScriptAnalyzer warnings.'
# Indicates this is a pre-release/testing version of the module.
IsPrerelease = 'True'
}
}
}
Natalie Mars Piss Gangbang
Russian Granny Pissing Femdom
720 Model Anal
Tube Archer Japanese Mature Mom
Ru Tits Natural
An Alternative to npm Private Modules - Tom Spencer
Creating Public & Private Node Modules | Codementor
PowerShell Gallery | Private/Modules/Configuration ...
Option Private statement (VBA) | Microsoft Docs
Modules (since C++20) - cppreference.com
VBA Private vs Public Procedures (Subs & Functions ...
message_private/message_priv…
3 Ways To Hide & Call Hidden Macros In VBA - My ...
Steam Workshop::CZ Tier 1 Vehicle Pack - PRIVATE MOD…
1 Private Module























































































