Code Monkey home page Code Monkey logo

scaleway-lib's Introduction

scaleway

Codecov GitHub closed issues dependencies GitHub release (latest by date)

scaleway-lib

scaleway-lib is a set of NPM packages used at Scaleway.



Available packages

Development

Locally

$ git clone [email protected]:scaleway/scaleway-lib.git
$ cd scaleway-lib
$ pnpm install
$ # ... do your changes ...
$ pnpm run lint
$ pnpm run test

Link against another project (with yalc) => FAVORED

yalc is a tool aiming to simplify working with local npm packages by providing a different workflow than npm/yarn/pnpm link, hence avoiding most of their issues with module resolving.

$ pnpm install -g yalc # Make sure to have the yalc binary
$ cd scaleway-lib/packages/example_package
$ pnpm run build && yalc publish
$ # Now it's ready to install in your project
$ cd ../../../project-something
$ yalc add @scaleway/package-name
$ cd ../scaleway-lib/packages/example_package
$ # If you do some changes into your package
$ pnpm run build && yalc publish --push --sig # --push will automatically update the package on projects where it have been added, --sig updates the signature hash to trigger webpack update

⚠️ since 1.0.0.pre.51 (2021-04-23), yalc publish needs the --sig option to trigger webpack module actual update.

⚠️ yalc create a yalc.lock and updates the package.json in the target project. Make sure to not commit these changes

Link against another project (with pnpm link)

$ cd packages/example_package && pnpm link
$ cd - && pnpm run build # rebuild the package
$ # Now it's ready to link into your project
$ cd ../project-something
$ pnpm link @scaleway/example_package

Linting

$ pnpm run lint
$ pnpm run lint:fix

Unit Test

$ pnpm run test # Will run all tests
$ pnpm run test --updateSnapshot # Will update all snapshots
$ pnpm run test:watch # Will watch tests and only rerun the one who are modified
$ pnpm run test:coverage # Will generate a coverage report

Lerna

This project is managed with Lerna. Lerna is a tool to manage multiple NPM packages inside the same repository.

Lerna also allows us to use PNPM workspaces to manage our dependencies. This implies a few things:

  • devDependencies should be included in top package.json
  • There should be no node_modules or pnpm-lock.yml in sub-packages
  • There is a special syntax to manage sub-packages dependencies:
$ pnpm add -W -D new_dependency # Add a new devDependency to root project
$ cd packages/package_name && pnpm add new_dependency
$ cd packages/package_name && pnpm remove old_dependency

Notes

On build targets

We target by default Node@14 but you can add a browser output by adding a browser (you can find the spec here) target to your package.json.

  "browser": {
    "dist/module.js": "dist/module.browser.js"
  }

The browserlist we are currently using is available in the rollup.config.mjs

⚠️ Bear in mind that we do not currently support different entrypoint per target as we don't have the use case

On build outputs

We only output ESM modules. Please read this.

Compiled modules supports Node > 14, the last two versions of any browsers and any browsers with more than 1% of marketshare at the time of release.

On commits

We enforce the conventionnal commits convention in order to infer package bump versions and generate changelog.

On git hooks

We have a husky hook on pre-commit and pre-push which will ensure the file you committed matches the configured formating (eslint + prettier)

We also have one on commit-msg which will ensure you commit message respects our commit convention

We strongly encourage you not to but you can skip these hooks by passing --no-verify to your git commands

On versioning

We follow the semver semantic.

Contributing Guidelines

  • Ensure tests are still ok and code coverage have not decreased
  • Follow linter rules (tldr).
  • CI is enforced, you won't be able to merge unless pipeline is successful.

scaleway-lib's People

Contributors

adriengibrat avatar axel-kirk avatar baptistearno avatar chambo-e avatar cyclimse avatar dependabot[bot] avatar dorianmaliszewski avatar github-actions[bot] avatar johnrazeur avatar lawndlwd avatar matthprost avatar modulom avatar philibea avatar quiibz avatar rachidbensaid avatar renovate[bot] avatar sagotch avatar scaleway-bot avatar slashgear avatar vincentaudebert avatar vinzius avatar wrighbr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scaleway-lib's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json
Error type: The renovate configuration file contains some invalid settings
Message: packageRules: You have included an unsupported manager in a package rule. Your list: pnpm. Supported managers are: (ansible, ansible-galaxy, argocd, asdf, azure-pipelines, batect, batect-wrapper, bazel, bazelisk, bitbucket-pipelines, buildkite, bundler, cake, cargo, cdnurl, circleci, cloudbuild, cocoapods, composer, conan, deps-edn, docker-compose, dockerfile, droneci, fleet, flux, fvm, git-submodules, github-actions, gitlabci, gitlabci-include, gomod, gradle, gradle-wrapper, helm-requirements, helm-values, helmfile, helmsman, helmv3, hermit, homebrew, html, jenkins, jsonnet-bundler, kotlin-script, kubernetes, kustomize, leiningen, maven, meteor, mint, mix, nix, nodenv, npm, nuget, nvm, osgi, pip-compile, pip_requirements, pip_setup, pipenv, poetry, pre-commit, pub, puppet, pyenv, regex, ruby-version, sbt, setup-cfg, swift, tekton, terraform, terraform-version, terragrunt, terragrunt-version, tflint-plugin, travis, velaci, woodpecker).

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Pending Status Checks

These updates await pending status checks. To force their creation now, click the checkbox below.

  • chore(devdeps): update babel monorepo to v7.24.1 (@babel/eslint-parser, @babel/preset-react, @babel/preset-typescript)
  • chore(devdeps): update dependency @tsd/typescript to v5.4.3
  • fix(deps): update dependency @growthbook/growthbook-react to v0.26.0

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/changesets-renovate.yml
  • actions/checkout v4
  • pnpm/action-setup v3.0.0
.github/workflows/ci.yml
  • actions/checkout v4.1.1
  • pnpm/action-setup v3.0.0
  • actions/setup-node v4.0.2
  • actions/checkout v4.1.1
  • pnpm/action-setup v3.0.0
  • actions/setup-node v4.0.2
  • actions/checkout v4.1.1
  • pnpm/action-setup v3.0.0
  • actions/setup-node v4.0.2
  • codecov/codecov-action v4.1.0
  • ubuntu 22.04
  • ubuntu 22.04
  • ubuntu 22.04
.github/workflows/pull_request_title.yml
  • actions/checkout v4.1.1
  • pnpm/action-setup v3.0.0
  • actions/setup-node v4.0.2
  • ubuntu 22.04
.github/workflows/release.yml
  • actions/checkout v4.1.1
  • pnpm/action-setup v3.0.0
  • actions/setup-node v4.0.2
npm
package.json
  • @babel/core 7.24.3
  • @babel/eslint-parser 7.23.10
  • @babel/plugin-transform-runtime 7.24.3
  • @babel/preset-env 7.24.3
  • @babel/preset-react 7.23.3
  • @babel/preset-typescript 7.23.3
  • @changesets/changelog-github 0.5.0
  • @changesets/cli 2.27.1
  • @commitlint/cli 19.2.1
  • @commitlint/config-conventional 19.1.0
  • @jest/globals 29.7.0
  • @rollup/plugin-babel 6.0.4
  • @rollup/plugin-node-resolve 15.2.3
  • @testing-library/jest-dom 6.4.2
  • @testing-library/react 14.2.1
  • @tsd/typescript 5.3.3
  • @types/jest 29.5.12
  • @types/node 20.11.30
  • @types/react 18.2.67
  • @types/react-dom 18.2.22
  • builtin-modules 3.3.0
  • cross-env 7.0.3
  • eslint 8.57.0
  • husky 9.0.11
  • jest 29.7.0
  • jest-environment-jsdom 29.7.0
  • jest-junit 16.0.0
  • jest-localstorage-mock 2.4.26
  • jest-runner-tsd 6.0.0
  • lint-staged 15.2.2
  • mockdate 3.0.5
  • prettier 3.2.5
  • react 18.2.0
  • react-dom 18.2.0
  • read-pkg 9.0.1
  • rollup 4.13.0
  • rollup-plugin-dts 6.1.0
  • rollup-plugin-preserve-shebangs 0.2.0
  • rollup-plugin-visualizer 5.12.0
  • tsd-lite 0.8.2
  • typescript 5.4.2
  • wait-for-expect 3.0.2
  • node >=20.x
  • pnpm >=8.x
  • pnpm 8.15.5
packages/changesets-renovate/package.json
  • simple-git 3.22.0
  • node >=20.x
packages/cookie-consent/package.json
  • cookie 0.6.0
  • @types/cookie 0.6.0
  • react 18.2.0
  • react 18.x || 18
packages/eslint-config-react/package.json
  • @emotion/eslint-plugin 11.11.0
  • @typescript-eslint/eslint-plugin 7.3.0
  • @typescript-eslint/parser 7.3.0
  • eslint-config-airbnb 19.0.4
  • eslint-config-airbnb-typescript 18.0.0
  • eslint-config-prettier 9.1.0
  • eslint-plugin-deprecation 2.0.0
  • eslint-plugin-eslint-comments 3.2.0
  • eslint-plugin-import 2.29.1
  • eslint-plugin-jsx-a11y 6.8.0
  • eslint-plugin-react 7.34.1
  • eslint-plugin-react-hooks 4.6.0
  • eslint 8.57.0
  • typescript 5.4.2
  • eslint >= 8.5
packages/jest-helpers/package.json
  • @emotion/cache 11.11.0
  • @emotion/jest 11.11.0
  • @emotion/react 11.11.4
  • @testing-library/react 14.2.1
  • react 18.2.0
  • react-dom 18.2.0
  • react ^18.0.0 || 18
  • node >=20.x
packages/outdated-browser/package.json
  • node >=20.x
packages/random-name/package.json
  • node >=20.x
packages/regex/package.json
  • node >=20.x
packages/tsconfig/package.json
packages/use-dataloader/package.json
  • react 18.x
  • node >=20.x
packages/use-growthbook/package.json
  • @growthbook/growthbook-react 0.25.0
  • react 18.2.0
  • react 18.x
  • node >=20.x
packages/use-gtm/package.json
  • react 18.x || 18
  • node >=20.x
packages/use-i18n/package.json
  • @formatjs/ecma402-abstract 1.18.2
  • @formatjs/fast-memoize 2.2.0
  • date-fns 3.5.0
  • filesize 10.1.0
  • international-types 0.8.1
  • intl-messageformat 10.5.11
  • date-fns 3.x
  • react 18.x || 18
  • react-dom 18.x || 18
  • node >=18.x
packages/use-media/package.json
  • react 18.x
  • node >=20.x
packages/use-query-params/package.json
  • history 5.3.0
  • query-string 9.0.0
  • react 18.2.0
  • react-dom 18.2.0
  • react-router-dom 6.22.3
  • react 18.x || 18
  • react-dom 18.x || 18
  • react-router-dom ^6.0.0
  • node >=20.x
packages/use-random-name/package.json
  • react >=16.8
  • node >=20.x
packages/use-segment/package.json
  • @segment/analytics-next 1.66.0
  • use-deep-compare-effect 1.8.1
  • react 18.2.0
  • react 18.x || 18
  • node >=20.x
packages/use-storage/package.json
  • react >=18.0
  • node >=20.x
packages/validate-icu-locales/package.json
  • @formatjs/icu-messageformat-parser 2.7.6
  • globby 14.0.1
  • module-from-string 3.3.0
  • node >=20.x
packages_deprecated/countries/package.json

  • Check this box to trigger a request for Renovate to run again on this repository

@scaleway/changesets-renovate Ability to Skip the commit

Is your feature request related to a problem? Please describe.
We run a self hosted renovate bot and want to be able to run a "postUpgradeTasks" to create a changeset see below.

{
  "postUpgradeTasks": {
    "commands": [
         "npm i -g @scaleway/changesets-renovate && changesets-renovate",
    ]
  }
}

According to the doco we don't need to commit the modified files https://docs.renovatebot.com/configuration-options/#postupgradetasks

Describe the solution you'd like
I want the ability to be able skip the git commit steps within the changeset-renovate cli this could be either achieved by an environmental variable SKIP_COMMIT=TRUE changesets-renovate or cli changesets-renovate --skip-commit

Package random-name is tied up to React

Describe the bug
Random-name has the import import { useCallback } from 'react';, making it incompatible with non-React projects.

To Reproduce
Steps to reproduce the behavior:

  1. Install (yarn add @scaleway/random-name) in non-React project.
  2. Call function randomName()

Expected behavior
Working in a non-React project.

🙏

Add support for devcontainer

Is your feature request related to a problem? Please describe.

https://code.visualstudio.com/docs/remote/containers
It could allow contributor to use github codespaces easily with this repository

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

feat: fork docker-names internally

docker-names seems to not be supported anymore

Would be nice to fork the project internally to have typings and up to date names

We can also port our useRandomName hook in the @scaleway/random-name package

changesets-renovate includes private (not published) packages

Describe the bug

The script that generates the changeset manifest will include a private package in the list.

Changesets will then fail to run with:

🦋 error Error: "renovate-c2f96a3" changeset mentions a release for a package "@foo/bar" but such a package could not be found.

To Reproduce

  1. Touch a private file.
  2. Run the script.
  3. Observe that Markdown changeset includes the private package

Expected behavior

Do not include private packates.

Screenshots

N/A

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

This can often happen in a monorepo context, where the root packages (monorepo root) receives an updated dependency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.