Skip to content

Commit

Permalink
fix: update dependencies and improve git actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lpatiny committed Mar 20, 2024
1 parent afaf632 commit 8b38b94
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 92 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/ci.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Node.js CI

on:
push:
branches:
- main
pull_request:

jobs:
nodejs:
# Documentation: https://github.com/zakodium/workflows#nodejs-ci
uses: zakodium/workflows/.github/workflows/nodejs.yml@nodejs-v1
with:
lint-check-types: true
53 changes: 16 additions & 37 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,16 @@
name: Release

on:
push:
branches:
- master

env:
NODE_VERSION: 16.x

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Get package name
run: echo "PACKAGE_NAME=$(jq .name package.json | tr -d '"')" >> $GITHUB_ENV
- uses: GoogleCloudPlatform/release-please-action@v2
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
release-type: node
package-name: ${{ env.PACKAGE_NAME }}
bump-minor-pre-major: Yes
- uses: actions/checkout@v2
# These if statements ensure that a publication only occurs when a new release is created
if: ${{ steps.release.outputs.release_created }}
- uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created }}
- run: npm install
if: ${{ steps.release.outputs.release_created }}
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_TOKEN }}
if: ${{ steps.release.outputs.release_created }}
name: Release

on:
push:
branches:
- main

jobs:
release:
# Documentation: https://github.com/zakodium/workflows#release
uses: zakodium/workflows/.github/workflows/release.yml@release-v1
with:
npm: true
secrets:
github-token: ${{ secrets.BOT_TOKEN }}
npm-token: ${{ secrets.NPM_BOT_TOKEN }}
25 changes: 11 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,18 @@
"trailingComma": "all"
},
"dependencies": {
"cheminfo-types": "^1.4.0"
"cheminfo-types": "^1.7.3"
},
"devDependencies": {
"@types/jest": "^29.5.0",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"@vitest/coverage-c8": "^0.29.8",
"eslint": "^8.37.0",
"eslint-config-cheminfo-typescript": "^11.3.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-jsdoc": "^40.1.1",
"prettier": "^2.8.7",
"rimraf": "^4.4.1",
"typescript": "^5.0.3",
"vitest": "^0.29.8"
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@vitest/coverage-v8": "^1.4.0",
"eslint": "^8.57.0",
"eslint-config-cheminfo-typescript": "^12.2.0",
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"typescript": "^5.4.2",
"vitest": "^1.4.0"
}
}
8 changes: 4 additions & 4 deletions src/__tests__/appended.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { test, expect } from 'vitest';
import { appendedParser } from '..';

test('multiple breakdown', () => {
let csv = readFileSync(
const csv = readFileSync(
join(__dirname, '../../testFiles/multiple_breakdown.csv'),
'latin1',
);
Expand All @@ -19,7 +19,7 @@ test('multiple breakdown', () => {
});

test('breakdown', () => {
let csv = readFileSync(
const csv = readFileSync(
join(__dirname, '../../testFiles/breakdown.csv'),
'latin1',
);
Expand All @@ -30,7 +30,7 @@ test('breakdown', () => {
});

test('capacitance', () => {
let csv = readFileSync(
const csv = readFileSync(
join(__dirname, '../../testFiles/Cdg-V.csv'),
'latin1',
);
Expand All @@ -41,7 +41,7 @@ test('capacitance', () => {
});

test('IV', () => {
let csv = readFileSync(
const csv = readFileSync(
join(__dirname, '../../testFiles/sweep.csv'),
'latin1',
);
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/general.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test('with options', () => {
});

test('real file', () => {
let csv = readFileSync(
const csv = readFileSync(
join(__dirname, '../../testFiles/Cdg-V.csv'),
'latin1',
);
Expand All @@ -66,7 +66,7 @@ test('real file', () => {
});

test('breakdown', () => {
let csv = readFileSync(
const csv = readFileSync(
join(__dirname, '../../testFiles/breakdown.csv'),
'latin1',
);
Expand Down
16 changes: 8 additions & 8 deletions src/appended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ export function appendedParser(
);

// Get numeric rows boundaries
let startNumeric = [];
let endNumeric = [];
const startNumeric = [];
const endNumeric = [];
for (let index = 0; index < lines.length; index++) {
const currentLine = lines[index];

Expand All @@ -53,8 +53,8 @@ export function appendedParser(
}

// Filter headers and start based on the minimum length
let headers: number[] = [];
let start: number[] = [0];
const headers: number[] = [];
const start: number[] = [0];
for (let i = 0; i < startNumeric.length; i++) {
// Last item in array
if (i === startNumeric.length - 1) {
Expand All @@ -79,10 +79,10 @@ export function appendedParser(
const isTagged = !isNumber(lines[headers[0] + 1][0]);

// Split in metadata, header and data
let series: MeasurementXY[] = new Array(headers.length);
const series: MeasurementXY[] = new Array(headers.length);
for (let seriesIndex = 0; seriesIndex < headers.length; seriesIndex++) {
// Add metadata
let meta: Record<string, string> = {};
const meta: Record<string, string> = {};
for (
let index = start[seriesIndex];
index < headers[seriesIndex];
Expand Down Expand Up @@ -110,9 +110,9 @@ export function appendedParser(
seriesIndex + 1 === headers.length
? lines.length - 1
: start[seriesIndex + 1];
let variables: Partial<Record<OneLowerCase, MeasurementVariable>> = {};
const variables: Partial<Record<OneLowerCase, MeasurementVariable>> = {};
for (let keyIndex = isTagged ? 1 : 0; keyIndex < keys.length; keyIndex++) {
let data: number[] = [];
const data: number[] = [];
for (
let index = headers[seriesIndex] + 1;
index < endDataIndex;
Expand Down
6 changes: 3 additions & 3 deletions src/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export function ndParse(
keyMap = defaultKeyMapper,
labelMap = defaultLabelMap,
} = options || {};
let meta: MeasurementXY['meta'] = {};
let variables: Partial<MeasurementXY<number[]>['variables']> = {};
const meta: MeasurementXY['meta'] = {};
const variables: Partial<MeasurementXY<number[]>['variables']> = {};

let tempHeader: string[] = [];
let header: OneLowerCase[] | undefined;
Expand All @@ -23,7 +23,7 @@ export function ndParse(
let tag: string | undefined;

for (const line of text.split(/\r\n|\r|\n/)) {
let fields = line.split(separator);
const fields = line.split(separator);
if (isTagged) {
prevTag = tag;
tag = fields.shift();
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function nextChar(keys: string[]): OneLowerCase {
}

export function defaultKeyMapper(keys: string[]): OneLowerCase[] {
let currKeys: OneLowerCase[] = new Array(keys.length);
const currKeys: OneLowerCase[] = new Array(keys.length);
for (let index = 0; index < keys.length; index++) {
const key = keys[index];
if (index === 0) {
Expand Down Expand Up @@ -50,7 +50,7 @@ export function orderedKeyMap(
keys: string[],
ignoreFirst: boolean,
): OneLowerCase[] {
let currKeys: OneLowerCase[] = new Array(keys.length);
const currKeys: OneLowerCase[] = new Array(keys.length);
const start = ignoreFirst ? 1 : 0;
for (let index = 0; index < keys.length; index++) {
if (index === start) {
Expand Down

0 comments on commit 8b38b94

Please sign in to comment.