Skip to content

Commit

Permalink
Fix ES build
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldzjap committed Aug 10, 2024
1 parent c3c2873 commit a8d979b
Show file tree
Hide file tree
Showing 12 changed files with 7,359 additions and 7,762 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
name: CI
on: [push]
jobs:
ci:
name: CI - OS ${{ matrix.os }}, Node.js ${{ matrix.node-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20.x, 21.x, 22.x]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run prod
- name: Test
run: npm run test
- name: Upload coverage report
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x' }}
uses: codecov/codecov-action@v3
- name: SonarCloud Scan
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
ci:
name: CI - OS ${{ matrix.os }}, Node.js ${{ matrix.node-version }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node-version: [20.x, 21.x, 22.x]
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run prod
- name: Test
run: npm run test
- name: Upload coverage report
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x' }}
uses: codecov/codecov-action@v3
- name: SonarCloud Scan
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node-version == '22.x' }}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ignore:
- '__tests__/**/*'
- 'example/**/*'
- '__tests__/**/*'
- 'example/**/*'
12 changes: 12 additions & 0 deletions example/cjs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const Rand = require('../../dist/rand-seed').default;
const PRNG = require('../../dist/rand-seed');

let rand = new Rand('1234', PRNG.mulberry32);
const result1 = Array.from({ length: 10 }, () => rand.next());

rand = new Rand('1234');
const result2 = Array.from({ length: 10 }, () => rand.next());

console.log('RESULT1:', result1);
console.log('RESULT2:', result2);
console.log('RESULT1 == RESULT2:', JSON.stringify(result1) === JSON.stringify(result2));
3 changes: 1 addition & 2 deletions example/index.js → example/es/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const Rand = require('../dist/rand-seed').default;
const PRNG = require('../dist/rand-seed');
import Rand, { PRNG } from '../../dist/rand-seed.mjs';

let rand = new Rand('1234', PRNG.mulberry32);
const result1 = Array.from({ length: 10 }, () => rand.next());
Expand Down
22 changes: 22 additions & 0 deletions example/es/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "example",
"version": "1.0.0",
"description": "A simple example of rand-seed",
"main": "index.js",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/michaeldzjap/rand-seed.git"
},
"keywords": [
"random",
"seed",
"prng"
],
"author": "Michael Dzjaparidze",
"license": "MIT",
"bugs": {
"url": "https://github.com/michaeldzjap/rand-seed/issues"
},
"homepage": "https://github.com/michaeldzjap/rand-seed#readme"
}
Loading

0 comments on commit a8d979b

Please sign in to comment.