Skip to content

Commit

Permalink
Rebase on Master add Preconstruct Cli Tool (#96)
Browse files Browse the repository at this point in the history
* Update generated SDKs (#68)

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

Co-authored-by: Auto Mation <automation@commercetools.com>

* chore(release): releasing component

 - @commercetools/history-sdk@1.15.0
 - @commercetools/importapi-sdk@1.15.0
 - @commercetools/ml-sdk@1.15.0
 - @commercetools/platform-sdk@1.15.0

* Update generated SDKs (#82)

* TASK: Updating Platform SDK

* Adding Generated Request builder unit tests (#83)

* improvement: Adding Generated unit tests of Request builders

* Update generated SDKs (#84)

* TASK: Updating Platform SDK
* Adding unit test for the request builders

* chore(release): releasing component

 - @commercetools/history-sdk@1.16.0
 - @commercetools/importapi-sdk@1.16.0
 - @commercetools/ml-sdk@1.16.0
 - @commercetools/platform-sdk@1.16.0

* Update generated SDKs (#86)

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

Co-authored-by: Auto Mation <automation@commercetools.com>

* chore(release): releasing component

 - @commercetools/history-sdk@1.17.0
 - @commercetools/importapi-sdk@1.17.0
 - @commercetools/ml-sdk@1.17.0
 - @commercetools/platform-sdk@1.17.0

* chore: setup changesets and release workflow (#91)

* chore: setup changesets and release workflow

* docs: update readmes

* chore(ci): use yarn cache

* Version Packages (#92)

* ci(changesets): version packages

* chore: regenerate lockfile

* fix(ci): build platform-sdk before running tests

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Nicola Molinari <nicola.molinari@commercetools.com>

* Update generated SDKs (#94)

* TASK: Updating Platform SDK

* TASK: Updating Platform SDK

* Create metal-bees-type.md

Co-authored-by: Auto Mation <automation@commercetools.com>
Co-authored-by: Jens Schulze <jens.schulze@commercetools.com>

* Improve monorepo setup and tooling (#93)

* chore: improve monorepo setup and tools to develop and build packages

* chore(ci): use node 14

* docs: add contributing and update readme

* docs: changeset

* fix: command

* chore(ci): also build packages

* feat(sdk-client): build the typescript sdk-client

* feat(sdk-middleware-auth): build out the sdk middleware auth

* feat(middleware-http): add the http middleware for the clent-sdk

* feat(typescript-client-sdk): build typescript sdk client
- add typescript client
- add auth middleware
- add http middleware
- include test coverage report

* chore(test): increase the timeout for time consuming tests in ml package

* Chore(client-sdk): Refactor SDK Dependencies (#80)

* chore(client-sdk): refactor as dependencies into a single client package

* chore(middleware): abstract all middleware builder functions
- refactor code to abstract the auth middleware
- refactor code to abstract the http middleware
- write test for the new refactored code

* chore(tests): debug tests to isolate issues causing circleci to fail

* debugging circleci

* debugging circleci error

* debugging circleci error

* debugging circleci errors

* chore(tsconfig): use existing tsconfig.json configurations from existing (history) package

* fix OOM issue on cicleci

* chore(sdk-client): refactor entire all middleware package into sdk-client package
- add a builder class
- add all sdk-middleware
- remove unwanted comments and code blocks

* chore(auth-middlewares): add other authentication middlewares methods to the build class

* refactor middleware order and auth methods

* refactor(ClientBuilder): rename ApiRootBuilder to ClientBuilder

refactor ClientBuilder to return the client only

* rewrite tests to conform with new ClientBuilder class

* chore(client-builder): remove the private identifier from the withMiddleware method.

Co-authored-by: Jens Schulze <jenschude@gmail.com>

* fix(usr-agent): fix user agent to conform with the new format (#87)

* chore(preconstruct): rebase the develop on master branch and include preconstruct

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Auto Mation <automation@commercetools.com>
Co-authored-by: Michele George <michele.george@commercetools.de>
Co-authored-by: Michele George <30607195+MicheleRezk@users.noreply.github.com>
Co-authored-by: Nicola Molinari <nicola.molinari@commercetools.com>
Co-authored-by: CT Release Bot <24736072+ct-release-bot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jens Schulze <jens.schulze@commercetools.com>
Co-authored-by: Jens Schulze <jenschude@gmail.com>
  • Loading branch information
10 people authored Aug 19, 2021
1 parent 606c28e commit 4d668b2
Show file tree
Hide file tree
Showing 472 changed files with 29,182 additions and 1,478 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
8 changes: 8 additions & 0 deletions .changeset/brown-boats-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@commercetools/history-sdk': minor
'@commercetools/importapi-sdk': minor
'@commercetools/ml-sdk': minor
'@commercetools/platform-sdk': minor
---

Update development tooling and monorepo setup.
13 changes: 13 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "commercetools/commercetools-sdk-typescript"
}
],
"commit": false,
"linked": [["@commercetools/*"]],
"access": "restricted",
"baseBranch": "master"
}
8 changes: 8 additions & 0 deletions .changeset/metal-bees-type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@commercetools/history-sdk": patch
"@commercetools/importapi-sdk": patch
"@commercetools/ml-sdk": patch
"@commercetools/platform-sdk": minor
---

Update generated SDKs
62 changes: 43 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,75 @@
aliases:
- &ml_ts_sdk ~/commercetools-typescript-sdk
- &working_directory ~/commercetools-typescript-sdk

version: 2.1
- &restore_yarn_cache
name: 'Restoring yarn cache'
keys:
- v1-yarn-cache-{{ checksum "yarn.lock" }}

- &save_yarn_cache
name: 'Saving yarn cache'
key: v1-yarn-cache-{{ checksum "yarn.lock" }}
# Persisting to the workspace is always relative to the root which is our working directory.
# https://circleci.com/docs/2.0/configuration-reference/#persist_to_workspace
paths:
- .cache
- node_modules

executors:
node_14:
docker:
- image: cimg/node:14.17.4

version: 2.1
jobs:
build_and_test:
working_directory: *ml_ts_sdk
docker:
- image: node:12.22.1
executor: node_14
working_directory: *working_directory
steps:
- checkout
- restore_cache: *restore_yarn_cache
- run:
name: install dependencies
command: yarn install
name: Installing dependencies
command: yarn install --frozen-lockfile
- save_cache: *save_yarn_cache
- run:
name: test
name: Building packages
command: yarn build
- run:
name: Running tests
command: yarn test
- store_artifacts:
path: packages/ml-sdk/test-results
prefix: tests
- store_artifacts:
path: packages/platform-sdk/test-results
prefix: tests
- store_test_results:
- store_test_results:
path: packages/ml-sdk/test-results
- store_test_results:
- store_test_results:
path: packages/platform-sdk/test-results

update_ml_sdk_from_spec:
executor: node_14
working_directory: ~/commercetools-typescript-spec
docker:
- image: node:12.22.1
steps:
- checkout
- run:
name: configure git
name: Configure git
command: git config --global user.email "$GIT_AUTHOR_EMAIL" && git config --global user.name "$GIT_AUTHOR_NAME"
- add_ssh_keys:
fingerprints:
- "bd:28:56:34:9d:80:55:fb:74:c4:1f:9d:f4:4e:f1:4b"
- run:
name: Install java
name: Installing Java
command: apt update && apt install default-jre -y
- run:
name: install rmf cli
name: Installing RMF cli
command: export VRAP_VERSION=1.0.0-20200304142749 && curl -o- -s https://raw.githubusercontent.com/vrapio/rmf-codegen/master/scripts/install.sh | bash
- restore_cache: *restore_yarn_cache
- run:
name: install yarn
command: yarn install && yarn bootstrap
name: Installing dependencies
command: yarn install --frozen-lockfile
- save_cache: *save_yarn_cache

workflows:
version: 2
validate_spec:
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Pass a personal access token (using our `ct-release-bot` account) to be able to trigger
# other workflows
# https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token
# https://github.saobby.my.eu.orgmunity/t/action-does-not-trigger-another-on-push-tag-action/17148/8
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}

- name: Read .nvmrc
run: echo ::set-output name=NVMRC::$(cat .nvmrc)
id: nvm

- name: Setup Node (uses version in .nvmrc)
uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvm.outputs.NVMRC }}'

- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
email=npmjs@commercetools.com
//registry.npmjs.org/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Building packages
run: yarn build

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@master
with:
publish: yarn changeset publish
version: yarn changeset:version-and-format
commit: 'ci(changesets): version packages'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock*

# Env files
*.env
# Dependencies
Expand Down
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
14
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CHANGELOG.md
12 changes: 3 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,19 @@
"semi": false,
"trailingComma": "es5",
"singleQuote": true,
"parser": "babel-flow",
"parser": "typescript",
"overrides": [
{
"files": "*.ts",
"files": "*.json",
"options": {
"parser": "typescript"
"parser": "json"
}
},
{
"files": "*.md",
"options": {
"parser": "markdown"
}
},
{
"files": "*.json",
"options": {
"parser": "json"
}
}
]
}
84 changes: 84 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Contributing

Hi, thanks for taking an interest in contributing to the **TypeScript SDK** repository. We welcome any kind of contribution, from reporting issues or idea to submitting pull requests for bug fixes, improvements, new features, etc.

Please take a moment to review this document in order to make the contribution process straightforward and effective for everyone involved.

## Core ideas

The repository primarily contains SDK packages in TypeScript generated from the commercetools platform API reference.

## Repository structure

This repository is managed as a monorepo, meaning it contains multiple (sub)packages located in the [`packages`](./packages) directory.

```
packages/
...
```

### Development tools

At commercetools we use the following development tools:

#### Yarn

We use [Yarn workspaces](https://classic.yarnpkg.com/en/docs/workspaces/) to manage dependencies between multiple packages.

#### Jest

We use [Jest](https://jestjs.io/) as the main framework for testing. Additionally, we take advantage of the Jest runners to run other tasks such as ESLint.

#### Prettier

We rely on [Prettier](https://prettier.io/) to consistently format our code.

#### TypeScript

We prefer to implement our UI components using [TypeScript](https://www.typescriptlang.org/). This has the benefit of provide packages with type declarations, thus a better developer experience, but also to have the codebase more maintainable and less error-prone.

#### Preconstruct

We rely on [Preconstruct](https://preconstruct.tools/) to build the packages.

#### Commitlint

Commit messages should follow a [conventional commit format](https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional).

## Opening an Issue

In general, it's a good idea to open an issue first, no matter if it's a bug report, a new feature, etc. Doing so allows maintainers and other contributors to be aware of the context when an associated pull request is provided. It also gives a chance to provide early feedback and suggestions on what the pull request should focus on and what the expectations, avoiding unnecessary work during a pull request.

## Submitting a Pull Request

Good pull requests, such as patches, improvements, and new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits.

If possible, please try to provide a [related issue first](#opening-an-issue), where the topic is discussed and agreed upon before starting to work on that. This is helpful for both you and the maintainers to be familiar with the changes beforehand.

## Getting started

1. Clone the repository.
2. Run `yarn` in the root folder to install the dependencies.

Some useful commands to work with the repository:

- `yarn test` and `yarn test --watch`
- `yarn typecheck`
- `yarn build`

## Adding changesets

commercetools sdk-typescript uses [changesets](https://github.com/atlassian/changesets) to do versioning and creating changelogs.

As a contributor you need to add a changeset by running `yarn changeset`.
The command will prompt to select the packages that should be bumped, their associated semver bump types and some markdown which will be inserted into the changelogs.

When opening a Pull Request, a `changeset-bot` checks that the Pull Request contains a changeset. A changeset is **NOT required**, as things like documentation or other changes in the repository itself generally don't need a changeset.

## Releasing packages

commercetools sdk-typescript uses [changesets](https://github.com/atlassian/changesets) to do versioning and publishing a release.

A [Changesets release GitHub Action](https://github.com/changesets/action) opens a `Version Packages` Pull Request whenever there are some changesets that have not been released yet.

When the `Version Packages` Pull Request gets merged, the Changesets release GitHub Action will automatically trigger the release.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ prettify: yarn_install
yarn run format

post_process: yarn_install
yarn run lerna run post_process_generate
yarn manypkg run post_process_generate

codegen_install:
curl -o- -s https://raw.githubusercontent.com/vrapio/rmf-codegen/master/scripts/install.sh | bash
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# commercetools typescript sdks

<img src="http://dev.commercetools.com/assets/img/CT-logo.svg" width="550px" alt="CT-logo"></img>
<h2 align="center">commercetools TypeScript SDKs 💅</h2>
<p align="center">
<i>✨ Monorepository with generated TypeScript SDKs for the commercetools platform 🛠</i>
</p>

## Introduction

This repository contains the commercetools platform, import-api and machine learning packages for typescript generated from our api reference.

<p align="center">

</p>
This repository contains several SDK packages generated from the commercetools platform API reference.

## Support

Expand All @@ -23,10 +20,13 @@ If you have any urgent issues regarding this repository please create a support
| [`platform-sdk`](/packages/platform-sdk) | [![platform-sdk Version][platform-sdk-icon]][platform-sdk-version] |
| [`importapi-sdk`](/packages/importapi-sdk) | [![importapi-sdk Version][importapi-sdk-icon]][importapi-sdk-version] |
| [`ml-sdk`](/packages/ml-sdk) | [![ml-sdk Version][ml-sdk-icon]][ml-sdk-version] |
| [`history-sdk`](/packages/history-sdk) | [![history-sdk Version][history-sdk-icon]][history-sdk-version] |

[platform-sdk-version]: https://www.npmjs.com/package/@commercetools/platform-sdk
[platform-sdk-icon]: https://img.shields.io/npm/v/@commercetools/platform-sdk.svg?style=flat-square
[importapi-sdk-version]: https://www.npmjs.com/package/@commercetools/platform-sdk
[importapi-sdk-icon]: https://img.shields.io/npm/v/@commercetools/platform-sdk.svg?style=flat-square
[ml-sdk-version]: https://www.npmjs.com/package/@commercetools/platform-sdk
[ml-sdk-icon]: https://img.shields.io/npm/v/@commercetools/platform-sdk.svg?style=flat-square
[importapi-sdk-version]: https://www.npmjs.com/package/@commercetools/importapi-sdk
[importapi-sdk-icon]: https://img.shields.io/npm/v/@commercetools/importapi-sdk.svg?style=flat-square
[ml-sdk-version]: https://www.npmjs.com/package/@commercetools/ml-sdk
[ml-sdk-icon]: https://img.shields.io/npm/v/@commercetools/ml-sdk.svg?style=flat-square
[history-sdk-version]: https://www.npmjs.com/package/@commercetools/history-sdk
[history-sdk-icon]: https://img.shields.io/npm/v/@commercetools/history-sdk.svg?style=flat-square
7 changes: 7 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* @type {import('@babel/core').TransformOptions}
*/
module.exports = {
presets: ['@babel/env', '@babel/preset-typescript'],
plugins: ['@babel/proposal-class-properties'],
}
Loading

0 comments on commit 4d668b2

Please sign in to comment.