eject 1.0.2 → 1.0.3-commit-71cd9bd
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/README.md +0 -3
- package/dist/esm/command.d.ts +4 -0
- package/{src/command.ts → dist/esm/command.js} +26 -35
- package/dist/esm/config.d.ts +4 -0
- package/dist/esm/config.js +4 -0
- package/dist/esm/git.d.ts +4 -0
- package/{src/git.ts → dist/esm/git.js} +5 -7
- package/dist/esm/index.d.ts +1 -0
- package/{src/index.ts → dist/esm/index.js} +1 -9
- package/dist/esm/log.d.ts +4 -0
- package/dist/esm/log.js +13 -0
- package/dist/esm/system.d.ts +7 -0
- package/{src/system.ts → dist/esm/system.js} +31 -78
- package/package.json +10 -4
- package/.prettierignore +0 -9
- package/.prettierrc +0 -5
- package/CHANGELOG.md +0 -17
- package/src/config.ts +0 -5
- package/src/log.ts +0 -17
- package/tests/system.spec.ts +0 -7
- package/tsconfig.json +0 -113
package/README.md
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
> [!WARNING]
|
|
2
|
-
> This package is work-in-progress and doesn't work yet.
|
|
3
|
-
|
|
4
1
|
# Eject
|
|
5
2
|
|
|
6
3
|
This package is written to eject dependencies from your project. It will copy all the files and folders to an `ejected` folder and remove it from node_modules. It will automatically update the package.json file an link the dependencies to the ejected folder.
|
|
@@ -1,66 +1,57 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import { config } from './config.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
isGitHistoryClean,
|
|
7
|
-
isGitInstalled,
|
|
8
|
-
} from './git.js';
|
|
9
|
-
import { errorLog, infoLog, warnLog } from './log.js';
|
|
10
|
-
import {
|
|
11
|
-
copyDependency,
|
|
12
|
-
dependencyManagerAction,
|
|
13
|
-
detectPackageManager,
|
|
14
|
-
updatePackageJson,
|
|
15
|
-
} from './system.js';
|
|
3
|
+
import { amendCommit, commitEjection, isGitHistoryClean, isGitInstalled, } from './git.js';
|
|
4
|
+
import { errorLog, warnLog } from './log.js';
|
|
5
|
+
import { copyDependency, dependencyManagerAction, detectPackageManager, updatePackageJson, } from './system.js';
|
|
16
6
|
import { execSync } from 'child_process';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
export function eject(dependency, options) {
|
|
8
|
+
if (options.verbose) {
|
|
9
|
+
console.log({
|
|
10
|
+
dependency,
|
|
11
|
+
options,
|
|
12
|
+
isCI: process.env.GITHUB_ACTIONS,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
22
15
|
if (!options.force && !isGitInstalled()) {
|
|
23
|
-
warnLog(
|
|
24
|
-
'Git is not installed, please install git or use --force to bypass git check',
|
|
25
|
-
);
|
|
16
|
+
warnLog('Git is not installed, please install git or use --force to bypass git check');
|
|
26
17
|
return;
|
|
27
18
|
}
|
|
28
19
|
if (!options.force && !isGitHistoryClean()) {
|
|
29
|
-
warnLog(
|
|
30
|
-
'Please commit your changes before ejecting dependencies or use --force to bypass git history',
|
|
31
|
-
);
|
|
20
|
+
warnLog('Please commit your changes before ejecting dependencies or use --force to bypass git history');
|
|
32
21
|
return;
|
|
33
22
|
}
|
|
34
23
|
let successfulEjected = false;
|
|
35
24
|
try {
|
|
36
25
|
copyDependency(dependency);
|
|
37
26
|
successfulEjected = true;
|
|
38
|
-
}
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
39
29
|
if (options.verbose) {
|
|
40
30
|
errorLog('Error ejecting dependency:', dependency);
|
|
31
|
+
console.error(error);
|
|
41
32
|
}
|
|
42
33
|
}
|
|
43
|
-
|
|
44
34
|
if (successfulEjected) {
|
|
45
35
|
console.log('✅ Ejected dependencies:', chalk.bold(dependency));
|
|
46
|
-
}
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
47
38
|
console.log('❌ Ejected dependencies: ', chalk.bold(dependency));
|
|
48
|
-
return;
|
|
39
|
+
return 150;
|
|
49
40
|
}
|
|
50
41
|
const { packageManager, lockFile } = detectPackageManager();
|
|
51
42
|
updatePackageJson(dependency, packageManager === 'pnpm' ? 'link' : 'file');
|
|
52
43
|
commitEjection(config.COMMIT_MESSAGE);
|
|
53
44
|
const needsToCommit = dependencyManagerAction(packageManager);
|
|
54
|
-
if (needsToCommit)
|
|
55
|
-
|
|
45
|
+
if (needsToCommit)
|
|
46
|
+
amendCommit();
|
|
47
|
+
let installCmd = `${packageManager} install`;
|
|
48
|
+
if (process.env.GITHUB_ACTIONS && packageManager === 'pnpm') {
|
|
49
|
+
installCmd = 'pnpm install --no-frozen-lockfile';
|
|
50
|
+
}
|
|
56
51
|
const installLog = chalk.bold(installCmd);
|
|
57
52
|
console.log(`📦 Running ${installLog} to update ${chalk.bold(lockFile)}`);
|
|
58
53
|
execSync(installCmd, { stdio: 'inherit' });
|
|
59
54
|
console.log(`✅ ${installLog} done`);
|
|
60
55
|
amendCommit();
|
|
61
|
-
console.log(
|
|
62
|
-
'➡️ Run',
|
|
63
|
-
chalk.bold('git show HEAD'),
|
|
64
|
-
'to see the ejected code',
|
|
65
|
-
);
|
|
56
|
+
console.log('➡️ Run', chalk.bold('git show HEAD'), 'to see the ejected code');
|
|
66
57
|
}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import { execSync } from 'child_process';
|
|
2
|
-
|
|
3
|
-
export function commitEjection(commitMessage: string = 'Eject dependencies') {
|
|
2
|
+
export function commitEjection(commitMessage = 'Eject dependencies') {
|
|
4
3
|
execSync('git add .');
|
|
5
4
|
execSync(`git commit -m "${commitMessage}"`);
|
|
6
5
|
}
|
|
7
|
-
|
|
8
6
|
export function amendCommit() {
|
|
9
7
|
execSync('git add -A');
|
|
10
8
|
execSync(`git commit --amend --no-edit`);
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
export function isGitInstalled() {
|
|
14
11
|
try {
|
|
15
12
|
execSync('git --version');
|
|
16
13
|
return true;
|
|
17
|
-
}
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
18
16
|
return false;
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
export function isGitHistoryClean() {
|
|
23
20
|
try {
|
|
24
21
|
execSync('git diff --exit-code');
|
|
25
22
|
return true;
|
|
26
|
-
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
27
25
|
return false;
|
|
28
26
|
}
|
|
29
27
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import { cac } from 'cac';
|
|
2
|
-
|
|
3
2
|
import { eject } from './command.js';
|
|
4
3
|
import { config } from './config.js';
|
|
5
|
-
|
|
6
4
|
const cli = cac('eject');
|
|
7
|
-
|
|
8
5
|
cli.command('<dependencies>', 'Ejects a dependency from node_modules', {
|
|
9
6
|
allowUnknownOptions: true,
|
|
10
7
|
})
|
|
11
8
|
.option('-f, --force', 'Bypass git history check')
|
|
12
9
|
.option('-v, --verbose', 'Verbose output')
|
|
13
10
|
.action(eject);
|
|
14
|
-
|
|
15
11
|
cli.help();
|
|
16
12
|
cli.version(config.projectVersion);
|
|
17
|
-
|
|
18
|
-
cli.parse(
|
|
19
|
-
process.argv.length === 2 ? [...process.argv, '--help'] : process.argv,
|
|
20
|
-
);
|
|
21
|
-
|
|
13
|
+
cli.parse(process.argv.length === 2 ? [...process.argv, '--help'] : process.argv);
|
|
22
14
|
process.on('unhandledRejection', (rejectValue) => {
|
|
23
15
|
throw rejectValue;
|
|
24
16
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function successLog(message?: unknown, ...optionalParams: unknown[]): void;
|
|
2
|
+
export declare function errorLog(message?: unknown, ...optionalParams: unknown[]): void;
|
|
3
|
+
export declare function infoLog(message?: unknown, ...optionalParams: unknown[]): void;
|
|
4
|
+
export declare function warnLog(message?: unknown, ...optionalParams: unknown[]): void;
|
package/dist/esm/log.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
export function successLog(message, ...optionalParams) {
|
|
3
|
+
console.log(chalk.green(message, optionalParams));
|
|
4
|
+
}
|
|
5
|
+
export function errorLog(message, ...optionalParams) {
|
|
6
|
+
console.log(chalk.red(message, optionalParams));
|
|
7
|
+
}
|
|
8
|
+
export function infoLog(message, ...optionalParams) {
|
|
9
|
+
console.log(chalk.blue(message, optionalParams));
|
|
10
|
+
}
|
|
11
|
+
export function warnLog(message, ...optionalParams) {
|
|
12
|
+
console.log(chalk.yellow(message, optionalParams));
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function updatePackageJson(ejectedDependency: string, protocol?: string): boolean;
|
|
2
|
+
export declare function copyDependency(dependency: string): void;
|
|
3
|
+
export declare function detectPackageManager(currentDir?: string, depth?: number): {
|
|
4
|
+
packageManager: string;
|
|
5
|
+
lockFile: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function dependencyManagerAction(packageManager: string): boolean;
|
|
@@ -2,75 +2,46 @@ import { resolve } from 'path';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import assert from 'assert';
|
|
4
4
|
import { parse, stringify } from 'yaml';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ejectedDependency
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
const packageJson = JSON.parse(
|
|
11
|
-
fs.readFileSync(resolve('./package.json'), 'utf-8'),
|
|
12
|
-
);
|
|
13
|
-
packageJson['devDependencies'] = setPathAsVersion(
|
|
14
|
-
packageJson['devDependencies'],
|
|
15
|
-
ejectedDependency,
|
|
16
|
-
protocol,
|
|
17
|
-
);
|
|
18
|
-
packageJson['dependencies'] = setPathAsVersion(
|
|
19
|
-
packageJson['dependencies'],
|
|
20
|
-
ejectedDependency,
|
|
21
|
-
protocol,
|
|
22
|
-
);
|
|
23
|
-
fs.writeFileSync(
|
|
24
|
-
resolve('./package.json'),
|
|
25
|
-
JSON.stringify(packageJson, null, 2),
|
|
26
|
-
);
|
|
5
|
+
export function updatePackageJson(ejectedDependency, protocol = 'file') {
|
|
6
|
+
const packageJson = JSON.parse(fs.readFileSync(resolve('./package.json'), 'utf-8'));
|
|
7
|
+
packageJson['devDependencies'] = setPathAsVersion(packageJson['devDependencies'], ejectedDependency, protocol);
|
|
8
|
+
packageJson['dependencies'] = setPathAsVersion(packageJson['dependencies'], ejectedDependency, protocol);
|
|
9
|
+
fs.writeFileSync(resolve('./package.json'), JSON.stringify(packageJson, null, 2));
|
|
27
10
|
return true;
|
|
28
11
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
dependencies: Record<string, string>,
|
|
32
|
-
ejectedDependency: string,
|
|
33
|
-
protocol: string = 'file',
|
|
34
|
-
) {
|
|
35
|
-
const updatedDependencies: Record<string, string> = {};
|
|
12
|
+
function setPathAsVersion(dependencies, ejectedDependency, protocol = 'file') {
|
|
13
|
+
const updatedDependencies = {};
|
|
36
14
|
for (const key in dependencies) {
|
|
37
15
|
if (ejectedDependency !== key) {
|
|
38
|
-
updatedDependencies[key] = dependencies[key]
|
|
39
|
-
}
|
|
16
|
+
updatedDependencies[key] = dependencies[key];
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
40
19
|
updatedDependencies[key] = `${protocol}:./ejected/${key}`;
|
|
41
20
|
}
|
|
42
21
|
}
|
|
43
22
|
return updatedDependencies;
|
|
44
23
|
}
|
|
45
|
-
|
|
46
|
-
export function copyDependency(dependency: string) {
|
|
24
|
+
export function copyDependency(dependency) {
|
|
47
25
|
const dependencyPath = resolve('./node_modules', dependency);
|
|
48
26
|
if (!fs.existsSync(dependencyPath)) {
|
|
49
27
|
throw new Error('Dependency not found in node_modules');
|
|
50
28
|
}
|
|
51
|
-
|
|
52
29
|
if (!fs.existsSync('./ejected')) {
|
|
53
30
|
fs.mkdirSync('./ejected');
|
|
54
31
|
}
|
|
55
32
|
if (fs.existsSync(resolve('./ejected', dependency))) {
|
|
56
33
|
throw new Error('Dependency already ejected');
|
|
57
34
|
}
|
|
58
|
-
|
|
59
35
|
fs.cpSync(dependencyPath, resolve('./ejected', dependency), {
|
|
60
36
|
recursive: true,
|
|
61
37
|
force: true,
|
|
62
38
|
dereference: true,
|
|
63
39
|
});
|
|
64
40
|
}
|
|
65
|
-
|
|
66
|
-
export function detectPackageManager(
|
|
67
|
-
currentDir: string = './',
|
|
68
|
-
depth: number = 0,
|
|
69
|
-
) {
|
|
41
|
+
export function detectPackageManager(currentDir = './', depth = 0) {
|
|
70
42
|
if (depth > 20) {
|
|
71
43
|
throw new Error('No lock file found');
|
|
72
44
|
}
|
|
73
|
-
|
|
74
45
|
// scan for lock files
|
|
75
46
|
const lockFiles = [
|
|
76
47
|
'yarn.lock',
|
|
@@ -78,83 +49,65 @@ export function detectPackageManager(
|
|
|
78
49
|
'pnpm-lock.yaml',
|
|
79
50
|
'bun.lock',
|
|
80
51
|
];
|
|
81
|
-
|
|
82
|
-
const foundLockFiles = lockFiles.filter((lockFile) =>
|
|
83
|
-
fs.existsSync(resolve(currentDir, lockFile)),
|
|
84
|
-
);
|
|
85
|
-
|
|
52
|
+
const foundLockFiles = lockFiles.filter((lockFile) => fs.existsSync(resolve(currentDir, lockFile)));
|
|
86
53
|
if (foundLockFiles.length === 0) {
|
|
87
54
|
return detectPackageManager(resolve(currentDir, '..'), depth + 1);
|
|
88
55
|
}
|
|
89
|
-
|
|
90
56
|
if (foundLockFiles.length > 1) {
|
|
91
57
|
throw new Error('Multiple lock files found');
|
|
92
58
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
let packageManager: string | undefined;
|
|
59
|
+
const lockFile = foundLockFiles[0];
|
|
60
|
+
let packageManager;
|
|
96
61
|
if (lockFile === 'yarn.lock') {
|
|
97
62
|
packageManager = 'yarn';
|
|
98
|
-
}
|
|
63
|
+
}
|
|
64
|
+
else if (lockFile === 'package-lock.json') {
|
|
99
65
|
packageManager = 'npm';
|
|
100
|
-
}
|
|
66
|
+
}
|
|
67
|
+
else if (lockFile === 'pnpm-lock.yaml') {
|
|
101
68
|
packageManager = 'pnpm';
|
|
102
|
-
}
|
|
69
|
+
}
|
|
70
|
+
else if (lockFile === 'bun.lock') {
|
|
103
71
|
packageManager = 'bun';
|
|
104
72
|
}
|
|
105
73
|
assert(packageManager);
|
|
106
74
|
return { packageManager, lockFile };
|
|
107
75
|
}
|
|
108
|
-
|
|
109
|
-
function detectWorkspaceFile(currentDir: string = './', depth: number = 0) {
|
|
76
|
+
function detectWorkspaceFile(currentDir = './', depth = 0) {
|
|
110
77
|
if (depth > 20) {
|
|
111
78
|
return undefined;
|
|
112
79
|
}
|
|
113
|
-
|
|
114
80
|
const workspaceFiles = ['pnpm-workspace.yaml', 'yarn-workspace.json'];
|
|
115
|
-
|
|
116
|
-
const foundWorkspaceFiles = workspaceFiles.filter((workspaceFile) =>
|
|
117
|
-
fs.existsSync(resolve(currentDir, workspaceFile)),
|
|
118
|
-
);
|
|
119
|
-
|
|
81
|
+
const foundWorkspaceFiles = workspaceFiles.filter((workspaceFile) => fs.existsSync(resolve(currentDir, workspaceFile)));
|
|
120
82
|
if (foundWorkspaceFiles.length === 0) {
|
|
121
83
|
return detectWorkspaceFile(resolve(currentDir, '..'), depth + 1);
|
|
122
84
|
}
|
|
123
|
-
|
|
124
85
|
if (foundWorkspaceFiles.length > 1) {
|
|
125
86
|
throw new Error('Multiple workspace files found');
|
|
126
87
|
}
|
|
127
|
-
|
|
128
88
|
return foundWorkspaceFiles[0];
|
|
129
89
|
}
|
|
130
|
-
|
|
131
90
|
function pnpm() {
|
|
132
91
|
const workspaceFile = detectWorkspaceFile();
|
|
133
92
|
if (!workspaceFile) {
|
|
134
|
-
fs.writeFileSync(
|
|
135
|
-
'./pnpm-workspace.yaml',
|
|
136
|
-
stringify({ packages: [`ejected/*`] }),
|
|
137
|
-
);
|
|
93
|
+
fs.writeFileSync('./pnpm-workspace.yaml', stringify({ packages: [`ejected/*`] }));
|
|
138
94
|
return true;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
)
|
|
143
|
-
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
const workspace = parse(fs.readFileSync(resolve('./', workspaceFile), 'utf-8'));
|
|
98
|
+
if (workspace.packages.includes('ejected/*'))
|
|
99
|
+
return false;
|
|
144
100
|
workspace.packages.push('ejected/*');
|
|
145
101
|
fs.writeFileSync(resolve('./', workspaceFile), stringify(workspace));
|
|
146
102
|
return true;
|
|
147
103
|
}
|
|
148
104
|
}
|
|
149
|
-
|
|
150
105
|
const action = {
|
|
151
106
|
pnpm,
|
|
152
107
|
};
|
|
153
|
-
|
|
154
|
-
export function dependencyManagerAction(packageManager: string) {
|
|
108
|
+
export function dependencyManagerAction(packageManager) {
|
|
155
109
|
if (packageManager in action) {
|
|
156
|
-
return action[packageManager
|
|
110
|
+
return action[packageManager]();
|
|
157
111
|
}
|
|
158
|
-
|
|
159
112
|
return false;
|
|
160
113
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eject",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3-commit-71cd9bd",
|
|
4
4
|
"description": "This package helps you to eject dependencies from node_modules easily",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/*",
|
|
9
|
+
"bin-entry.js"
|
|
10
|
+
],
|
|
7
11
|
"repository": {
|
|
8
12
|
"type": "git",
|
|
9
13
|
"url": "git+https://github.com/snake-py/eject.git"
|
|
@@ -23,10 +27,10 @@
|
|
|
23
27
|
"yaml": "^2.6.1"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
|
-
"@brillout/release-me": "^0.
|
|
30
|
+
"@brillout/release-me": "^0.5.10",
|
|
27
31
|
"@types/node": "^22.9.0",
|
|
28
32
|
"prettier": "^3.3.3",
|
|
29
|
-
"typescript": "^
|
|
33
|
+
"typescript": "^7.0.2",
|
|
30
34
|
"vitest": "^2.1.4"
|
|
31
35
|
},
|
|
32
36
|
"bin": {
|
|
@@ -41,6 +45,8 @@
|
|
|
41
45
|
"release": "release-me patch",
|
|
42
46
|
"release:minor": "release-me minor",
|
|
43
47
|
"release:major": "release-me major",
|
|
44
|
-
"release:commit": "release-me commit"
|
|
48
|
+
"release:commit": "release-me commit",
|
|
49
|
+
"test:e2e:base": "node ./tests/e2e/base.js $npm_config_dependency $npm_config_dpath $npm_config_dmanager",
|
|
50
|
+
"test:e2e:pnpm": "node ./tests/e2e/pnpm.js $npm_config_dependency $npm_config_dpath $npm_config_dmanager"
|
|
45
51
|
}
|
|
46
52
|
}
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
## [1.0.2](https://github.com/snake-py/eject/compare/v1.0.1...v1.0.2) (2024-11-28)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## [1.0.1](https://github.com/snake-py/eject/compare/v1.0.0...v1.0.1) (2024-11-15)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* use `link:` protocol instead of `file:` ([40cbab3](https://github.com/snake-py/eject/commit/40cbab318c94ebf9953e90ffa4f9b739e0282f80))
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# 1.0.0 (2024-11-15)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
package/src/config.ts
DELETED
package/src/log.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
|
|
3
|
-
export function successLog(message?: unknown, ...optionalParams: unknown[]) {
|
|
4
|
-
console.log(chalk.green(message, optionalParams));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function errorLog(message?: unknown, ...optionalParams: unknown[]) {
|
|
8
|
-
console.log(chalk.red(message, optionalParams));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function infoLog(message?: unknown, ...optionalParams: unknown[]) {
|
|
12
|
-
console.log(chalk.blue(message, optionalParams));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function warnLog(message?: unknown, ...optionalParams: unknown[]) {
|
|
16
|
-
console.log(chalk.yellow(message, optionalParams));
|
|
17
|
-
}
|
package/tests/system.spec.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
-
"lib": [
|
|
16
|
-
"ES2021"
|
|
17
|
-
] /* Specify a set of bundled library declaration files that describe the target runtime environment. */,
|
|
18
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
19
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
20
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
21
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
22
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
23
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
24
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
25
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
26
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
27
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
28
|
-
|
|
29
|
-
/* Modules */
|
|
30
|
-
"module": "Node16" /* Specify what module code is generated. */,
|
|
31
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
32
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
33
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
34
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
35
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
36
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
37
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
38
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
39
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
40
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
41
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
42
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
43
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
44
|
-
"resolveJsonModule": true /* Enable importing .json files. */,
|
|
45
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
46
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
47
|
-
|
|
48
|
-
/* JavaScript Support */
|
|
49
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
50
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
51
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
52
|
-
|
|
53
|
-
/* Emit */
|
|
54
|
-
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
55
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
56
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
57
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
59
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
60
|
-
"outDir": "./dist/esm/" /* Specify an output folder for all emitted files. */,
|
|
61
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
62
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
63
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
64
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
65
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
66
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
67
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
68
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
69
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
70
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
71
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
72
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
73
|
-
"noEmitOnError": true /* Disable emitting files if any type checking errors are reported. */,
|
|
74
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
75
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
76
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
77
|
-
|
|
78
|
-
/* Interop Constraints */
|
|
79
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
80
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
81
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
82
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
83
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
84
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
85
|
-
|
|
86
|
-
/* Type Checking */
|
|
87
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
88
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
89
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
90
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
91
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
92
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
93
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
94
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
95
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
96
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
97
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
98
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
99
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
100
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
101
|
-
"noUncheckedIndexedAccess": true /* Add 'undefined' to a type when accessed using an index. */,
|
|
102
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
103
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
104
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
105
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
106
|
-
|
|
107
|
-
/* Completeness */
|
|
108
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
109
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
110
|
-
},
|
|
111
|
-
"include": ["./src/**/*.ts"],
|
|
112
|
-
"exclude": ["**/*.spec.ts", "./node_modules/", "./dist/"]
|
|
113
|
-
}
|