Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/postcss-8.4.31
Browse files Browse the repository at this point in the history
  • Loading branch information
mprew97 authored Sep 5, 2024
2 parents bea3a42 + 3c8458b commit c100694
Show file tree
Hide file tree
Showing 97 changed files with 15,929 additions and 9,223 deletions.
7 changes: 6 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"presets": [
"@babel/typescript"
"@babel/preset-env",
"@babel/preset-typescript"
],
"ignore": [
"**/*.test.ts",
Expand All @@ -12,7 +13,11 @@
"@babel/proposal-class-properties",
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-optional-chaining",
["@babel/transform-runtime", {
"regenerator": true
}],
"@babel/plugin-transform-modules-umd",
"@babel/plugin-transform-nullish-coalescing-operator",
[
"module-resolver",
{
Expand Down
7 changes: 5 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
# called .env and add these values to it and change them appropriately.
# Remember to uncomment the variables!

# Only set BASE_URL if developing locally, as it will take precedence over the production api urls
# Only set BASE_URL if developing locally, as it will take precedence over the production api urls.
# BASE_URL="https://api.iterable.com/api"

# Set this to false to prevent messages from being consumed to fetch the same message(s) when testing changes locally.
# ENABLE_INAPP_CONSUME=false

# toggle this to true if you would need to hit our EU APIs
# Toggle this to true if you would need to hit our EU APIs.
# IS_EU_ITERABLE_SERVICE=false

# DANGEROUSLY_ALLOW_JS_POPUP_EXECUTION=false
58 changes: 54 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,64 @@
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
"plugin:prettier/recommended",
"airbnb-base"
],
"ignorePatterns": ["webpack.*.js"],
"ignorePatterns": [
"webpack.*.js"
],
"globals": {
"window": true,
"document": true
},
"rules": {
"comma-dangle": "off",
"implicit-arrow-linebreak": "off",
"no-console": 1,
"no-underscore-dangle": "off",
"no-duplicate-imports": 2,
"indent": "off",
"function-paren-newline": "off",
"no-confusing-arrow": "off",
"no-extra-boolean-cast": "off",
"no-undef": "off",
"no-unused-vars": "off",
"operator-linebreak": "off",
"import/extensions": "off",
"import/prefer-default-export": "off",
"max-classes-per-file": "off",
"object-curly-newline": "off",
"no-shadow": "off",
"prefer-const": "error",
"@typescript-eslint/prefer-for-of": "error",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/comma-spacing": 2,
"@typescript-eslint/explicit-function-return-type": "off",
"eqeqeq": 2
}
"@typescript-eslint/no-unused-vars": "error",
// come back and make this an error
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/array-type": [
2,
{
"default": "array"
}
],
"eqeqeq": 2,
"quotes": [
2,
"single"
]
},
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".ts",
".tsx"
]
}
}
},
}
27 changes: 12 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will do a clean install of node dependencies, cache/restore them,
# This workflow will do a clean install of node dependencies, cache/restore them,
# build the source code and run tests

# source: https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml
Expand All @@ -13,20 +13,17 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.3.0
uses: actions/setup-node@v2
with:
node-version: '16.3.0'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn build:node
- run: node index.node.js
- run: yarn build
- run: yarn test
- run: yarn check-deps

- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js 16.3.0
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '16.3.0'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn prepublishOnly
- run: node index.node.js
- run: yarn test
- run: yarn check-deps
9 changes: 4 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,15 @@ jobs:
environment: npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Use Node.js 16.3.0
uses: actions/setup-node@v2
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '16.3.0'
cache: 'yarn'
- run: yarn install --frozen-lockfile
- run: yarn test
- uses: JS-DevTools/npm-publish@v1
- uses: JS-DevTools/npm-publish@19c28f1ef146469e409470805ea4279d47c3d35c # v3.1.1
with:
token: ${{ secrets.NPM_TOKEN }}
check-version: true

strategy: all
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
}
18 changes: 14 additions & 4 deletions EXAMPLE_APP.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ This markdown file contains instructions for configuring and running the example

## Configuring the `.env` File

First thing you need to do is generate an API key on [the Iterable app](https://app.iterable.com). Unlike an app that uses the production-ready SDK, this example app can be used with a non-JWT API key while running the SDK in development mode, so feel free to *_not_* check the "JWT Enabled" box when creating a key. Make sure this key is is of the _Web_ key type. This will ensure the SDK has access to all the necessary endpoints when communicating with the Iterable API. After you generate your key, save the API Key somewhere handy. You'll need it for the next step. After you have your key you need to create a `env` file relative to the `.env.example` file in the `example` directory. Once you have your file, copy the contents of `.env.example` to your `.env` file and add your API key to the `API_KEY` variable.
First thing you need to do is generate an API key on [the Iterable app](https://app.iterable.com).

- Select Type "Web"
- (Optional) JWT authentication checked

This will ensure the SDK has access to all the necessary endpoints when communicating with the Iterable API.

- Select "Create API key" and save your API Key
- Create a new file called `.env` in the `example/` directory and copy the contents of `.env.example` into it (e.g. `cp examples/.env.example examples/.env`)
- Uncomment the `API_KEY` variable and add the API Key to the `API_KEY` variable (e.g. `API_KEY=xxxxxxxxx`)

Then once you boot up the app with `yarn install:all && yarn start:all`, you can set the key with the following code snippet. Similar code already exists in [`./example/src/index.ts`](./example/src/index.ts), but feel free to edit and play with it:

Expand All @@ -15,7 +24,7 @@ import { initialize } from '@iterable/web-sdk';
const { clearAuthToken, setNewAuthToken } = initialize(process.env.API_KEY);

/* make your Iterable API requests here */
doSomeRequest().then().catch()
doSomeRequest().then().catch();

/* optionally you can also clear your token if you like */
clearAuthToken();
Expand All @@ -24,8 +33,9 @@ import { initialize } from '@iterable/web-sdk';
the initialize method also exposes a setNewAuthToken method
if you want to set another key later on.
*/
setNewAuthToken('my-new-api-key')
setNewAuthToken('my-new-api-key');
})();
```

Now you're ready to start developing the SDK and the sample app in parallel!
Now you're ready to start developing the SDK and the sample app in parallel!

Loading

0 comments on commit c100694

Please sign in to comment.