Skip to content

Commit 6046b05

Browse files
committed
chore: Migrate to github actions.
1 parent 4d323c5 commit 6046b05

16 files changed

+204
-77
lines changed
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Publish Documentation
2+
description: 'Publish documentation to github pages.'
3+
4+
inputs:
5+
github_token:
6+
description: 'The github token to use for committing'
7+
required: true
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- uses: launchdarkly/gh-actions/actions/[email protected]
13+
name: 'Publish to Github pages'
14+
with:
15+
docs_path: docs
16+
github_token: ${{ inputs.github_token }}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish to NPM
2+
description: Publish an npm package.
3+
inputs:
4+
prerelease:
5+
description: 'Is this a prerelease. If so, then the latest tag will not be updated in npm.'
6+
required: false
7+
dry-run:
8+
description: 'Is this a dry run. If so no package will be published.'
9+
required: false
10+
11+
runs:
12+
using: composite
13+
steps:
14+
- name: Publish
15+
shell: bash
16+
run: |
17+
./scripts/publish-npm.sh
18+
env:
19+
LD_RELEASE_IS_PRERELEASE: ${{ inputs.prerelease }}
20+
LD_RELEASE_IS_DRYRUN: ${{ inputs.dry-run }}

.github/workflows/ci.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- '**.md' #Do not need to run CI for markdown changes.
8+
pull_request:
9+
branches: [main]
10+
paths-ignore:
11+
- '**.md'
12+
13+
jobs:
14+
build-test:
15+
strategy:
16+
matrix:
17+
variations: [
18+
{os: ubuntu-latest, node: latest},
19+
{os: ubuntu-latest, node: 18}
20+
]
21+
22+
runs-on: ${{ matrix.variations.os }}
23+
env:
24+
TEST_SERVICE_PORT: 8000
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: ${{ matrix.variations.node }}
31+
registry-url: 'https://registry.npmjs.org'
32+
- name: Install
33+
run: npm install
34+
- name: Test
35+
run: npm test
36+
- name: Lint
37+
run: npm run lint:all
38+
- name: Check typescript
39+
run: npm run check-typescript
40+
- name: Build Docs
41+
run: npm run doc

.github/workflows/lint-pr-title.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Lint PR title
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- edited
8+
- synchronize
9+
10+
jobs:
11+
lint-pr-title:
12+
uses: launchdarkly/gh-actions/.github/workflows/lint-pr-title.yml@main

.github/workflows/release-please.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release Please
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
release-please:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
release_created: ${{ steps.release.outputs.release_created }}
13+
steps:
14+
- uses: googleapis/release-please-action@v4
15+
id: release
16+
with:
17+
token: ${{secrets.GITHUB_TOKEN}}
18+
19+
publish-package:
20+
runs-on: ubuntu-latest
21+
needs: ['release-please']
22+
permissions:
23+
id-token: write
24+
contents: write
25+
if: ${{ needs.release-please.outputs.release_created == 'true' }}
26+
steps:
27+
- uses: actions/checkout@v4
28+
29+
- uses: actions/setup-node@v4
30+
with:
31+
node-version: 20.x
32+
registry-url: 'https://registry.npmjs.org'
33+
34+
- uses: launchdarkly/gh-actions/actions/[email protected]
35+
name: 'Get NPM token'
36+
with:
37+
aws_assume_role: ${{ vars.AWS_ROLE_ARN }}
38+
ssm_parameter_pairs: '/production/common/releasing/npm/token = NODE_AUTH_TOKEN'
39+
40+
- name: Install Dependencies
41+
run: npm install
42+
43+
- id: publish-npm
44+
name: Publish NPM Package
45+
uses: ./.github/actions/publish-npm
46+
with:
47+
dry-run: 'false'
48+
prerelease: 'false'
49+
50+
- name: Build Documentation
51+
run: npm run doc
52+
53+
- id: publish-docs
54+
name: Publish Documentation
55+
uses: ./.github/actions/publish-docs
56+
with:
57+
github_token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ lib
1010
test-types.js
1111
docs/build/
1212
package-lock.json
13+
docs/

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "3.4.0"
3+
}

docs/Makefile

-34
This file was deleted.

docs/doc.md

-7
This file was deleted.

docs/tsconfig.json

-12
This file was deleted.

docs/typedoc.js

-18
This file was deleted.

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"test:junit": "cross-env NODE_ENV=test jest --testResultsProcessor jest-junit",
3939
"check-typescript": "node_modules/typescript/bin/tsc",
4040
"clean": "rimraf dist/**",
41-
"prepublishOnly": "npm run build:min"
41+
"prepublishOnly": "npm run build:min",
42+
"doc": "typedoc"
4243
},
4344
"devDependencies": {
4445
"@babel/cli": "^7.19.3",
@@ -72,7 +73,8 @@
7273
"rollup-plugin-node-globals": "^1.4.0",
7374
"rollup-plugin-terser": "^7.0.2",
7475
"sinon": "^14.0.0",
75-
"typescript": "^4.8.4",
76+
"typescript": "~5.4.5",
77+
"typedoc": "^0.25.13",
7678
"@types/estree": "^1.0.0"
7779
},
7880
"dependencies": {

release-please-config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"bootstrap-sha": "4d323c5e7cd7d509cfeb1be3a7446b10d94697a6",
3+
"packages": {
4+
".": {
5+
"release-type": "node",
6+
"include-v-in-tag": false,
7+
"include-component-in-tag": false
8+
}
9+
}
10+
}

scripts/publish-npm.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
if $LD_RELEASE_IS_DRYRUN ; then
3+
echo "Doing a dry run of publishing."
4+
else
5+
if $LD_RELEASE_IS_PRERELEASE ; then
6+
echo "Publishing with prerelease tag."
7+
npm publish --tag prerelease --provenance --access public || { echo "npm publish failed" >&2; exit 1; }
8+
else
9+
npm publish --provenance --access public || { echo "npm publish failed" >&2; exit 1; }
10+
fi
11+
fi

typedoc.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"$schema": "https://typedoc.org/schema.json",
3+
"name": "launchdarkly-js-client-sdk",
4+
"includeVersion": true,
5+
"entryPoints": [
6+
"typings.d.ts",
7+
],
8+
"readme": "none",
9+
"visibilityFilters": {
10+
"protected": false,
11+
"private": false,
12+
"inherited": true,
13+
"external": true,
14+
"@alpha": false,
15+
"@beta": false
16+
}
17+
}

typings.d.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
// Put top level documentation into docs/doc.md.
1+
/**
2+
* This is the API reference for the LaunchDarkly SDK for browser JavaScript.
3+
*
4+
* In typical usage, you will call {@link initialize} once at startup time to obtain an instance of
5+
* {@link LDClient}, which provides access to all of the SDK's functionality.
6+
*
7+
* For more information, see the [SDK reference guide](https://docs.launchdarkly.com/sdk/client-side/javascript).
8+
*
9+
* @packageDocumentation
10+
*/
11+
212
declare module 'launchdarkly-js-client-sdk' {
313

4-
//// DOCBUILD-START-REPLACE (see docs/Makefile)
514
export * from 'launchdarkly-js-sdk-common';
615
import {
716
BasicLoggerOptions,
@@ -10,7 +19,6 @@ declare module 'launchdarkly-js-client-sdk' {
1019
LDLogger,
1120
LDOptionsBase,
1221
} from 'launchdarkly-js-sdk-common';
13-
//// DOCBUILD-END-REPLACE
1422

1523
/**
1624
* Creates an instance of the LaunchDarkly client.
@@ -133,7 +141,7 @@ declare module 'launchdarkly-js-client-sdk' {
133141
*
134142
* @param options Configuration for the logger. If no options are specified, the
135143
* logger uses `{ level: 'info' }`.
136-
*
144+
*
137145
* @example
138146
* This example shows how to use `basicLogger` in your SDK options to enable console
139147
* logging only at `warn` and `error` levels.

0 commit comments

Comments
 (0)