leopardslab / nodecloud Goto Github PK
View Code? Open in Web Editor NEW:zap: The Node.js API for open cloud
License: MIT License
:zap: The Node.js API for open cloud
License: MIT License
Linked PR: #139
gh-pages
.Seems like the github secret is missing in the repo GITHUB_TOKEN: ${{ secrets.JSDoc_TOKEN }}
. .JSDoc_TOKEN
needs to be created in the project repository.
Shouldn't throw an error when a provider other than officially supported is used.
Stay in the know: Get notified of updates by clicking the πβπ¨ watch button and save the repository for later reference by clicking the βοΈ star button at the top right corner of this repo!
The readme
file of the nodecloud-next
branch contains some typo errors. To note some (typo error > correction),
These need to be corrected and if you identify more typo errors while reading, fix them as well. Feel free to add a comment for further clarifications!
master
and nodecloud-next
. This feature is required to the nodecloud-next
branch. so make sure that you create the feature branch from nodecloud-next
.nodecloud-next:
https://github.com/leopardslab/nodecloud/tree/nodecloud-next.
Be sure to sign up at https://hacktoberfest.digitalocean.com so you can qualify to pick a limited edition t-shirt π or plant a tree π³!
See https://hacktoberfest.digitalocean.com for more details.
Add a comment below if you are interested, will assign the task.
Writing unit test for transformer
NodeCloud Code generation tool
Service comparison should be updated as there might be many updates in services in different providers.
Take Codacy suggestions into account and make necessary changes to improve the code quality.
In nodecloud/lib/core/base-provider.js, we process the input of .nc.config.js like this
ncConfig.map(provider => {
const module = provider.plugin;
providersToLoad[provider.tag] = module(ncConfig.configPath);
});
But shouldn't it be
ncConfig.map(provider => {
const module = provider.plugin;
providersToLoad[provider.tag] = module(provider.configPath);
});
Because ncConfig is an array of providers. So ncConfig.configPath = undefined
That's why we map the providers and it should be provider.configPath
and it works that way too. The path is passed to the plugins when we use the latter approach.
@Cheesetouched can you remove .DS_STORE file in /lib.
Hello everyone I am full-stack web developer in MERN and MEAN with a specialisation in Node Js. I also have knowledge of Docker,AWS and Azure I would like to contribute to Score Labs . I have been contributing to open source from past 2 yrs
I am aiming to contribute to Project No.10 - NodeCloud - Rackspace Provider - Services as I have all the prerequisites for the project. I would be highly grateful if I could get a start to contribute to Score labs
NodeCloud package
Linked PR: #138
After moving all plugin tests to respective plugins.
Related: #13
.nc.config.js
is configured in the project root.Error: Cannot find module 'd:\node-cloud-demo\scripts\.nc.config'
(A quick patch was to copy the .nc.config.js
to the sub folder where I needed the package )E.g. -
Node cloud working fine on root directory files
Node cloud crashing on sub directory files
Node cloud working fine on sub directory files after copying .nc.config.js
to subdirectory
process.cwd()
to get the current working directory to configure the ncConfig const ncConfig = require(path.join(process.cwd(), ".nc.config"));
, In a sub-directory the .nc.config
won't be there in the current directory.Project-demo
β node_modules
β .nc.config.js
β package.json
β package-lock.json
β index.js ----------------------------- Node cloud works fine here
β
β
ββββ scripts
β tester.js -------------------------- Node cloud throws an error here
1.0.0-beta.1
node version 12
Tests need to be moved to the respective plugins.
Change to new getProviders
API.
Current documentation doesn't explain the vocabulary of NodeCloud in a convenient manner. New users should be able to use the services without going through extra hassle to find the matching services in cloud providers and NodeCloud APIs.
A documentation page can be created with the vocabulary of current set of APIs in NodeCloud matched with vocabulary of the cloud providers.
After Introducing the getProviders
function the AWS ec2 example hasn't been updated. The KeyName
parameter was missing in the params object of the create AWS EC2 instance example which is in read me .
const optionsProvider = {
overrideProviders: false
};
const ncProviders = nodeCloud.getProviders(optionsProvider);
const ec2 = ncProviders.aws.compute(options);
const ncAWS = nodeCloud.getProvider("AWS", process.env.ncconf);
const ec2 = ncAWS.compute(options);
The Nodecloud base-provider.js needs to instantiate and require each and every provided plugin module via the getProvider
method
After modifying the nodecloud base-provider.js
module below. It works just fine
/**
Returns requested provider type
@param {Object} {provider - Type of provider - can be found here '/aws/provider'}
*/
getProviders(options) {
if (ncConfig === undefined) {
throw new Error(
"Provider config file not found. Please create a config file in project root."
);
}
let providersToLoad = {};if (options && options.hasOwnProperty("overrideProviders") ) { ncConfig.map(provider => { const module = provider.plugin; providersToLoad[provider.tag] = module(ncConfig.configPath); }); } else { ncConfig.map(provider => { if (!validProviders.includes(provider.name)) { throw new Error("Provider not supported"); } const module = require(provider.libName); providersToLoad[provider.tag] = new module(ncConfig.configPath); }); }
The current NodeCloud base-provider.js
isn't compatible with NodeCLoud-Azure-Plugin, It throws error each and every time I try to start nodecloud-web
The below snippet of code is buggy and it throws error
/**
- Returns requested provider type
- @param {Object} {provider - Type of provider - can be found here '/aws/provider'}
*/
getProviders(options) {
if (ncConfig === undefined) {
throw new Error(
"Provider config file not found. Please create a config file in project root."
);
}let providersToLoad = {}; if (option && options.hasOwnProperty("overrideProviders")) { ncConfig.map(provider => { const module = provider.plugin; providersToLoad[provider.tag] = module(provider.configPath); }); } else { ncConfig.map(provider => { if (!validProviders.includes(provider.name)) { throw new Error("Provider not supported"); } const module = provider.plugin; providersToLoad[provider.tag] = module(provider.configPath); }); } return providersToLoad;
}
A screenshot of existing code and error
Follow Nodecloud-web installation guide
https://github.com/cloudlibz/nodecloud-web
assert
and done()
is not defined which will through a TypeError: Cannot read property of undefined
, assert
should be defined and the done()
function should be specified or called through a relevant instance.
dynamoDB.createItem(params).then((res) => {
assert.equal(res.ConsumedCapacity.TableName, "Test");
done();
});
NodeCloud code generator
More unit tests should be added to cover the core logic. i.e: /lib/core
Linked PR: #138
Lib should work
It fails to run
examples
Linked PR: #144
Linked PR: #139
Linked PR: #139
Linked PR: #139
NodeCloud code generator
Writing unit tests for the parser
NodeCloud Code generation tool
NodeCloud code generator
Addition of ESLint (as static code analyser) and prettier (to enforce code styles via a configuration file) .
Currently, the code base does not employ any methods for standardising code quality and consistency across multiple contributors. This can be achieved via the addition of ESLint and prettier respectively. This will completely remove changes that do not pertain to changes in logic across PRs. This issue was apparent because my existing prettier config in vscode was in conflict with the existing code practices in NodeCloud and even a minor change went ahead and formatted the entire file, this will reduce the readability for project maintainers in pull requests.
Adds a default coding style and removes unnecessary changes in code in multiple PRs across multiple contributors. For example, switching between single and double quotes across multiple PRs in the same code segment. Additionally, the formatter used currently is pretty-quick with no configuration file present, because of this #109 is required, although this is not feasible as the number of contributors in the project increases and should be automated before a commit. Additionally, best practices should be enforced via the use ESLint which can be updated as required via a config file.
Attaching instances of apparent inconsistencies
misconfiguration of the formatter
In each commit, the pretty-quick
script is run by husky, and this takes the default config of prettier set in the user's vscode, due to this an entire file gets formatted even when there is no major change in it, makes the process of reviewing changes difficult.
Additional conflicting linting rules with respect to imports, implicit any
types and empty function definitions, all these are sources of potential bugs in future and can be avoided by using eslint and enforcing consistent practices.
Writing Unit test for generator
NodeCloud code generation tool
FIX: #5
We Expected to see the successful working of npm start, after setting up an app with nodecloud module
1.Make a new nodeJS project by npm init
2. Inside your package.json, add nodecloud module "dependencies": { "nodecloud": "^0.1.0" }
3. Install dependencies bynpm install
4. Get a GCP key (link is given on the https://github.com/cloudlibz/nodecloud-gcp-plugin), download the key.json file and place it into your root folder.
4.In your server.js (or your mainjsfile.js), include nodecloud module by typing in:
const nodeCloud = require("nodecloud");
// AWS
const gcpProviders = nodeCloud.getProviders('google', 'dronesym-app-ceabf26a2a7e.json');
const options = {
apiVersion: "2016-11-15"
};
console.log(gcpProvider);
const providers = [
{
name: 'google',
tag: 'google',
libName: 'nodecloud-gcp-plugin',
configFile: {
projectId: "<your project ID>", //most probably will be "dronesym-app"
keyFilename: "<path to your GCP Key JSON file>"
//GCP gives you the download of a pre-built key JSON file
}
},
// other providers might be included here
]
module.exports = providers;
node <yourfile>.js
===x===
Me and @TheLukaszNs were discussing nodecloud related stuff on the gitter channel, When we both noticed an error on the same time, the code was simple, it just had to console.log(getProvider);
But changing getProvider() to getProviders() (as mentioned in readme.MD) would stop our code execution giving the above error. I've provided a fix for this^
Linked PR: #141
Stay in the know: Get notified of updates by clicking the πβπ¨ watch button and save the repository for later reference by clicking the βοΈ star button at the top right corner of this repo!
Prettier is a very popular code formatter to format your code and prevent the ongoing debates about code styles. Currently, prettier is triggered through a pre-commit hook (husky) which will run Prettier on the staged files prior to committing.
This works well in most cases, but there are certain cases where the code might not be formatted:
Running git commit --no-verify
will commit code without running pre-commit hooks which can result in files not being formatted.
Pre-commit hook (husky) is not properly installed in the developers local machine.
To automate this process you can use git auto-commit action to run prettier and commit the changes if necessary. Check out the references to get started π!
master
and nodecloud-next
. This feature is required to the nodecloud-next
branch. so make sure that you create the feature branch from nodecloud-next
.nodecloud-next:
https://github.com/leopardslab/nodecloud/tree/nodecloud-next
Be sure to sign up at https://hacktoberfest.digitalocean.com so you can qualify to pick a limited edition t-shirt π or plant a tree π³!
See https://hacktoberfest.digitalocean.com for more details
Helping article and sample project by @mskelton
The package version of nodecloud hasn't been updated since its creation - that makes some mess around documentation, as the code shown in documentation is newer than what we can use with NPM module!
Owner of this NPM package should bump the version to update the module π
Tests should be updated to .getProviders()
API.
eg: .getProviders().aws
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.