Skip to content

Commit

Permalink
Merge pull request #68 from product-os/update-dependencies-and-node-20
Browse files Browse the repository at this point in the history
Bump NPM along with Node 20, update dependencies
  • Loading branch information
flowzone-app[bot] authored Apr 30, 2024
2 parents 7faf3ef + bbcfa28 commit cb3abee
Show file tree
Hide file tree
Showing 16 changed files with 48 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"*.ts": [
"balena-lint --typescript --fix"
],
"balena-lint -t tsconfig.dev.json --typescript --fix"
]
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
package-lock=false
legacy-peer-deps=true
9 changes: 5 additions & 4 deletions lib/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import { compare } from 'semver';

import Contract from './contract';
import { parse } from './cardinality';
import { BLUEPRINT, BlueprintLayout, BlueprintObject } from './types/types';
import type { BlueprintLayout, BlueprintObject } from './types/types';
import { BLUEPRINT } from './types/types';
import {
cartesianProductWith,
flatten as flattenIterator,
Expand Down Expand Up @@ -180,7 +181,7 @@ export default class Blueprint extends Contract {
references.length === 0
? contract.getChildren({
types: layout.infinite.types,
})
})
: references;

context.addChildren(contracts, {
Expand Down Expand Up @@ -237,7 +238,7 @@ export default class Blueprint extends Contract {
? false
: context.areChildrenSatisfied({
types: layout.types,
});
});
};

const checked: number[][] = [];
Expand Down Expand Up @@ -466,7 +467,7 @@ export default class Blueprint extends Contract {
references.length === 0
? contract.getChildren({
types: layout.infinite.types,
})
})
: references;

context.addChildren(contracts, {
Expand Down
6 changes: 3 additions & 3 deletions lib/children-tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import reduce from 'lodash/reduce';
import set from 'lodash/set';

import { ContractObject } from '.';
import Contract from './contract';
import type { ContractObject } from '.';
import type Contract from './contract';
import { setFirst } from './utils';

/**
Expand Down Expand Up @@ -96,7 +96,7 @@ export const build = (contract: Contract): object => {
export const getAll = (tree: any): ContractObject[] =>
reduce(
tree,
(accumulator, value, _) => {
(accumulator, value) => {
if (!value.slug) {
const out = accumulator.concat(getAll(value));
return out;
Expand Down
5 changes: 3 additions & 2 deletions lib/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ import { compare, satisfies, valid, validRange } from 'semver';
import ObjectSet from './object-set';
import MatcherCache from './matcher-cache';
import { hashObject } from './hash';
import { ContractObject, MATCHER } from './types/types';
import type { ContractObject } from './types/types';
import { MATCHER } from './types/types';
import { compileContract } from './template';
import { build as buildVariants } from './variants';
import { build as buildChildrentree } from './children-tree';
Expand Down Expand Up @@ -689,7 +690,7 @@ export default class Contract {
* console.log(child)
* })
*/
findChildren(matcher: Contract | {}): Contract[] {
findChildren(matcher: Contract | object): Contract[] {
if (
!(matcher instanceof Contract) ||
!matcher.raw ||
Expand Down
2 changes: 1 addition & 1 deletion lib/matcher-cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import concat from 'lodash/concat';
import get from 'lodash/get';
import set from 'lodash/set';
import Contract from './contract';
import type Contract from './contract';

/**
* @summary Get the path of a matcher in the cache
Expand Down
2 changes: 1 addition & 1 deletion lib/partials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import uniq from 'lodash/uniq';
import flow from 'lodash/flow';

import Contract from './contract';
import { ContractObject } from './types/types';
import type { ContractObject } from './types/types';
import { cartesianProductWith, stripExtraBlankLines } from './utils';

const hb = asyncHelpers(handlebars);
Expand Down
4 changes: 2 additions & 2 deletions lib/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import isString from 'lodash/isString';
import map from 'lodash/map';
import mapValues from 'lodash/mapValues';

import { ContractObject } from './types/types';
import type { ContractObject } from './types/types';

/**
* @module template
Expand Down Expand Up @@ -55,7 +55,7 @@ const deepMapValues = (
return isPlainObject(value)
? deepMapValues(value, callback, absoluteKey)
: callback(value, absoluteKey);
});
});

/**
* @summary Contract template interpolation regex
Expand Down
2 changes: 1 addition & 1 deletion lib/types/cuetypes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* tslint:disable:class-name no-empty-interface */
/* eslint @typescript-eslint/no-empty-interface: 0 */
/**
* This file was auto-generated by openapi-typescript.
* Do not make direct changes to the file.
Expand Down
2 changes: 1 addition & 1 deletion lib/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Proprietary and confidential.
*/

import { components } from './cuetypes';
import type { components } from './cuetypes';

export type ContractObject = components['schemas']['Contract'];
export type BlueprintObject = components['schemas']['Blueprint'];
Expand Down
4 changes: 2 additions & 2 deletions lib/variants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import mergeWith from 'lodash/mergeWith';
import omit from 'lodash/omit';
import reduce from 'lodash/reduce';

import { ContractObject } from './types/types';
import type { ContractObject } from './types/types';

/**
* @summary The name of the contract property that contains variants
Expand Down Expand Up @@ -80,5 +80,5 @@ export const build = (contract: ContractObject): ContractObject[] => {
),
),
[] as ContractObject[],
);
);
};
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,40 +26,40 @@
"build": "npm run clean && npm run buildtypes && tsc",
"buildtypes": "ts-node --transpile-only ./scripts/build-types.ts && balena-lint --typescript --fix lib/types",
"doc": "typedoc --options ./typedoc.json",
"lint": "balena-lint --typescript lib tests scripts",
"lint-fix": "balena-lint --typescript --fix lib tests scripts",
"lint": "balena-lint -t tsconfig.dev.json --typescript lib tests scripts",
"lint-fix": "balena-lint -t tsconfig.dev.json --typescript --fix lib tests scripts",
"test:node": "mocha -r ts-node/register/transpile-only --reporter spec tests/**/*.spec.ts",
"test": "npm run build && npm run lint && npm run test:node",
"test:fast": "npm run build && npm run test:node",
"prepack": "npm run build"
},
"dependencies": {
"@types/debug": "^4.1.5",
"@types/js-combinatorics": "^0.5.32",
"@types/lodash": "^4.14.168",
"@types/node": "^15.0.1",
"@types/object-hash": "^2.1.0",
"@types/semver": "^7.3.5",
"debug": "^3.2.6",
"handlebars": "^4.7.6",
"handlebars-async-helpers": "^1.0.5",
"handlebars": "^4.7.8",
"handlebars-async-helpers": "^1.0.4",
"js-combinatorics": "^0.5.5",
"lodash": "^4.17.19",
"object-hash": "^1.3.1",
"semver": "^5.7.1",
"skhema": "^5.3.2"
},
"devDependencies": {
"@balena/lint": "^5.0.4",
"@balena/lint": "^8.0.2",
"@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2",
"@types/mocha": "^7.0.2",
"@types/debug": "^4.1.5",
"@types/js-combinatorics": "^0.5.32",
"@types/lodash": "^4.14.168",
"@types/mocha": "^10.0.6",
"@types/node": "^20.12.7",
"@types/object-hash": "^2.1.0",
"@types/semver": "^7.3.5",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"cuelang-js": "^1.1.1",
"husky": "^4.2.5",
"lint-staged": "^10.1.7",
"mocha": "^7.2.0",
"mocha": "^10.4.0",
"openapi-typescript": "^3.2.4",
"rimraf": "^3.0.2",
"ts-node": "^8.10.1",
Expand All @@ -68,7 +68,7 @@
},
"engines": {
"node": "^20.0.0",
"npm": "^9.4.1"
"npm": "^10.0.0"
},
"versionist": {
"publishedAt": "2024-04-30T20:57:37.954Z"
Expand Down
2 changes: 1 addition & 1 deletion scripts/build-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const main = async () => {
const output = typeFile('cuetypes.ts');
await fs.writeFile(
output,
`/* tslint:disable:class-name no-empty-interface */\n${ts}`,
`/* eslint @typescript-eslint/no-empty-interface: 0 */\n${ts}`,
);
console.log(`Built types to ${output}`);
};
Expand Down
1 change: 1 addition & 0 deletions tests/blueprint/reproduce/reproduce.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ describe('Blueprint reproduce', () => {
'requirements-simple-2-aliases',
],
(testName) => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const testCase = require(`./${testName}.json`);

it(testName, () => {
Expand Down
1 change: 1 addition & 0 deletions tests/blueprint/sequence/sequence.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Blueprint from '../../../lib/blueprint';

describe('Blueprint sequence', () => {
_.each(['path_finding'], (testName) => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const testCase = require(`./${testName}.json`);

it(testName, () => {
Expand Down
9 changes: 9 additions & 0 deletions tsconfig.dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.json",
"include": [
"lib/**/*.ts",
"typings/**/*.ts",
"tests/**/*.ts",
"scripts/**/*.ts"
],
}

0 comments on commit cb3abee

Please sign in to comment.