@naturalcycles/dev-lib 19.0.1 → 19.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build.util.js +5 -2
- package/dist/lint.util.d.ts +1 -0
- package/dist/lint.util.js +4 -3
- package/package.json +1 -1
package/dist/build.util.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { exec2, fs2, kpySync } from '@naturalcycles/nodejs-lib';
|
|
2
|
+
import { findPackageBinPath } from './lint.util.js';
|
|
2
3
|
export async function buildProd() {
|
|
3
4
|
fs2.emptyDir('./dist'); // it doesn't delete the dir itself, to prevent IDE jumping
|
|
4
5
|
buildCopy();
|
|
@@ -25,14 +26,16 @@ export async function runTSCInFolder(tsconfigPath, args = []) {
|
|
|
25
26
|
// console.log(`Skipping to run tsc for ${tsconfigPath}, as it doesn't exist`)
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
+
const tscPath = findPackageBinPath('typescript', 'tsc');
|
|
30
|
+
await exec2.spawnAsync(tscPath, {
|
|
29
31
|
args: ['-P', tsconfigPath, ...args],
|
|
30
32
|
shell: false,
|
|
31
33
|
});
|
|
32
34
|
}
|
|
33
35
|
export async function runTSCProd(args = []) {
|
|
34
36
|
const tsconfigPath = [`./tsconfig.prod.json`].find(p => fs2.pathExists(p)) || 'tsconfig.json';
|
|
35
|
-
|
|
37
|
+
const tscPath = findPackageBinPath('typescript', 'tsc');
|
|
38
|
+
await exec2.spawnAsync(tscPath, {
|
|
36
39
|
args: ['-P', tsconfigPath, '--noEmit', 'false', '--noCheck', ...args],
|
|
37
40
|
shell: false,
|
|
38
41
|
});
|
package/dist/lint.util.d.ts
CHANGED
|
@@ -18,4 +18,5 @@ export declare function runCommitlintCommand(): void;
|
|
|
18
18
|
export declare function requireActionlintVersion(): void;
|
|
19
19
|
export declare function getActionLintVersion(): SemVerString | undefined;
|
|
20
20
|
export declare function runBiome(fix?: boolean): void;
|
|
21
|
+
export declare function findPackageBinPath(pkg: string, cmd: string): string;
|
|
21
22
|
export {};
|
package/dist/lint.util.js
CHANGED
|
@@ -108,7 +108,8 @@ export async function eslintAll(opt) {
|
|
|
108
108
|
async function runESLint(dir, eslintConfigPath, tsconfigPath, extensions = eslintExtensions.split(','), fix = true) {
|
|
109
109
|
if (!eslintConfigPath || !existsSync(dir))
|
|
110
110
|
return; // faster to bail-out like this
|
|
111
|
-
|
|
111
|
+
const eslintPath = findPackageBinPath('eslint', 'eslint');
|
|
112
|
+
await exec2.spawnAsync(eslintPath, {
|
|
112
113
|
args: [
|
|
113
114
|
`--config`,
|
|
114
115
|
eslintConfigPath,
|
|
@@ -156,7 +157,7 @@ export function stylelintAll() {
|
|
|
156
157
|
const config = [`./stylelint.config.js`].find(f => existsSync(f));
|
|
157
158
|
if (!config)
|
|
158
159
|
return;
|
|
159
|
-
//
|
|
160
|
+
// stylelint is never hoisted from dev-lib, so, no need to search for its path
|
|
160
161
|
exec2.spawn('stylelint', {
|
|
161
162
|
args: [fix ? `--fix` : '', `--allow-empty-input`, `--config`, config, ...stylelintPaths].filter(Boolean),
|
|
162
163
|
shell: false,
|
|
@@ -260,7 +261,7 @@ function gitStatus() {
|
|
|
260
261
|
catch { }
|
|
261
262
|
}
|
|
262
263
|
const require = createRequire(import.meta.url);
|
|
263
|
-
function findPackageBinPath(pkg, cmd) {
|
|
264
|
+
export function findPackageBinPath(pkg, cmd) {
|
|
264
265
|
const packageJsonPath = require.resolve(`${pkg}/package.json`);
|
|
265
266
|
const { bin } = fs2.readJson(packageJsonPath);
|
|
266
267
|
return path.join(path.dirname(packageJsonPath), typeof bin === 'string' ? bin : bin[cmd]);
|