Skip to content

Commit 595c1b7

Browse files
Merge pull request #4 from GitbookIO/release-please--branches--main--changes--next--components--lightswitch-api
release: 0.1.0-alpha.1
2 parents 2696c9f + 55caa8d commit 595c1b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+8737
-1565
lines changed

.devcontainer/Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# syntax=docker/dockerfile:1
2+
FROM debian:bookworm-slim AS stainless
3+
4+
RUN apt-get update && apt-get install -y \
5+
nodejs \
6+
npm \
7+
yarnpkg \
8+
&& apt-get clean autoclean
9+
10+
# Ensure UTF-8 encoding
11+
ENV LANG=C.UTF-8
12+
ENV LC_ALL=C.UTF-8
13+
14+
# Yarn
15+
RUN ln -sf /usr/bin/yarnpkg /usr/bin/yarn
16+
17+
WORKDIR /workspace
18+
19+
COPY package.json yarn.lock /workspace/
20+
21+
RUN yarn install
22+
23+
COPY . /workspace

.devcontainer/devcontainer.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
3+
{
4+
"name": "Debian",
5+
"build": {
6+
"dockerfile": "Dockerfile"
7+
}
8+
9+
// Features to add to the dev container. More info: https://containers.dev/features.
10+
// "features": {},
11+
12+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
13+
// "forwardPorts": [],
14+
15+
// Configure tool-specific properties.
16+
// "customizations": {},
17+
18+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
19+
// "remoteUser": "root"
20+
}

.eslintrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
plugins: ['@typescript-eslint', 'unused-imports', 'prettier'],
4+
rules: {
5+
'no-unused-vars': 'off',
6+
'prettier/prettier': 'error',
7+
'unused-imports/no-unused-imports': 'error',
8+
'no-restricted-imports': [
9+
'error',
10+
{
11+
patterns: [
12+
{
13+
group: ['lightswitch-api', 'lightswitch-api/*'],
14+
message: 'Use a relative import, not a package import.',
15+
},
16+
],
17+
},
18+
],
19+
},
20+
overrides: [
21+
{
22+
files: ['tests/**', 'examples/**'],
23+
rules: {
24+
'no-restricted-imports': 'off',
25+
},
26+
},
27+
],
28+
root: true,
29+
};

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
- next
10+
11+
jobs:
12+
lint:
13+
name: lint
14+
runs-on: ubuntu-latest
15+
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Set up Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '18'
24+
25+
- name: Bootstrap
26+
run: ./scripts/bootstrap
27+
28+
- name: Check types
29+
run: ./scripts/lint
30+
31+
build:
32+
name: build
33+
runs-on: ubuntu-latest
34+
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Set up Node
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '18'
43+
44+
- name: Bootstrap
45+
run: ./scripts/bootstrap
46+
47+
- name: Check build
48+
run: ./scripts/build
49+
test:
50+
name: test
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Set up Node
57+
uses: actions/setup-node@v4
58+
with:
59+
node-version: '18'
60+
61+
- name: Bootstrap
62+
run: ./scripts/bootstrap
63+
64+
- name: Run tests
65+
run: ./scripts/test
66+

.github/workflows/publish-npm.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow is triggered when a GitHub release is created.
2+
# It can also be run manually to re-publish to NPM in case it failed for some reason.
3+
# You can run this workflow by navigating to https://www.github.com/GitbookIO/lightswitch/actions/workflows/publish-npm.yml
4+
name: Publish NPM
5+
on:
6+
workflow_dispatch:
7+
8+
release:
9+
types: [published]
10+
11+
jobs:
12+
publish:
13+
name: publish
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version: '18'
23+
24+
- name: Install dependencies
25+
run: |
26+
yarn install
27+
28+
- name: Publish to NPM
29+
run: |
30+
bash ./bin/publish-npm
31+
env:
32+
NPM_TOKEN: ${{ secrets.LIGHTSWITCH_NPM_TOKEN || secrets.NPM_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release Doctor
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
workflow_dispatch:
7+
8+
jobs:
9+
release_doctor:
10+
name: release doctor
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'GitbookIO/lightswitch' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Check release environment
18+
run: |
19+
bash ./bin/check-release-environment
20+
env:
21+
NPM_TOKEN: ${{ secrets.LIGHTSWITCH_NPM_TOKEN || secrets.NPM_TOKEN }}
22+

.gitignore

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
node_modules/
2-
.env
1+
.prism.log
2+
node_modules
3+
yarn-error.log
4+
codegen.log
5+
Brewfile.lock.json
6+
dist
7+
dist-deno
8+
/*.tgz
9+
.idea/
10+

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CHANGELOG.md
2+
/ecosystem-tests/*/**
3+
/node_modules
4+
/deno
5+
6+
# don't format tsc output, will break source maps
7+
/dist

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "always",
3+
"experimentalTernaries": true,
4+
"printWidth": 110,
5+
"singleQuote": true,
6+
"trailingComma": "all"
7+
}

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.1.0-alpha.1"
3+
}

.stats.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
configured_endpoints: 7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lightswitch%2Flightswitch-6dc2430da32f769677553172dba258ce0d23e8a260f803a5667d344159e8f57a.yml

Brewfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
brew "node"

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Changelog
2+
3+
## 0.1.0-alpha.1 (2025-02-05)
4+
5+
Full Changelog: [v0.0.1-alpha.0...v0.1.0-alpha.1](https://github.com/GitbookIO/lightswitch/compare/v0.0.1-alpha.0...v0.1.0-alpha.1)
6+
7+
### Features
8+
9+
* **api:** update via SDK Studio ([#5](https://github.com/GitbookIO/lightswitch/issues/5)) ([5a079e7](https://github.com/GitbookIO/lightswitch/commit/5a079e7ed3650a5a32741bfb9fe070f4f7db1341))
10+
* **api:** update via SDK Studio ([#6](https://github.com/GitbookIO/lightswitch/issues/6)) ([c17a038](https://github.com/GitbookIO/lightswitch/commit/c17a038ebbd38cba6b3eb3f4335dd0a117c0dde8))
11+
* **api:** update via SDK Studio ([#7](https://github.com/GitbookIO/lightswitch/issues/7)) ([7fcb271](https://github.com/GitbookIO/lightswitch/commit/7fcb2717d397559237df277732d1249a09d08b5f))
12+
* **api:** update via SDK Studio ([#8](https://github.com/GitbookIO/lightswitch/issues/8)) ([f1cf215](https://github.com/GitbookIO/lightswitch/commit/f1cf21575e46ad208bbcaa17e0f038962b2d5254))
13+
14+
15+
### Chores
16+
17+
* go live ([#1](https://github.com/GitbookIO/lightswitch/issues/1)) ([ee6938b](https://github.com/GitbookIO/lightswitch/commit/ee6938b2a0bd79748e6b5d9ab2ac62c27058512f))
18+
* sync repo ([a99d060](https://github.com/GitbookIO/lightswitch/commit/a99d060d74d6f6effc3124f481b5430062d448a8))
19+
* update SDK settings ([#3](https://github.com/GitbookIO/lightswitch/issues/3)) ([5033f0f](https://github.com/GitbookIO/lightswitch/commit/5033f0f53999f97430546d4dbf481258538d3bba))

CONTRIBUTING.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
## Setting up the environment
2+
3+
This repository uses [`yarn@v1`](https://classic.yarnpkg.com/lang/en/docs/install).
4+
Other package managers may work but are not officially supported for development.
5+
6+
To set up the repository, run:
7+
8+
```sh
9+
$ yarn
10+
$ yarn build
11+
```
12+
13+
This will install all the required dependencies and build output files to `dist/`.
14+
15+
## Modifying/Adding code
16+
17+
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
18+
result in merge conflicts between manual patches and changes from the generator. The generator will never
19+
modify the contents of the `src/lib/` and `examples/` directories.
20+
21+
## Adding and running examples
22+
23+
All files in the `examples/` directory are not modified by the generator and can be freely edited or added to.
24+
25+
```ts
26+
// add an example to examples/<your-example>.ts
27+
28+
#!/usr/bin/env -S npm run tsn -T
29+
30+
```
31+
32+
```sh
33+
$ chmod +x examples/<your-example>.ts
34+
# run the example against your api
35+
$ yarn tsn -T examples/<your-example>.ts
36+
```
37+
38+
## Using the repository from source
39+
40+
If you’d like to use the repository from source, you can either install from git or link to a cloned repository:
41+
42+
To install via git:
43+
44+
```sh
45+
$ npm install git+ssh://[email protected]:GitbookIO/lightswitch.git
46+
```
47+
48+
Alternatively, to link a local copy of the repo:
49+
50+
```sh
51+
# Clone
52+
$ git clone https://www.github.com/GitbookIO/lightswitch
53+
$ cd lightswitch
54+
55+
# With yarn
56+
$ yarn link
57+
$ cd ../my-package
58+
$ yarn link lightswitch-api
59+
60+
# With pnpm
61+
$ pnpm link --global
62+
$ cd ../my-package
63+
$ pnpm link -—global lightswitch-api
64+
```
65+
66+
## Running tests
67+
68+
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
69+
70+
```sh
71+
$ npx prism mock path/to/your/openapi.yml
72+
```
73+
74+
```sh
75+
$ yarn run test
76+
```
77+
78+
## Linting and formatting
79+
80+
This repository uses [prettier](https://www.npmjs.com/package/prettier) and
81+
[eslint](https://www.npmjs.com/package/eslint) to format the code in the repository.
82+
83+
To lint:
84+
85+
```sh
86+
$ yarn lint
87+
```
88+
89+
To format and fix all lint issues automatically:
90+
91+
```sh
92+
$ yarn fix
93+
```
94+
95+
## Publishing and releases
96+
97+
Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
98+
the changes aren't made through the automated pipeline, you may want to make releases manually.
99+
100+
### Publish with a GitHub workflow
101+
102+
You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/GitbookIO/lightswitch/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.
103+
104+
### Publish manually
105+
106+
If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
107+
the environment.

0 commit comments

Comments
 (0)