@saashub/qoq-knip 0.9.0 → 0.9.2

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/lib/index.cjs ADDED
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ var knipConfig = require('./knipConfig.cjs');
4
+
5
+ const jsConfig = knipConfig.getKnipConfig();
6
+ const jsReactConfig = knipConfig.getKnipConfig('.src', ['.src/index.jsx'], ['.src/**/*.{js,jsx}']);
7
+ const tsConfig = knipConfig.getKnipConfig('.src', ['.src/index.ts'], ['.src/**/*.{js,ts}'], ['package.json', 'tsconfig.json', '**/*.d.ts']);
8
+ const tsReactConfig = knipConfig.getKnipConfig('.src', ['.src/index.tsx'], ['.src/**/*.{js,jsx,ts,tsx}'], ['package.json', 'tsconfig.json', '**/*.d.ts']);
9
+
10
+ exports.jsConfig = jsConfig;
11
+ exports.jsReactConfig = jsReactConfig;
12
+ exports.tsConfig = tsConfig;
13
+ exports.tsReactConfig = tsReactConfig;
package/lib/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ export declare const jsConfig: {
2
+ entry: string[];
3
+ project: string[];
4
+ ignore: string[];
5
+ ignoreDependencies: string[];
6
+ };
7
+ export declare const jsReactConfig: {
8
+ entry: string[];
9
+ project: string[];
10
+ ignore: string[];
11
+ ignoreDependencies: string[];
12
+ };
13
+ export declare const tsConfig: {
14
+ entry: string[];
15
+ project: string[];
16
+ ignore: string[];
17
+ ignoreDependencies: string[];
18
+ };
19
+ export declare const tsReactConfig: {
20
+ entry: string[];
21
+ project: string[];
22
+ ignore: string[];
23
+ ignoreDependencies: string[];
24
+ };
package/lib/index.mjs ADDED
@@ -0,0 +1,8 @@
1
+ import { getKnipConfig } from './knipConfig.mjs';
2
+
3
+ const jsConfig = getKnipConfig();
4
+ const jsReactConfig = getKnipConfig('.src', ['.src/index.jsx'], ['.src/**/*.{js,jsx}']);
5
+ const tsConfig = getKnipConfig('.src', ['.src/index.ts'], ['.src/**/*.{js,ts}'], ['package.json', 'tsconfig.json', '**/*.d.ts']);
6
+ const tsReactConfig = getKnipConfig('.src', ['.src/index.tsx'], ['.src/**/*.{js,jsx,ts,tsx}'], ['package.json', 'tsconfig.json', '**/*.d.ts']);
7
+
8
+ export { jsConfig, jsReactConfig, tsConfig, tsReactConfig };
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ const getKnipConfig = (srcPath = '.src', entry = [`${srcPath}/index.js`], project = [`${srcPath}/**/*.js`], ignore = ['package.json'], ignoreDependencies = []) => ({
4
+ entry,
5
+ project,
6
+ ignore,
7
+ ignoreDependencies,
8
+ });
9
+
10
+ exports.getKnipConfig = getKnipConfig;
@@ -0,0 +1,6 @@
1
+ export declare const getKnipConfig: (srcPath?: string, entry?: string[], project?: string[], ignore?: string[], ignoreDependencies?: string[]) => {
2
+ entry: string[];
3
+ project: string[];
4
+ ignore: string[];
5
+ ignoreDependencies: string[];
6
+ };
@@ -0,0 +1,8 @@
1
+ const getKnipConfig = (srcPath = '.src', entry = [`${srcPath}/index.js`], project = [`${srcPath}/**/*.js`], ignore = ['package.json'], ignoreDependencies = []) => ({
2
+ entry,
3
+ project,
4
+ ignore,
5
+ ignoreDependencies,
6
+ });
7
+
8
+ export { getKnipConfig };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@saashub/qoq-knip",
3
3
  "description": "Knip configs template",
4
4
  "license": "MIT",
5
- "version": "0.9.0",
5
+ "version": "0.9.2",
6
6
  "main": "./lib/index.cjs",
7
7
  "module": "./lib/index.mjs",
8
8
  "types": "./lib/index.d.js",
@@ -36,7 +36,7 @@
36
36
  "lodash": "4.17.21"
37
37
  },
38
38
  "devDependencies": {
39
- "@saashub/qoq-cli": "^0.9.0",
39
+ "@saashub/qoq-cli": "^0.9.2",
40
40
  "@types/lodash": "4.17.7",
41
41
  "rimraf": "6.0.1",
42
42
  "rollup": "4.21.2",
@@ -55,5 +55,5 @@
55
55
  "directory": "packages/knip"
56
56
  },
57
57
  "homepage": "https://github.com/saashub-it/qoq/tree/master/packages/knip",
58
- "gitHead": "a66c128699cdadbf669da44c674cc6d312a8311a"
58
+ "gitHead": "2b61f88d462473c3ad5e6f42b967e6183ee9c84d"
59
59
  }
package/qoq.config.js DELETED
@@ -1,3 +0,0 @@
1
- const config = require("../../qoq.config");
2
-
3
- module.exports = config;
package/rollup.config.mjs DELETED
@@ -1,28 +0,0 @@
1
- import typescript from '@rollup/plugin-typescript';
2
-
3
- const sourceDir = './src';
4
- const outputDir = './lib';
5
- const input = {
6
- index: `${sourceDir}/index.ts`,
7
- knipConfig: `${sourceDir}/knipConfig.ts`,
8
- };
9
- const plugins = [typescript({
10
- exclude: ['**/*.spec.{js,ts}']
11
- })];
12
-
13
- export default {
14
- input,
15
- plugins,
16
- output: [
17
- {
18
- dir: outputDir,
19
- format: 'esm',
20
- entryFileNames: '[name].mjs',
21
- },
22
- {
23
- dir: outputDir,
24
- format: 'cjs',
25
- entryFileNames: '[name].cjs',
26
- },
27
- ],
28
- };
package/src/index.ts DELETED
@@ -1,16 +0,0 @@
1
- import { getKnipConfig } from './knipConfig';
2
-
3
- export const jsConfig = getKnipConfig();
4
- export const jsReactConfig = getKnipConfig('.src', ['.src/index.jsx'], ['.src/**/*.{js,jsx}']);
5
- export const tsConfig = getKnipConfig(
6
- '.src',
7
- ['.src/index.ts'],
8
- ['.src/**/*.{js,ts}'],
9
- ['package.json', 'tsconfig.json', '**/*.d.ts']
10
- );
11
- export const tsReactConfig = getKnipConfig(
12
- '.src',
13
- ['.src/index.tsx'],
14
- ['.src/**/*.{js,jsx,ts,tsx}'],
15
- ['package.json', 'tsconfig.json', '**/*.d.ts']
16
- );
@@ -1,85 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- import { getKnipConfig } from './knipConfig';
4
-
5
- describe('getKnipConfig', () => {
6
- it('should return default values', () => {
7
- const result = getKnipConfig();
8
- expect(result).toEqual({
9
- entry: ['.src/index.js'],
10
- project: ['.src/**/*.js'],
11
- ignore: ['package.json'],
12
- ignoreDependencies: [],
13
- });
14
- });
15
-
16
- it('should return custom srcPath', () => {
17
- const srcPath = 'custom-src';
18
- const result = getKnipConfig(srcPath);
19
- expect(result).toEqual({
20
- entry: [`${srcPath}/index.js`],
21
- project: [`${srcPath}/**/*.js`],
22
- ignore: ['package.json'],
23
- ignoreDependencies: [],
24
- });
25
- });
26
-
27
- it('should return custom entry', () => {
28
- const entry = ['custom-entry.js'];
29
- const result = getKnipConfig(undefined, entry);
30
- expect(result).toEqual({
31
- entry,
32
- project: ['.src/**/*.js'],
33
- ignore: ['package.json'],
34
- ignoreDependencies: [],
35
- });
36
- });
37
-
38
- it('should return custom project', () => {
39
- const project = ['custom-project.js'];
40
- const result = getKnipConfig(undefined, undefined, project);
41
- expect(result).toEqual({
42
- entry: ['.src/index.js'],
43
- project,
44
- ignore: ['package.json'],
45
- ignoreDependencies: [],
46
- });
47
- });
48
-
49
- it('should return custom ignore', () => {
50
- const ignore = ['custom-ignore.js'];
51
- const result = getKnipConfig(undefined, undefined, undefined, ignore);
52
- expect(result).toEqual({
53
- entry: ['.src/index.js'],
54
- project: ['.src/**/*.js'],
55
- ignore,
56
- ignoreDependencies: [],
57
- });
58
- });
59
-
60
- it('should return custom ignoreDependencies', () => {
61
- const ignoreDependencies = ['custom-ignore-dependencies.js'];
62
- const result = getKnipConfig(undefined, undefined, undefined, undefined, ignoreDependencies);
63
- expect(result).toEqual({
64
- entry: ['.src/index.js'],
65
- project: ['.src/**/*.js'],
66
- ignore: ['package.json'],
67
- ignoreDependencies,
68
- });
69
- });
70
-
71
- it('should return multiple custom values', () => {
72
- const srcPath = 'custom-src';
73
- const entry = ['custom-entry.js'];
74
- const project = ['custom-project.js'];
75
- const ignore = ['custom-ignore.js'];
76
- const ignoreDependencies = ['custom-ignore-dependencies.js'];
77
- const result = getKnipConfig(srcPath, entry, project, ignore, ignoreDependencies);
78
- expect(result).toEqual({
79
- entry,
80
- project,
81
- ignore,
82
- ignoreDependencies,
83
- });
84
- });
85
- });
package/src/knipConfig.ts DELETED
@@ -1,18 +0,0 @@
1
- export const getKnipConfig: (
2
- srcPath?: string,
3
- entry?: string[],
4
- project?: string[],
5
- ignore?: string[],
6
- ignoreDependencies?: string[]
7
- ) => { entry: string[]; project: string[]; ignore: string[]; ignoreDependencies: string[] } = (
8
- srcPath = '.src',
9
- entry = [`${srcPath}/index.js`],
10
- project = [`${srcPath}/**/*.js`],
11
- ignore = ['package.json'],
12
- ignoreDependencies = []
13
- ) => ({
14
- entry,
15
- project,
16
- ignore,
17
- ignoreDependencies,
18
- });
package/tsconfig.json DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "./lib",
5
- },
6
- "include": ["./src"]
7
- }
package/vitest.config.mjs DELETED
@@ -1,3 +0,0 @@
1
- import config from '../../vitest.config.mjs';
2
-
3
- export default config;