Skip to content

Commit

Permalink
Merge pull request #1076 from JupiterOne/INT-10745-1
Browse files Browse the repository at this point in the history
INT-10745: mirate SDK to NPM
  • Loading branch information
gastonyelmini committed May 16, 2024
2 parents e4d3dbe + b902ae1 commit 21f970d
Show file tree
Hide file tree
Showing 30 changed files with 17,866 additions and 10,987 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: yarn
cache: npm
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: yarn --frozen-lockfile
run: npm ci --include=optional
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

- name: Run tests
run: yarn test:ci
run: npm run test:ci

- name: Run build
run: yarn build:dist
run: npm run build:dist

# Publishing is done in a separate job to allow
# for all matrix builds to complete.
Expand All @@ -60,7 +60,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: yarn
cache: npm
registry-url: https://registry.npmjs.org

# Fetch tags and describe the commit before the merge commit
Expand All @@ -83,5 +83,5 @@ jobs:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > .npmrc
yarn --frozen-lock-file
yarn lerna publish from-package --no-verify-access --yes
npm ci
npm exec lerna publish from-package --no-verify-access --yes
2 changes: 1 addition & 1 deletion .huskyrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
hooks: {
'pre-commit': 'lint-staged',
'pre-push': 'yarn prepush',
'pre-push': 'npm run prepush',
},
};
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ details about how to develop integrations with this SDK.

To get started with development:

1. Install dependencies using `yarn`
1. Run `yarn build`
1. Install dependencies using `npm install`
1. Run `npm run build`

This project utilizes TypeScript project references for incremental builds. To
prepare all of the packages, run `yarn build`. If you are making a changes
across multiple packages, it is recommended you run `yarn build --watch` to
automatically compile changes as you work.
prepare all of the packages, run `npm run build`. If you are making a changes
across multiple packages, it is recommended you run `npm run build -- --watch`
to automatically compile changes as you work.

### Linking packages

Expand All @@ -62,12 +62,12 @@ when changes are made.

Steps to automatically build and link:

- Run `yarn build` or `yarn build --watch` in _this_ project from a terminal and
wait for initial build to complete.
- Run `npm run build` or `npm run build --watch` in _this_ project from a
terminal and wait for initial build to complete.

- Run `yarn link` in the package that you want to link.
- Run `npm link` in the package that you want to link.

- In a separate terminal, run `yarn link @jupiterone/<package to link>` in the
- In a separate terminal, run `npm link @jupiterone/<package to link>` in the
integration project. You can now use the integration SDK CLI in the other
project and it will use the latest code on your filesystem.

Expand All @@ -80,15 +80,15 @@ to move to). Don't forget to update the `CHANGELOG.md` file!
```shell
git checkout -b release-<major>.<minor>.<patch>
git push -u origin release-<major>.<minor>.<patch>
yarn lerna version <major>.<minor>.<patch>
npm exec lerna version <major>.<minor>.<patch>
```

Note the `git checkout`/`git push` is required because Lerna will expect that
you've already created a remote branch before bumping, tagging, and pushing the
local changes to remote.

❕Make sure to have committed all your changes before running
`yarn lerna version` since it will commit the version update and tag that
`npm exec lerna version` since it will commit the version update and tag that
commit. Rebasing or amending lerna's commit will cause the tag to point to a
different commit.

Expand Down
19 changes: 7 additions & 12 deletions docs/integrations/development_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ You'll need:
[fnm](https://github.com/Schniz/fnm) and
[nvm](https://github.com/nvm-sh/nvm) are great choices.

- yarn
```sh
npm install --global yarn
```

### **Setup**

**Through the GitHub CLI**
Expand All @@ -55,20 +50,20 @@ gh repo create graph-$INTEGRATION_NAME --public \
--clone \
--template=https://github.com/jupiterone/integration-template
cd graph-$INTEGRATION_NAME
yarn install
npm install
```

**Through the GitHub UI**

1. Use the
[**integration-template**](https://github.com/JupiterOne/integration-template)
to create a new repository
2. Clone your repository and run `yarn install`
2. Clone your repository and run `npm install`

```sh
git clone https://github.com/$USERNAME/$REPO_NAME`
cd $REPO_NAME
yarn install
npm install
```

That's it! Your project is ready for development!
Expand Down Expand Up @@ -362,7 +357,7 @@ We'll also need to add an HTTP client to make requests. I'll use `node-fetch`,
but the choice of client is up to you.
```sh
yarn add node-fetch
npm install node-fetch
```
Now we can add the `getAccount` method to our client.
Expand Down Expand Up @@ -706,7 +701,7 @@ And that's it! We have a working `executionHandler`.
We've now:
- ✅ Created a new integration project
- ✅ Installed dependencies with `yarn install`
- ✅ Installed dependencies with `npm install`
- ✅ Created our `instanceConfigFields`
- ✅ Setup a `.env` file
- ✅ Created our `validateInvocation`
Expand All @@ -716,10 +711,10 @@ We've now:
We are now ready to run our integration! We can collect data using:
```sh
yarn start
npm run start
```
You can see the collected data in the `.j1-integration` and you can visualize
the results with `yarn graph`.
the results with `npm run graph`.
[//]: # 'TODO add references to other more advanced docs'
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"npmClient": "npm",
"packages": [
"packages/integration-sdk-*",
"packages/cli"
Expand Down
Loading

0 comments on commit 21f970d

Please sign in to comment.