Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
version: 2.1

workflows:
test:
jobs:
- build-run-linux:
context: hello-world-demos

test-daily:
triggers:
- schedule:
cron: "0 6 * * *"
filters:
branches:
only: main
jobs:
- build-run-linux:
context: hello-world-demos

# This CI build ensures that the demo both compiles and works correctly. For the runtime test,
# we use an SDK key and flag key that are passed in via the CircleCI project configuration;
# the flag is configured to return a true value.

jobs:
build-run-linux:
docker:
- image: circleci/node:latest
steps:
- checkout
- run:
name: insert SDK key and flag key into demo code
command: |
sed -i.bak "s/sdkKey *= *\".*\"/sdkKey = \"${LD_HELLO_WORLD_SDK_KEY}\"/" index.ts
sed -i.bak "s/featureFlagKey *= *\".*\"/featureFlagKey = \"${LD_HELLO_WORLD_FLAG_KEY_WITH_TRUE_VALUE}\"/" index.ts
- run: npm install
- run:
name: run demo
command: |
npm start | tee output.txt
grep "is true for this user" output.txt || (echo "Flag did not evaluate to expected true value" && exit 1)
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
node_modules
package-lock.json
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
"description": "Hello LaunchDarkly for Node.js with TypeScript",
"main": "index.ts",
"scripts": {
"start": "npm run build:live",
"build:live": "nodemon --exec ./node_modules/.bin/ts-node -- ./index.ts"
"start": "ts-node ./index.ts"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous configuration would've made the app wait around and restart if there were any source changes. That's not helpful for these demos.

},
"author": "LaunchDarkly <team@launchdarkly.com>",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "8.0.4",
"nodemon": "1.11.0",
"ts-node": "3.1.0",
"typescript": "2.4.1"
},
Expand Down