Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
@aitmed/cloudobjectstorage
Advanced tools
> Note: this boilerplate is not intended for react applications. You need to extend this boilerplate with additional configurations if you want this to bundle out to a react library components.
Readme
Note: this boilerplate is not intended for react applications. You need to extend this boilerplate with additional configurations if you want this to bundle out to a react library components.
Put all .js
or .ts
files in src/
directory and make sure they are exported using src/index.ts
. There are a couple of ways to export things out to the output bundle depending on how you want devs to use your library.
For example, for a directory like this:
src
createS3Object.ts
deleteS3Object.ts
updateS3Object.ts
makeRequest.ts
index.ts
Your index.ts
file should look like this:
export { default as createS3Object } from './createS3Object'
export { default as deleteS3Object } from './deleteS3Object'
export { default as updateS3Object } from './updateS3Object'
export { default as makeRequest } from './makeRequest'
When you npm run build
, it will generate files into the ./dist
directory. This dist
directory will be imported in JavaScript applications like this:
import { createS3Object, makeRequest } from 'js-sdk-boilerplate'
function callSomeApi() {
const req = makeRequest()
return createS3Object(...).then(...).catch(...)
}
If you want developers to import it and use it like this:
import aitmedSdk from 'js-sdk-boilerplate'
function callSomeApi() {
const req = aitmedSdk.makeRequest()
return aitmedSdk.createS3Object(...).then(...).catch(...)
}
Then the index.ts
file above will not work. You will have to export it differently like this so that it exports a main object:
src/index.ts
import createS3Object from './createS3Object'
import deleteS3Object from './deleteS3Object'
import updateS3Object from './updateS3Object'
import makeRequest from './makeRequest'
// This main object will be exported
export default {
createS3Object,
deleteS3Object,
updateS3Object,
makeRequest,
}
You can also make a main object to be exported out by just directly importing and exporting the target file back out:
src/index.ts
export { default } from './someMethodOrSomething'
src/someMethodOrSomething.ts
function someMethod() {
console.log('hello')
return null
}
export default someMethod
Devs can then use the main object like this in their apps:
import someMethodOrWhatever from '@aitmed/js-sdk-boilerplate'
When you want to publish to NPM, type in npm publish
and it will publish the library to NPM.
Since this repo was created using a scope, it should already be private only to NPM users who are members of the aitmed organization on NPM.
The name of this repo is currently @aitmed/js-sdk-boilerplate
and that will be the name the devs will import from in their applications, which is probably what you don't want. Try changing the name
property in package.json
to some name of your choice after the aitmed
part like this:
{
"name": "@aitmed/my-custom-sdk",
"version": "1.0.0",
...
}
To make the package free to the public, instead of typing npm publish
in the CLI you do this:
npm publish --access public
For including typescript definition files coming from outside the repo, try putting them in src/types
and adding that path to typeRoots
or types
in the tsconfig.json
file (not sure if this will work).
Package | Description |
---|---|
dotenv | Loads environment variables from .env for nodejs projects. |
mocha | Test runner. |
chai | Test matchers. |
dotenv
.gitignore
).env
file in this format: MY_ENV_VARIABLE=MY_ENV_VARIABLE_VALUE
mocha
chai
FAQs
> Note: this boilerplate is not intended for react applications. You need to extend this boilerplate with additional configurations if you want this to bundle out to a react library components.
The npm package @aitmed/cloudobjectstorage receives a total of 10 weekly downloads. As such, @aitmed/cloudobjectstorage popularity was classified as not popular.
We found that @aitmed/cloudobjectstorage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.