Skip to content

Commit

Permalink
refactor: devScripts update (#173)
Browse files Browse the repository at this point in the history
* chore: updates from devScripts

* test: timeout could be undefined

---------

Co-authored-by: mshanemc <[email protected]>
  • Loading branch information
svc-cli-bot and mshanemc authored Feb 28, 2023
1 parent e2eea56 commit ba7a6f5
Show file tree
Hide file tree
Showing 4 changed files with 2,618 additions and 782 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ coverage
docs

# -- CLEAN ALL
*.tsbuildinfo
.eslintcache
.wireit
node_modules

# --
Expand Down
89 changes: 80 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
"vendor/lodash.js"
],
"scripts": {
"build": "sf-build",
"build": "wireit",
"ci-docs": "yarn sf-ci-docs",
"clean": "sf-clean",
"clean-all": "sf-clean all",
"compile": "sf-compile",
"compile": "wireit",
"docs": "sf-docs",
"format": "sf-format",
"lint": "sf-lint",
"format": "wireit",
"lint": "wireit",
"lint-fix": "yarn sf-lint --fix",
"lodash": "./scripts/build-lodash.sh",
"postcompile": "shx cp -r src/nodash/support.d.ts lib/nodash",
"prepack": "sf-prepack",
"prepare": "sf-install",
"pretest": "sf-compile-test",
"test": "sf-test"
"test": "wireit",
"test:only": "wireit"
},
"dependencies": {
"@salesforce/ts-types": "^1.7.3",
Expand All @@ -36,7 +36,7 @@
},
"devDependencies": {
"@salesforce/dev-config": "^3.0.0",
"@salesforce/dev-scripts": "^3.1.0",
"@salesforce/dev-scripts": "^4.1.1",
"@salesforce/prettier-config": "^0.0.2",
"@typescript-eslint/eslint-plugin": "^5.44.0",
"@typescript-eslint/parser": "^5.53.0",
Expand All @@ -58,6 +58,77 @@
"pretty-quick": "^3.1.0",
"sinon": "10.0.0",
"ts-node": "^10.0.0",
"typescript": "^4.9.5"
"typescript": "^4.9.5",
"wireit": "^0.9.5"
},
"wireit": {
"build": {
"dependencies": [
"compile",
"lint"
]
},
"compile": {
"command": "tsc -p . --pretty --incremental",
"files": [
"src/**/*.ts",
"tsconfig.json",
"messages/**"
],
"output": [
"lib/**",
"*.tsbuildinfo"
],
"clean": "if-file-deleted"
},
"format": {
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
"files": [
"src/**/*.ts",
"test/**/*.ts",
"schemas/**/*.json",
"command-snapshot.json",
".prettier*"
],
"output": []
},
"lint": {
"command": "eslint src test --color --cache --cache-location .eslintcache",
"files": [
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
".eslint*"
],
"output": []
},
"test:compile": {
"command": "tsc -p \"./test\" --pretty",
"files": [
"test/**/*.ts",
"tsconfig.json",
"test/tsconfig.json"
],
"output": []
},
"test": {
"dependencies": [
"test:only",
"test:compile"
]
},
"test:only": {
"command": "nyc mocha \"test/**/*.test.ts\"",
"files": [
"test/**/*.ts",
"src/**/*.ts",
"tsconfig.json",
".mocha*",
"test/tsconfig.json",
"!*.nut.ts",
".nycrc"
],
"output": []
}
}
}
}
8 changes: 6 additions & 2 deletions src/throttledPromiseAll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export class ThrottledPromiseAll<T, O = T> {
timeoutPromise = new Promise((resolve, reject) => {
this.timeout = setTimeout(() => {
try {
clearTimeout(this.timeout);
if (this.timeout) {
clearTimeout(this.timeout);
}
this.stop();
reject(new Error(`PromiseQueue timed out after ${this.wait.milliseconds} milliseconds`));
} catch (e) {
Expand All @@ -115,7 +117,9 @@ export class ThrottledPromiseAll<T, O = T> {
}

private stop(): void {
clearTimeout(this.timeout);
if (this.timeout) {
clearTimeout(this.timeout);
}
this.queue.splice(0, this.queue.length);
}

Expand Down
Loading

0 comments on commit ba7a6f5

Please sign in to comment.