Skip to content

Commit

Permalink
chore(npm): Update repo to use npm over yarn (#888)
Browse files Browse the repository at this point in the history
- Also fix passing of args to npm scripts in circleci
  • Loading branch information
snowypowers committed Mar 18, 2023
1 parent e38d146 commit a96afef
Show file tree
Hide file tree
Showing 19 changed files with 27,319 additions and 18,645 deletions.
32 changes: 14 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ commands:
environment:
JEST_JUNIT_OUTPUT_DIR: reports/unit
JEST_JUNIT_OUTPUT_NAME: results.xml
command: yarn test:unit --ci --runInBand --detectOpenHandles
--reporters="jest-junit" --reporters="default"
command: npm run test:unit -- --ci --maxWorkers=4 --detectOpenHandles --reporters="jest-junit" --reporters="default"
- store_test_results:
path: reports
- store_artifacts:
Expand All @@ -59,8 +58,7 @@ commands:
environment:
JEST_JUNIT_OUTPUT_DIR: reports/integration
JEST_JUNIT_OUTPUT_NAME: results.xml
command: yarn test:integration --ci --runInBand --detectOpenHandles
--reporters="jest-junit" --reporters="default"
command: npm run test:integration -- --ci --maxWorkers=4 --detectOpenHandles --reporters="jest-junit" --reporters="default"
- store_test_results:
path: reports
- store_artifacts:
Expand All @@ -75,28 +73,26 @@ jobs:
command: |
node --version
npm --version
yarn --version
git --version
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- neon-yarn-{{ checksum "yarn.lock" }}
- neon-fallback
- neon-npm-{{ checksum "package-lock.json" }}
- run:
name: node hid compilation requirements
command: sudo apt-get update && sudo apt-get -y install libusb-1.0-0-dev libusb-1.0-0 libudev-dev
- run: yarn install --cache-folder .cache/yarn
- run: npm ci
- save_cache:
key: neon-yarn-{{ checksum "yarn.lock" }}
key: neon-npm-{{ checksum "package-lock.json" }}
paths:
- .cache/yarn
- node_modules
- run:
name: Bootstrap
command: yarn bootstrap
command: npm run bootstrap
- run:
name: Build
command: yarn build && yarn dist
command: npm run build && npm run dist
- persist_to_workspace:
root: .
paths:
Expand All @@ -122,10 +118,10 @@ jobs:
[ -z "$FILES" ] && echo "No files found" && exit 0
echo "Found:"
echo $FILES
yarn run eslint --max-warnings 0 --format junit -o reports/lint/lint.xml $FILES
npx eslint --max-warnings 0 --format junit -o reports/lint/lint.xml $FILES
- run:
name: Format docs
command: yarn lint:docs
command: npm run lint:docs
- store_test_results:
path: reports
- store_artifacts:
Expand Down Expand Up @@ -160,7 +156,7 @@ jobs:
command: npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- run:
name: Publish to npm
command: yarn release:latest --yes
command: npm run release:latest -- --yes

publish-next:
executor: env_node
Expand All @@ -173,7 +169,7 @@ jobs:
command: npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- run:
name: Publish to npm
command: yarn release:next --yes
command: npm run release:next -- --yes

publish-docs:
executor: env_node
Expand All @@ -189,8 +185,8 @@ jobs:
name: Build and release docs
command: |
cd website
yarn install
yarn run release
npm i
npm run release
# Branch based workflows
workflows:
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
3000,
20332
],
"postCreateCommand": "yarn install",
"postCreateCommand": "npm i",
"remoteUser": "node"
}
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ We are going to adhere to Conventional Commits style for commit messages so this

### Work from `dev`

All our development work in progress happens on the `dev` branch. To start, please create a branch off `dev`. All your changes should live on this new branch and the pull request be created from this branch to either `dev` or `master`.
All our development work in progress happens on the `dev` branch. To start, please create a branch off `dev` . All your changes should live on this new branch and the pull request be created from this branch to either `dev` or `master` .

During development:

- Ensure code is formatted through `yarn lint`.
- Ensure tests pass through `npm run test:unit`.
* Ensure code is formatted through `npm run lint`.
* Ensure tests pass through `npm run test:unit`.

Just before you submit, you can run `npm run test` to run integration tests together. We do not encourage running integration tests in `watch` mode or everytime as it performs real transactions on the blockchain and should be reserved for the final step.

Expand All @@ -37,10 +37,10 @@ Title your PR with a conventional commit message as such:
type(scope):desc
```

Type can be `fix`, `feat`, `docs`, `test` or `refactor`. This list is not exhaustive.
Type can be `fix` , `feat` , `docs` , `test` or `refactor` . This list is not exhaustive.

Scope is the package folder that you are focusing on, `api`, `sc`, `wallet`, etc.
Scope is the package folder that you are focusing on, `api` , `sc` , `wallet` , etc.

For bugfixes, point the PR at `master`. For new features, please point it at `dev`.
For bugfixes, point the PR at `master` . For new features, please point it at `dev` .

### And you are done!
48 changes: 25 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<p align="center">
<img

src="https://raw.githubusercontent.com/CityOfZion/visual-identity/develop/_CoZ%20Branding/_Logo/_Logo%20icon/_PNG%20200x178px/CoZ_Icon_DARKBLUE_200x178px.png"
width="125px;">

</p>

<h1 align="center">neon-js</h1>
Expand All @@ -12,7 +14,9 @@

<p align="center">
<a href="https://circleci.com/gh/CityOfZion/neon-js">

<img src="https://circleci.com/gh/CityOfZion/neon-js.svg?style=svg">

</a>
</p>

Expand All @@ -31,7 +35,7 @@ Visit the [docs](https://dojo.coz.io/neo3/neon-js/index.html) to learn how to us
### Nodejs

```js
npm i @cityofzion/neon-js
npm i @cityofzion / neon - js
```

### Browser through CDN
Expand All @@ -45,67 +49,65 @@ npm i @cityofzion/neon-js
### Nodejs
```js
import {default as Neon} from "@cityofzion/neon-js";
import {
default as Neon
} from "@cityofzion/neon-js";
const acct = Neon.create.account("NKuyBkoGdZZSLyPbJEetheRhMjeznFZszf");
```
### Browser
Once imported using the script tag, the module is available as a global object `Neon`.
Once imported using the script tag, the module is available as a global object `Neon` .
```js
console.log(Neon);
var acct = Neon.create.account("NKuyBkoGdZZSLyPbJEetheRhMjeznFZszf");
```
> **Note**
> For most use-cases, we recommend `neon-js`.
> Do not use `neon-js` and `neon-core` in the same project. The classes are not cross-package compatible. See https://github.com/CityOfZion/neon-js/issues/850.
> For most use-cases, we recommend `neon-js` .
> Do not use `neon-js` and `neon-core` in the same project. The classes are not cross-package compatible. See https://github.com/CityOfZion/neon-js/issues/850.
# Contributing
Please refer to [`CONTRIBUTING`](./CONTRIBUTING.md) for development practices.
Please refer to [ `CONTRIBUTING` ](./CONTRIBUTING.md) for development practices.
## Setup
This repository is a typescript mono-repo using Lerna and Yarn workspaces. Please ensure the following is installed:
This repository is a typescript mono-repo using Lerna. Please ensure the following is installed:
- Yarn (a version that support workspaces)
- Node (latest LTS aka v8 at time of writing)
* Node (latest LTS aka v18 at time of writing)
> `lerna` is optional and only required for advanced operations.
```sh
git clone https://github.com/CityOfZion/neon-js.git
cd neon-js
yarn
yarn bootstrap
yarn build
npm run bootstrap
npm run build
```
## Testing
```sh
yarn lint
yarn build
yarn dist
yarn test:unit
yarn test:integration
npm run lint
npm run build
npm run dist
npm run test:unit
npm run test:integration
```
# Docs
We use Docusaurus for our docs website. The docs are stored in `./docs` while the main website and its configuration is in `./website`.
We use Docusaurus for our docs website. The docs are stored in `./docs` while the main website and its configuration is in `./website` .
```sh
cd website
yarn
yarn start
npm run start
```
# License
- Open-source [MIT](https://github.com/CityOfZion/neon-js/blob/master/LICENSE.md).
- Main author and maintainer is [Yak Jun Xiang](https://github.com/snowypowers).
* Open-source [MIT](https://github.com/CityOfZion/neon-js/blob/master/LICENSE.md).
* Main author and maintainer is [Yak Jun Xiang](https://github.com/snowypowers).
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ node basic/facade.js

## Develop

`yarn generate` will parse the files and use `ljs2` to invert the comments and codeblocks. The outputs will override all the files in docs/guides.
`npm run generate` will parse the files and use `ljs2` to invert the comments and codeblocks. The outputs will override all the files in docs/guides.
4 changes: 2 additions & 2 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"packages/*"
],
"version": "5.3.0",
"npmClient": "yarn",
"npmClient": "npm",
"useWorkspaces": true,
"workspaces": [
"packages/*"
Expand All @@ -24,4 +24,4 @@
]
}
}
}
}
Loading

0 comments on commit a96afef

Please sign in to comment.