Skip to content

Commit c2ca1e9

Browse files
committed
Unify repo-wide scripts
These are faster, and can pass arbitrary arguments to the underlying command, which allows repo-wide "watch" workflows.
1 parent 93d8480 commit c2ca1e9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1044
-2238
lines changed

.ctirc

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,50 @@
11
{
2+
"mode": "bundle",
3+
"overwrite": true,
4+
"backup": false,
5+
"generationStyle": "default-alias-named-star",
26
"options": [
37
{
4-
"mode": "bundle",
5-
"project": "tsconfig.json",
6-
"exportFilename": "index.ts",
7-
"useSemicolon": true,
8-
"useBanner": false,
9-
"useTimestamp": false,
10-
"quote": "'",
11-
"directive": "",
12-
"fileExt": "none",
13-
"overwrite": true,
14-
"backup": false,
15-
"generationStyle": "default-alias-named-star",
16-
"include": [
17-
"src/**"
18-
],
8+
"project": "packages/entity/tsconfig.json",
9+
"output": "packages/entity/src",
1910
"exclude": [
20-
"**/*tests__/**",
21-
"**/__testfixtures__/**"
22-
],
23-
"output": "src"
11+
"**/__testfixtures__/**",
12+
"**/__tests__/**"
13+
]
14+
},
15+
{
16+
"project": "packages/entity-cache-adapter-local-memory/tsconfig.json",
17+
"output": "packages/entity-cache-adapter-local-memory/src",
18+
"exclude": [ "**/__testfixtures__/**" ]
19+
},
20+
{
21+
"project": "packages/entity-cache-adapter-redis/tsconfig.json",
22+
"output": "packages/entity-cache-adapter-redis/src",
23+
"exclude": [ "**/__testfixtures__/**" ]
24+
},
25+
{
26+
"project": "packages/entity-database-adapter-knex/tsconfig.json",
27+
"output": "packages/entity-database-adapter-knex/src",
28+
"exclude": [ "**/__testfixtures__/**" ]
29+
},
30+
{
31+
"project": "packages/entity-ip-address-field/tsconfig.json",
32+
"output": "packages/entity-ip-address-field/src",
33+
},
34+
{
35+
"project": "packages/entity-secondary-cache-local-memory/tsconfig.json",
36+
"output": "packages/entity-secondary-cache-local-memory/src",
37+
"exclude": [ "**/__tests__/**" ]
38+
},
39+
{
40+
"project": "packages/entity-secondary-cache-redis/tsconfig.json",
41+
"output": "packages/entity-secondary-cache-redis/src",
42+
"exclude": [ "**/__testfixtures__/**" ]
43+
},
44+
{
45+
"project": "packages/entity-testing-utils/tsconfig.json",
46+
"output": "packages/entity-testing-utils/src",
47+
"exclude": [ "**/__testfixtures__/**" ]
2448
}
2549
]
26-
}
50+
}

.github/workflows/tests.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@ name: tests
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
77

88
jobs:
99
build:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
with:
14-
ref: ${{ github.event.pull_request.head.sha }}
15-
- uses: actions/setup-node@v4
16-
with:
17-
cache: yarn
18-
node-version-file: package.json
19-
- run: yarn --frozen-lockfile
20-
- run: yarn lint -- --max-warnings=0
21-
- name: Check if barrels are up to date
22-
run: yarn ctix && [ -z "$(git status --porcelain)" ]
23-
- run: yarn test -- --coverage
24-
- run: yarn integration -- --coverage
25-
- uses: codecov/codecov-action@v1
26-
with:
27-
token: ${{ secrets.CODECOV_TOKEN }}
28-
file: ./packages/*/coverage/clover.xml
29-
flags: unittest
30-
fail_ci_if_error: true
31-
- uses: codecov/codecov-action@v1
32-
with:
33-
token: ${{ secrets.CODECOV_TOKEN }}
34-
file: ./packages/*/coverage-integration/clover.xml
35-
flags: integration
36-
fail_ci_if_error: true
12+
- uses: actions/checkout@v4
13+
with:
14+
ref: ${{ github.event.pull_request.head.sha }}
15+
- uses: actions/setup-node@v4
16+
with:
17+
cache: yarn
18+
node-version-file: package.json
19+
- run: yarn --immutable
20+
- run: yarn lint --max-warnings=0
21+
- name: Check if barrels are up to date
22+
run: yarn ctix && [ -z "$(git status --porcelain)" ]
23+
- run: yarn test --coverage
24+
- run: yarn integration --coverage
25+
- uses: codecov/codecov-action@v1
26+
with:
27+
token: ${{ secrets.CODECOV_TOKEN }}
28+
file: ./coverage/clover.xml
29+
flags: unittest
30+
fail_ci_if_error: true
31+
- uses: codecov/codecov-action@v1
32+
with:
33+
token: ${{ secrets.CODECOV_TOKEN }}
34+
file: ./coverage-integration/clover.xml
35+
flags: integration
36+
fail_ci_if_error: true

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
**/__tests__/**
2+
**/__integration-tests__/**
3+
**/__mocks__/**
4+
**/__testfixtures__/**

codecov.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

eslint.config.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ const universeSharedTypescriptAnalysisConfig = require('eslint-config-universe/f
44
const tsdoc = require('eslint-plugin-tsdoc');
55

66
module.exports = defineConfig([
7-
globalIgnores(['packages/entity-codemod/**/__testfixtures__/**']),
7+
globalIgnores([
8+
'packages/entity-codemod/**/__testfixtures__/**',
9+
'packages/*/build',
10+
'coverage',
11+
'coverage-integration',
12+
'doc',
13+
]),
814
universeNodeConfig,
915
universeSharedTypescriptAnalysisConfig,
1016
{
@@ -29,7 +35,8 @@ module.exports = defineConfig([
2935
files: ['**/*.ts', '**/*.tsx', '**/*.d.ts'],
3036
languageOptions: {
3137
parserOptions: {
32-
project: './tsconfig.json',
38+
projectService: true,
39+
tsconfigRootDir: __dirname,
3340
},
3441
},
3542
rules: {
@@ -71,7 +78,8 @@ module.exports = defineConfig([
7178
files: ['**/__tests__/**/*.ts', '**/__tests__/**/*.tsx', '**/__tests__/**/*.d.ts'],
7279
languageOptions: {
7380
parserOptions: {
74-
project: './tsconfig.json',
81+
projectService: true,
82+
tsconfigRootDir: __dirname,
7583
},
7684
},
7785
rules: {
File renamed without changes.

jest.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
transform: { '\\.[jt]sx?$': ['babel-jest', { rootMode: 'upward' }] },
3+
collectCoverageFrom: [
4+
'packages/*/src/**',
5+
'!packages/*/src/index.ts',
6+
'!packages/entity-example/**',
7+
'!packages/entity-codemod/**',
8+
'!packages/entity-testing-utils/**',
9+
'!**/__*test*__/**',
10+
],
11+
coverageProvider: 'v8',
12+
testMatch: ['**/__tests__/**/*-test.ts'],
13+
};

package.json

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,38 @@
55
"packages/*"
66
],
77
"scripts": {
8-
"tsc": "lerna run tsc",
9-
"build": "lerna run build",
10-
"clean": "lerna run clean",
11-
"lint": "lerna run lint",
12-
"lint-fix": "lerna run lint-fix",
13-
"test": "lerna run test",
14-
"integration": "./resources/run-with-docker lerna run integration-no-setup",
15-
"prepack": "lerna run build",
16-
"ctix": "lerna run ctix",
8+
"tsc": "tsc --build",
9+
"build": "tsc --build",
10+
"clean": "yarn build --clean",
11+
"lint": "eslint .",
12+
"lint-fix": "yarn lint --fix",
13+
"test": "yarn build --noCheck && jest",
14+
"test:all": "yarn test",
15+
"integration": "./resources/run-with-docker yarn test --config jest-integration.config.js --runInBand",
16+
"integration:all": "yarn integration",
17+
"prepack": "yarn build",
18+
"ctix": "ctix build && resources/prepend-barrels.sh",
1719
"typedoc": "yarn build && typedoc"
1820
},
1921
"devDependencies": {
22+
"@babel/core": "^7.27.4",
23+
"@babel/preset-env": "^7.27.2",
24+
"@babel/preset-typescript": "^7.27.1",
2025
"@tsconfig/node20": "^20.1.6",
2126
"@tsconfig/strictest": "^2.0.5",
27+
"@types/babel__core": "^7.20.5",
28+
"@types/babel__preset-env": "^7.10.0",
29+
"@types/node": "20.19.1",
30+
"ctix": "^2.7.1",
31+
"eslint": "^9.29.0",
32+
"eslint-config-universe": "^15.0.3",
33+
"eslint-plugin-tsdoc": "^0.4.0",
34+
"jest": "^30.0.0",
2235
"lerna": "^8.2.2",
23-
"typedoc": "^0.28.4"
36+
"prettier": "^3.5.3",
37+
"prettier-plugin-organize-imports": "^4.1.0",
38+
"typedoc": "^0.28.4",
39+
"typescript": "^5.8.3"
2440
},
2541
"volta": {
2642
"node": "20.14.0"

packages/entity-cache-adapter-local-memory/package.json

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,15 @@
66
"build",
77
"src"
88
],
9-
"main": "build/index.js",
10-
"types": "build/index.d.ts",
9+
"main": "build/src/index.js",
10+
"types": "build/src/index.d.ts",
1111
"scripts": {
12-
"tsc": "tsc",
13-
"build": "tsc -b tsconfig.build.json",
14-
"clean": "rm -rf build coverage coverage-integration",
15-
"lint": "eslint src",
16-
"lint-fix": "eslint src --fix",
17-
"test": "jest --rootDir . --config ../../resources/jest.config.js",
18-
"integration": "../../resources/run-with-docker yarn integration-no-setup",
19-
"integration-no-setup": "jest --config ../../resources/jest-integration.config.js --rootDir . --runInBand --passWithNoTests",
20-
"ctix": "ctix build --config ../../.ctirc && ../../resources/prepend-barrel.sh '@expo/entity-cache-adapter-local-memory'"
12+
"build": "tsc --build",
13+
"clean": "yarn build --clean",
14+
"lint": "yarn run --top-level eslint src",
15+
"lint-fix": "yarn lint --fix",
16+
"test": "yarn test:all --rootDir $(pwd)",
17+
"integration": "yarn integration:all --rootDir $(pwd)"
2118
},
2219
"engines": {
2320
"node": ">=16"
@@ -32,22 +29,9 @@
3229
"lru-cache": "^6.0.0"
3330
},
3431
"devDependencies": {
35-
"@babel/core": "^7.27.4",
36-
"@babel/preset-env": "^7.27.2",
37-
"@babel/preset-typescript": "^7.27.1",
3832
"@expo/entity-testing-utils": "workspace:^",
39-
"@types/babel__core": "^7",
40-
"@types/babel__preset-env": "^7",
33+
"@jest/globals": "^30.0.0",
4134
"@types/lru-cache": "^5.1.1",
42-
"@types/node": "^20.19.1",
43-
"ctix": "^2.7.0",
44-
"eslint": "^9.26.0",
45-
"eslint-config-universe": "^15.0.3",
46-
"eslint-plugin-tsdoc": "^0.4.0",
47-
"jest": "^30.0.0",
48-
"prettier": "^3.5.3",
49-
"prettier-plugin-organize-imports": "^4.1.0",
50-
"ts-mockito": "^2.6.1",
5135
"typescript": "^5.8.3"
5236
}
5337
}

packages/entity-cache-adapter-local-memory/src/__tests__/GenericLocalMemoryCacher-full-test.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import {
2-
CacheAdapterFlavor,
3-
CacheAdapterFlavorDefinition,
42
CacheStatus,
53
IEntityGenericCacher,
64
SingleFieldHolder,
@@ -42,12 +40,9 @@ describe(GenericLocalMemoryCacher, () => {
4240
entity1Created.getID(),
4341
);
4442

45-
const localMemoryCacheAdapterProvider = (
46-
entityCompanionProvider['cacheAdapterFlavors'] as ReadonlyMap<
47-
CacheAdapterFlavor,
48-
CacheAdapterFlavorDefinition
49-
>
50-
).get('local-memory')!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
43+
const localMemoryCacheAdapterProvider = entityCompanionProvider['cacheAdapterFlavors'].get(
44+
'local-memory',
45+
)!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
5146
const entitySpecificGenericCacher = localMemoryCacheAdapterProvider[
5247
'localMemoryCacheAdapterMap'
5348
].get(
@@ -144,12 +139,9 @@ describe(GenericLocalMemoryCacher, () => {
144139
entity1Created.getID(),
145140
);
146141

147-
const localMemoryCacheAdapterProvider = (
148-
entityCompanionProvider['cacheAdapterFlavors'] as ReadonlyMap<
149-
CacheAdapterFlavor,
150-
CacheAdapterFlavorDefinition
151-
>
152-
).get('local-memory')!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
142+
const localMemoryCacheAdapterProvider = entityCompanionProvider['cacheAdapterFlavors'].get(
143+
'local-memory',
144+
)!.cacheAdapterProvider as LocalMemoryCacheAdapterProvider;
153145
const entitySpecificGenericCacher = localMemoryCacheAdapterProvider[
154146
'localMemoryCacheAdapterMap'
155147
].get(

0 commit comments

Comments
 (0)