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.
@plandek-utils/time-utils
Advanced tools
Changelog
Readme
@plandek-utils/time-utils
TypeDoc generated docs in here
small utils for managing Time, supported by Dayjs
. It is intended to be used in tests.
yarn add @plandek-utils/time-utils
or npm install @plandek-utils/time-utils
.
it requires timekeeper
and Dayjs
we get 2 functions:
freezeTime(time, fn)
: freezes time to the given one, executes the given function, and resets the time before returning the result of that execution.freezeTimeAwait(time, asyncFn)
: same as freezeTime()
but expects an async function, and it waits for its return before resetting the time// assume now is "2019-03-21T12:21:13.000Z"
function renderTime() {
const d = new Date()
console.log(d.toISOString())
}
renderTime() // => logs "2019-03-21T12:21:13.000Z"
const time = new Date("2018-01-02T13:14:15.123Z")
const res = freezeTime(time, () => { renderTime(); return 'blah' }) // => logs "2018-01-02T13:14:15.123Z"
console.log(res) // => logs 'blah' (freezeTime() returns the result of the passed function)
renderTime() // => logs "2019-03-21T12:21:13.010Z" (time is unfrozen, let's say that a 10ms have passed)
See The Typescript-Starter docs.
For commits, you should use commitizen
yarn global add commitizen
#commit your changes:
git cz
As typescript-starter docs state:
This project is tooled for conventional changelog to make managing releases easier. See the standard-version documentation for more information on the workflow, or CHANGELOG.md
for an example.
# bump package.json version, update CHANGELOG.md, git tag the release
yarn run version
You may find a tool like wip
helpful for managing work in progress before you're ready to create a meaningful commit.
Once you are ready to create the first version, run the following (note that reset
is destructive and will remove all files not in the git repo from the directory).
# Reset the repo to the latest commit and build everything
yarn run reset && yarn run test && yarn run doc:html
# Then version it with standard-version options. e.g.:
# don't bump package.json version
yarn run version -- --first-release
# Other popular options include:
# PGP sign it:
# $ yarn run version -- --sign
# alpha release:
# $ yarn run version -- --prerelease alpha
And after that, remember to publish the docs.
And finally push the new tags to github and publish the package to npm.
# Push to git
git push --follow-tags origin master
# Publish to NPM (allowing public access, required if the package name is namespaced like `@somewhere/some-lib`)
yarn publish --access public
yarn run doc:html && yarn run doc:publish
This will generate the docs and publish them in github pages.
There is a single yarn command for preparing a new release. See One-step publish preparation script in TypeScript-Starter
# Prepare a standard release
yarn prepare-release
# Push to git
git push --follow-tags origin master
# Publish to NPM (allowing public access, required if the package name is namespaced like `@somewhere/some-lib`)
yarn publish --access public
FAQs
small utils for managing Time, supported by Dayjs. It is intended to be used in tests.
The npm package @plandek-utils/time-utils receives a total of 510 weekly downloads. As such, @plandek-utils/time-utils popularity was classified as not popular.
We found that @plandek-utils/time-utils demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.