Skip to content

Commit 0365ea5

Browse files
chore: consolidate dev deps (#4948)
1 parent bc89544 commit 0365ea5

File tree

128 files changed

+3670
-4746
lines changed

Some content is hidden

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

128 files changed

+3670
-4746
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,4 @@ jobs:
7979
DRY_RUN: ${{ inputs.dry_run }}
8080
RELEASE_TAG: ${{ inputs.release_tag }}
8181
RELEASE_VERSION: ${{ inputs.release_version }}
82-
run: ./node_modules/.bin/ts-node ./build/publish-release.ts
82+
run: npx tsx ./build/publish-release.ts

build/publish-latest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function publishLatestToNpm() {
2121
'operators',
2222
];
2323

24-
for (let pkg of publishablePackages) {
24+
for (const pkg of publishablePackages) {
2525
console.log(`Publishing @ngrx/${pkg}`);
2626

2727
const cmd = [

build/publish-next.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function publishNextToNpm() {
2121
'operators',
2222
];
2323

24-
for (let pkg of publishablePackages) {
24+
for (const pkg of publishablePackages) {
2525
console.log(`Publishing @ngrx/${pkg}`);
2626

2727
const cmd = [

build/stackblitz.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as globby from 'globby';
1+
import { glob } from 'tinyglobby';
22
import * as fs from 'fs';
33
import { packages as ngrxPackages } from './config';
44

@@ -15,7 +15,7 @@ const EXAMPLE_FILES = [
1515
];
1616

1717
(async () => {
18-
const paths = await globby(EXAMPLE_FILES, { ignore: ['**/node_modules/**'] });
18+
const paths = await glob(EXAMPLE_FILES, { ignore: ['**/node_modules/**'] });
1919

2020
const files = paths.reduce((files, filePath) => {
2121
const contents = fs.readFileSync(filePath, 'utf-8');

build/tasks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export async function copySchematicsCore(config: Config) {
1313
const filter = (name: string) =>
1414
!name.endsWith('.eslintrc.json') && !name.endsWith('project.json');
1515

16-
for (let pkg of util.getTopLevelPackages(config)) {
16+
for (const pkg of util.getTopLevelPackages(config)) {
1717
const packageJson = fs
1818
.readFileSync(`${modulesDir}${pkg}/package.json`)
1919
.toString('utf-8');
@@ -41,7 +41,7 @@ export async function copySchematicsCore(config: Config) {
4141
* Deploy build artifacts to repos
4242
*/
4343
export async function publishToRepo(config: Config) {
44-
for (let pkg of util.getTopLevelPackages(config)) {
44+
for (const pkg of util.getTopLevelPackages(config)) {
4545
const SOURCE_DIR = `./dist/modules/${pkg}`;
4646
const REPO_URL = `git@github.com:ngrx/${pkg}-builds.git`;
4747
const REPO_DIR = `./tmp/${pkg}`;

build/update-version-numbers.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { readFileSync, writeFileSync } from 'fs';
22
import { EOL } from 'os';
33
import * as readline from 'readline';
4-
import * as glob from 'glob';
4+
import { globSync } from 'tinyglobby';
55
import { createBuilder } from './util';
66
import { packages } from './config';
77
import { join } from 'path';
@@ -13,7 +13,7 @@ const CONFIG = {
1313
};
1414

1515
// get the version from the command
16-
// e.g. ts-node ./build/update-version-numbers.ts 10.0.0
16+
// e.g. npx tsx ./build/update-version-numbers.ts 10.0.0
1717
const [newVersion] = process.argv.slice(2);
1818

1919
if (newVersion) {
@@ -56,9 +56,8 @@ function updateVersions(version: string) {
5656
function createPackageJsonBuilder(version: string) {
5757
const [major] = version.split('.');
5858
return async () => {
59-
glob
60-
.sync('**/package.json', { ignore: '**/node_modules/**' })
61-
.map((file) => {
59+
globSync('**/package.json', { ignore: '**/node_modules/**' }).map(
60+
(file) => {
6261
const content = readFileSync(file, 'utf-8');
6362
const pkg = JSON.parse(content);
6463
let saveFile = false;
@@ -85,7 +84,8 @@ function createPackageJsonBuilder(version: string) {
8584
if (saveFile) {
8685
writeAsJson(file, pkg);
8786
}
88-
});
87+
}
88+
);
8989
};
9090
}
9191

@@ -94,14 +94,14 @@ function createPackageJsonBuilder(version: string) {
9494
*/
9595
function createUpdateAddSchematicBuilder(version: string) {
9696
return async () => {
97-
glob
98-
.sync('**/libs-version.ts', { ignore: '**/node_modules/**' })
99-
.map((file) => {
97+
globSync('**/libs-version.ts', { ignore: '**/node_modules/**' }).map(
98+
(file) => {
10099
writeFileSync(
101100
file,
102101
`export const platformVersion = '^${version}';${EOL}`
103102
);
104-
});
103+
}
104+
);
105105
};
106106
}
107107

build/util.ts

Lines changed: 15 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,18 @@
1-
import * as fs from 'fs';
1+
import * as path from 'node:path';
22
import * as cp from 'child_process';
3-
import * as glob from 'glob';
4-
import * as fsExtra from 'fs-extra';
5-
import * as path from 'path';
6-
import * as rimraf from 'rimraf';
3+
import ora from 'ora';
74
import { Config } from './config';
85

96
export type RunnerFn = (config: Config) => Promise<any>;
107
export type TaskDef = [string, RunnerFn];
118
export type BaseFn = (command: string) => string;
129

13-
export function copy(target: string, destination: string): Promise<void> {
14-
return new Promise((resolve, reject) => {
15-
fsExtra.copy(target, path.resolve(destination), (err) => {
16-
if (err) return reject(err);
17-
resolve();
18-
});
19-
});
20-
}
21-
22-
export function remove(target: string): Promise<void> {
23-
return new Promise((resolve, reject) => {
24-
fsExtra.remove(target, (err) => {
25-
if (err) return reject(err);
26-
resolve();
27-
});
28-
});
29-
}
30-
31-
export function writeFile(target: string, contents: string): Promise<void> {
32-
return new Promise((resolve, reject) => {
33-
fs.writeFile(target, contents, (err) => {
34-
if (err) return reject(err);
35-
resolve();
36-
});
37-
});
38-
}
39-
40-
export function getListOfFiles(
41-
globPath: string,
42-
exclude?: string | string[]
43-
): Promise<string[]> {
44-
return new Promise((resolve, reject) => {
45-
const options = exclude ? { ignore: exclude } : {};
46-
47-
glob(globPath, options, (error, matches) => {
48-
if (error) {
49-
return reject(error);
50-
}
51-
52-
resolve(matches);
53-
});
54-
});
55-
}
56-
57-
export function removeRecursively(glob: string): Promise<void> {
58-
return new Promise((resolve, reject) => {
59-
rimraf(glob, (err) => {
60-
if (err) {
61-
reject(err);
62-
} else {
63-
resolve();
64-
}
65-
});
66-
});
10+
export function createBuilder(tasks: TaskDef[]) {
11+
return async function (config: Config) {
12+
for (const [name, runner] of tasks) {
13+
await runTask(name, () => runner(config));
14+
}
15+
};
6716
}
6817

6918
export function exec(
@@ -82,6 +31,10 @@ export function exec(
8231
});
8332
}
8433

34+
export function getTopLevelPackages(config: Config) {
35+
return config.packages.map((packageDescription) => packageDescription.name);
36+
}
37+
8538
export function cmd(command: string, args: string[]): Promise<string> {
8639
return exec(command, args, (command: string) => command);
8740
}
@@ -90,19 +43,6 @@ export function git(args: string[]): Promise<string> {
9043
return cmd('git', args);
9144
}
9245

93-
export function ignoreErrors<T>(promise: Promise<T>): Promise<T | null> {
94-
return promise.catch(() => null);
95-
}
96-
97-
export function fromNpm(command: string) {
98-
return baseDir(`./node_modules/.bin/${command}`);
99-
}
100-
101-
export function getPackageFilePath(pkg: string, filename: string) {
102-
return baseDir(`./modules/${pkg}/${filename}`);
103-
}
104-
105-
const ora = require('ora');
10646
async function runTask(name: string, taskFn: () => Promise<any>) {
10747
const spinner = ora(name);
10848

@@ -119,40 +59,10 @@ async function runTask(name: string, taskFn: () => Promise<any>) {
11959
}
12060
}
12161

122-
export function createBuilder(tasks: TaskDef[]) {
123-
return async function (config: Config) {
124-
for (let [name, runner] of tasks) {
125-
await runTask(name, () => runner(config));
126-
}
127-
};
128-
}
129-
130-
export function flatMap<K, J>(list: K[], mapFn: (item: K) => J[]): J[] {
131-
return list.reduce(function (newList, nextItem) {
132-
return [...newList, ...mapFn(nextItem)];
133-
}, [] as J[]);
134-
}
135-
136-
export function getTopLevelPackages(config: Config) {
137-
return config.packages.map((packageDescription) => packageDescription.name);
138-
}
139-
140-
export function baseDir(...dirs: string[]): string {
62+
function baseDir(...dirs: string[]): string {
14163
return `"${path.resolve(__dirname, '../', ...dirs)}"`;
14264
}
14365

144-
export async function sleep(ms: number) {
145-
return new Promise((resolve) => {
146-
setTimeout(resolve, ms);
147-
});
148-
}
149-
150-
export function getPrNumber(prNumber: string, circlePR: string): string {
151-
const PR_NUMBER = prNumber;
152-
153-
if (!PR_NUMBER && circlePR) {
154-
return circlePR;
155-
}
156-
157-
return PR_NUMBER;
66+
function fromNpm(command: string) {
67+
return baseDir(`./node_modules/.bin/${command}`);
15868
}

modules/component-store/schematics-core/utility/change.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ export class InsertChange implements Change {
4949
order: number;
5050
description: string;
5151

52-
constructor(public path: string, public pos: number, public toAdd: string) {
52+
constructor(
53+
public path: string,
54+
public pos: number,
55+
public toAdd: string
56+
) {
5357
if (pos < 0) {
5458
throw new Error('Negative positions are invalid');
5559
}
@@ -77,7 +81,11 @@ export class RemoveChange implements Change {
7781
order: number;
7882
description: string;
7983

80-
constructor(public path: string, public pos: number, public end: number) {
84+
constructor(
85+
public path: string,
86+
public pos: number,
87+
public end: number
88+
) {
8189
if (pos < 0 || end < 0) {
8290
throw new Error('Negative positions are invalid');
8391
}

modules/component-store/spec/component-store.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,8 @@ describe('Component Store', () => {
225225
const UPDATED_STATE = { updatedState: 'proccessed' };
226226

227227
// Record all the values that go through state$.
228-
const recordedStateValues$ = componentStore.state$.pipe(
229-
publishReplay()
230-
);
228+
const recordedStateValues$ =
229+
componentStore.state$.pipe(publishReplay());
231230
// Need to "connect" to start getting notifications.
232231
(recordedStateValues$ as ConnectableObservable<object>).connect();
233232

@@ -410,9 +409,8 @@ describe('Component Store', () => {
410409
);
411410

412411
// Record all the values that go through state$.
413-
const recordedStateValues$ = componentStore.state$.pipe(
414-
publishReplay()
415-
);
412+
const recordedStateValues$ =
413+
componentStore.state$.pipe(publishReplay());
416414
// Need to "connect" to start getting notifications.
417415
(recordedStateValues$ as ConnectableObservable<object>).connect();
418416

modules/component-store/src/component-store.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export class ComponentStore<T extends object> implements OnDestroy {
131131
// Return either an empty callback or a function requiring specific types as inputs
132132
ReturnType = OriginType extends void
133133
? () => void
134-
: (observableOrValue: ValueType | Observable<ValueType>) => Subscription
134+
: (observableOrValue: ValueType | Observable<ValueType>) => Subscription,
135135
>(updaterFn: (state: T, value: OriginType) => T): ReturnType {
136136
return ((
137137
observableOrValue?: OriginType | Observable<OriginType>
@@ -262,14 +262,14 @@ export class ComponentStore<T extends object> implements OnDestroy {
262262
select<Selectors extends Observable<unknown>[], Result>(
263263
...selectorsWithProjector: [
264264
...selectors: Selectors,
265-
projector: Projector<Selectors, Result>
265+
projector: Projector<Selectors, Result>,
266266
]
267267
): Observable<Result>;
268268
select<Selectors extends Observable<unknown>[], Result>(
269269
...selectorsWithProjectorAndConfig: [
270270
...selectors: Selectors,
271271
projector: Projector<Selectors, Result>,
272-
config: SelectConfig<Result>
272+
config: SelectConfig<Result>,
273273
]
274274
): Observable<Result>;
275275
select<
@@ -278,7 +278,7 @@ export class ComponentStore<T extends object> implements OnDestroy {
278278
>,
279279
Result,
280280
ProjectorFn extends (...a: unknown[]) => Result,
281-
SelectorsObject extends Record<string, Observable<unknown>>
281+
SelectorsObject extends Record<string, Observable<unknown>>,
282282
>(...args: Selectors): Observable<Result> {
283283
const { observablesOrSelectorsObject, projector, config } =
284284
processSelectorArgs<Selectors, Result, ProjectorFn, SelectorsObject>(
@@ -329,20 +329,20 @@ export class ComponentStore<T extends object> implements OnDestroy {
329329
...args: [
330330
...signals: Signals,
331331
projector: SignalsProjector<Signals, Result>,
332-
options: SelectSignalOptions<Result>
332+
options: SelectSignalOptions<Result>,
333333
]
334334
): Signal<Result>;
335335
selectSignal(
336336
...args:
337337
| [(state: T) => unknown, SelectSignalOptions<unknown>?]
338338
| [
339339
...signals: Signal<unknown>[],
340-
projector: (...values: unknown[]) => unknown
340+
projector: (...values: unknown[]) => unknown,
341341
]
342342
| [
343343
...signals: Signal<unknown>[],
344344
projector: (...values: unknown[]) => unknown,
345-
options: SelectSignalOptions<unknown>
345+
options: SelectSignalOptions<unknown>,
346346
]
347347
): Signal<unknown> {
348348
const selectSignalArgs = [...args];
@@ -391,7 +391,7 @@ export class ComponentStore<T extends object> implements OnDestroy {
391391
) => Subscription
392392
: (
393393
observableOrValue: ObservableType | Observable<ObservableType>
394-
) => Subscription
394+
) => Subscription,
395395
>(generator: (origin$: OriginType) => Observable<unknown>): ReturnType {
396396
const origin$ = new Subject<ObservableType>();
397397
generator(origin$ as OriginType)
@@ -456,7 +456,7 @@ function processSelectorArgs<
456456
>,
457457
Result,
458458
ProjectorFn extends (...a: unknown[]) => Result,
459-
SelectorsObject extends Record<string, Observable<unknown>>
459+
SelectorsObject extends Record<string, Observable<unknown>>,
460460
>(
461461
args: Selectors
462462
):

0 commit comments

Comments
 (0)