@aneuhold/core-ts-lib 1.1.51 → 2.0.5
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/LICENSE +21 -0
- package/lib/helperFunctions/sleep.d.ts.map +1 -1
- package/lib/helperFunctions/sleep.js +2 -4
- package/lib/helperFunctions/sleep.js.map +1 -0
- package/lib/helperFunctions/sleep.ts +8 -0
- package/lib/index.d.ts +12 -12
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +13 -26
- package/lib/index.js.map +1 -0
- package/lib/index.ts +29 -0
- package/lib/services/ArrayService.d.ts +8 -0
- package/lib/services/ArrayService.d.ts.map +1 -1
- package/lib/services/ArrayService.js +10 -4
- package/lib/services/ArrayService.js.map +1 -0
- package/lib/services/ArrayService.ts +26 -0
- package/lib/services/DateService/DateService.d.ts +8 -0
- package/lib/services/DateService/DateService.d.ts.map +1 -1
- package/lib/services/DateService/DateService.js +14 -4
- package/lib/services/DateService/DateService.js.map +1 -0
- package/lib/services/DateService/DateService.spec.ts +98 -0
- package/lib/services/DateService/DateService.ts +209 -0
- package/lib/services/DependencyService.d.ts +19 -3
- package/lib/services/DependencyService.d.ts.map +1 -1
- package/lib/services/DependencyService.js +66 -17
- package/lib/services/DependencyService.js.map +1 -0
- package/lib/services/DependencyService.ts +156 -0
- package/lib/services/FileSystemService/FileSystemService.d.ts +7 -0
- package/lib/services/FileSystemService/FileSystemService.d.ts.map +1 -1
- package/lib/services/FileSystemService/FileSystemService.js +49 -34
- package/lib/services/FileSystemService/FileSystemService.js.map +1 -0
- package/lib/services/FileSystemService/FileSystemService.spec.ts +117 -0
- package/lib/services/FileSystemService/FileSystemService.ts +185 -0
- package/lib/services/PackageService.d.ts +28 -0
- package/lib/services/PackageService.d.ts.map +1 -0
- package/lib/services/PackageService.js +131 -0
- package/lib/services/PackageService.js.map +1 -0
- package/lib/services/PackageService.ts +148 -0
- package/lib/services/StringService.d.ts.map +1 -1
- package/lib/services/StringService.js +2 -4
- package/lib/services/StringService.js.map +1 -0
- package/lib/services/StringService.ts +15 -0
- package/lib/utils/ErrorUtils.d.ts +7 -0
- package/lib/utils/ErrorUtils.d.ts.map +1 -1
- package/lib/utils/ErrorUtils.js +19 -4
- package/lib/utils/ErrorUtils.js.map +1 -0
- package/lib/utils/ErrorUtils.ts +37 -0
- package/lib/utils/Logger.d.ts +3 -0
- package/lib/utils/Logger.d.ts.map +1 -1
- package/lib/utils/Logger.js +5 -4
- package/lib/utils/Logger.js.map +1 -0
- package/lib/utils/Logger.ts +122 -0
- package/lib/utils/TestUtils.d.ts +3 -0
- package/lib/utils/TestUtils.d.ts.map +1 -1
- package/lib/utils/TestUtils.js +5 -4
- package/lib/utils/TestUtils.js.map +1 -0
- package/lib/utils/TestUtils.ts +33 -0
- package/package.json +32 -24
- package/readme.md +61 -2
- package/lib/helperFunctions/dateFunctions.d.ts +0 -10
- package/lib/helperFunctions/dateFunctions.d.ts.map +0 -1
- package/lib/helperFunctions/dateFunctions.js +0 -15
- package/lib/services/DateService/DateService.spec.d.ts +0 -2
- package/lib/services/DateService/DateService.spec.d.ts.map +0 -1
- package/lib/services/DateService/DateService.spec.js +0 -62
- package/lib/services/FileSystemService/FileSystemService.spec.d.ts +0 -2
- package/lib/services/FileSystemService/FileSystemService.spec.d.ts.map +0 -1
- package/lib/services/FileSystemService/FileSystemService.spec.js +0 -88
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { exec } from 'child_process';
|
|
2
|
+
import {
|
|
3
|
+
access,
|
|
4
|
+
appendFile,
|
|
5
|
+
cp,
|
|
6
|
+
mkdir,
|
|
7
|
+
readFile,
|
|
8
|
+
readdir,
|
|
9
|
+
rm,
|
|
10
|
+
stat,
|
|
11
|
+
writeFile
|
|
12
|
+
} from 'fs/promises';
|
|
13
|
+
import path from 'path';
|
|
14
|
+
import { promisify } from 'util';
|
|
15
|
+
import ErrorUtils from '../../utils/ErrorUtils.js';
|
|
16
|
+
import Logger from '../../utils/Logger.js';
|
|
17
|
+
import StringService from '../StringService.js';
|
|
18
|
+
|
|
19
|
+
const execAsync = promisify(exec);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* A service which can be used to interact with the file system, only in build
|
|
23
|
+
* steps.
|
|
24
|
+
*/
|
|
25
|
+
export default class FileSystemService {
|
|
26
|
+
/**
|
|
27
|
+
* Tries to add the provided snippet of text to the path provided. If the file
|
|
28
|
+
* doesn't exist, it creates it. If the folders to the file don't exist, it
|
|
29
|
+
* creates those. If the text already exists in the file, it does nothing.
|
|
30
|
+
*
|
|
31
|
+
* @param folderPath the path to the folder which contains the file that should
|
|
32
|
+
* be updated
|
|
33
|
+
*/
|
|
34
|
+
static async findAndInsertText(
|
|
35
|
+
folderPath: string,
|
|
36
|
+
fileName: string,
|
|
37
|
+
textToInsert: string
|
|
38
|
+
): Promise<void> {
|
|
39
|
+
const filePath = path.join(folderPath, fileName);
|
|
40
|
+
|
|
41
|
+
await FileSystemService.checkOrCreateFolder(folderPath);
|
|
42
|
+
|
|
43
|
+
try {
|
|
44
|
+
await access(filePath);
|
|
45
|
+
const fileContents = await readFile(filePath);
|
|
46
|
+
if (!fileContents.includes(textToInsert)) {
|
|
47
|
+
await appendFile(filePath, `\n${textToInsert}`);
|
|
48
|
+
Logger.info(`Added "${textToInsert}" to "${filePath}"`);
|
|
49
|
+
} else {
|
|
50
|
+
Logger.info(`"${textToInsert}" already exists in "${filePath}"`);
|
|
51
|
+
}
|
|
52
|
+
} catch {
|
|
53
|
+
Logger.info(
|
|
54
|
+
`File at "${filePath}" didn't exist. Creating it now and adding "${textToInsert}" to it.`
|
|
55
|
+
);
|
|
56
|
+
await writeFile(filePath, textToInsert);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Copies the contents of one folder to another folder.
|
|
62
|
+
*
|
|
63
|
+
* @param ignoreExtensions is an array with extensions that should be
|
|
64
|
+
* ignored. For example, if you want to ignore all .ts files, you would pass
|
|
65
|
+
* in ['ts'].
|
|
66
|
+
*/
|
|
67
|
+
static async copyFolderContents(
|
|
68
|
+
sourceFolderPath: string,
|
|
69
|
+
targetFolderPath: string,
|
|
70
|
+
ignoreExtensions?: string[]
|
|
71
|
+
): Promise<void> {
|
|
72
|
+
// Check if the source directory exists first
|
|
73
|
+
try {
|
|
74
|
+
await access(sourceFolderPath);
|
|
75
|
+
} catch {
|
|
76
|
+
Logger.error(`Source directory "${sourceFolderPath}" does not exist.`);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
await FileSystemService.checkOrCreateFolder(targetFolderPath);
|
|
80
|
+
|
|
81
|
+
// Get the files in the source directory
|
|
82
|
+
const sourceFilePaths =
|
|
83
|
+
await FileSystemService.getAllFilePathsRelative(sourceFolderPath);
|
|
84
|
+
|
|
85
|
+
// console.log(sourceFilePaths);
|
|
86
|
+
|
|
87
|
+
await Promise.all(
|
|
88
|
+
sourceFilePaths.map(async (sourceFilePath) => {
|
|
89
|
+
const sourceFile = path.join(sourceFolderPath, sourceFilePath);
|
|
90
|
+
const targetFile = path.join(targetFolderPath, sourceFilePath);
|
|
91
|
+
|
|
92
|
+
const sourceFileExtension =
|
|
93
|
+
StringService.getFileNameExtension(sourceFile);
|
|
94
|
+
if (
|
|
95
|
+
sourceFileExtension &&
|
|
96
|
+
ignoreExtensions?.includes(sourceFileExtension)
|
|
97
|
+
) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
await cp(sourceFile, targetFile, { recursive: true });
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
static async checkOrCreateFolder(folderPath: string): Promise<void> {
|
|
107
|
+
try {
|
|
108
|
+
await access(folderPath);
|
|
109
|
+
} catch {
|
|
110
|
+
Logger.verbose.info(
|
|
111
|
+
`Directory "${folderPath}" does not exist. Creating it now...`
|
|
112
|
+
);
|
|
113
|
+
await mkdir(folderPath, { recursive: true });
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static async deleteFolder(folderPath: string): Promise<void> {
|
|
118
|
+
try {
|
|
119
|
+
await access(folderPath);
|
|
120
|
+
} catch {
|
|
121
|
+
Logger.error(`Directory "${folderPath}" does not exist.`);
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
await rm(folderPath, { recursive: true });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Gets all the file paths in the directory provided, including all
|
|
129
|
+
* subdirectories, as an array of strings. The returned result will include
|
|
130
|
+
* the directory path provided.
|
|
131
|
+
*
|
|
132
|
+
* If only relative file paths are needed, use {@link getAllFilePathsRelative}.
|
|
133
|
+
*/
|
|
134
|
+
static async getAllFilePaths(dirPath: string): Promise<string[]> {
|
|
135
|
+
const filePaths: string[] = [];
|
|
136
|
+
const fileOrFolderNames = await readdir(dirPath);
|
|
137
|
+
|
|
138
|
+
await Promise.all(
|
|
139
|
+
fileOrFolderNames.map(async (fileOrFolder) => {
|
|
140
|
+
const absolutePath = path.join(dirPath, fileOrFolder);
|
|
141
|
+
const fileStat = await stat(absolutePath);
|
|
142
|
+
|
|
143
|
+
if (fileStat.isDirectory()) {
|
|
144
|
+
filePaths.push(...(await this.getAllFilePaths(absolutePath)));
|
|
145
|
+
} else {
|
|
146
|
+
filePaths.push(absolutePath);
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
return filePaths;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Gets all the file paths in the directory provided, including all
|
|
156
|
+
* subdirectories, as an array of strings. The returned result will not
|
|
157
|
+
* include the directory path provided.
|
|
158
|
+
*
|
|
159
|
+
* If absolute file paths are needed, use {@link getAllFilePaths}.
|
|
160
|
+
*/
|
|
161
|
+
static async getAllFilePathsRelative(dirPath: string): Promise<string[]> {
|
|
162
|
+
const filePaths = await this.getAllFilePaths(dirPath);
|
|
163
|
+
return filePaths.map((filePath) => {
|
|
164
|
+
return filePath.replace(dirPath, '');
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Checks if there are any pending uncommitted changes in the git repository
|
|
170
|
+
* in the current working directory.
|
|
171
|
+
*
|
|
172
|
+
* @returns true if there are pending changes, false otherwise.
|
|
173
|
+
*/
|
|
174
|
+
static async hasPendingChanges(): Promise<boolean> {
|
|
175
|
+
try {
|
|
176
|
+
const { stdout } = await execAsync('git status --porcelain');
|
|
177
|
+
return stdout.trim().length > 0;
|
|
178
|
+
} catch (error) {
|
|
179
|
+
Logger.error(
|
|
180
|
+
`Failed to check for pending changes: ${ErrorUtils.getErrorString(error)}`
|
|
181
|
+
);
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A service which can be used to assist in publishing or validating packages
|
|
3
|
+
* for the current project.
|
|
4
|
+
*/
|
|
5
|
+
export default class PackageService {
|
|
6
|
+
/**
|
|
7
|
+
* Validates the current project for publishing to JSR. This will check if the
|
|
8
|
+
* project has any pending changes first, then update the version of the
|
|
9
|
+
* jsr.json to match the package.json file, then run the
|
|
10
|
+
* `jsr publish --dry-run` command, and finally cleanup the changes made.
|
|
11
|
+
*/
|
|
12
|
+
static validateJsrPublish(): Promise<void>;
|
|
13
|
+
static publishToJsr(): Promise<void>;
|
|
14
|
+
static updateJsrFromPackageJson(): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Executes a dry run of JSR publishing. Returns true if the dry run was
|
|
17
|
+
* successful, false otherwise.
|
|
18
|
+
*/
|
|
19
|
+
private static publishJsrDryRun;
|
|
20
|
+
/**
|
|
21
|
+
* Publishes the current project to JSR.
|
|
22
|
+
*
|
|
23
|
+
* @returns true if the publish was successful, false otherwise.
|
|
24
|
+
*/
|
|
25
|
+
private static publishJsr;
|
|
26
|
+
private static revertGitChanges;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=PackageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageService.d.ts","sourceRoot":"./src/","sources":["services/PackageService.ts"],"names":[],"mappings":"AAWA;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC;;;;;OAKG;WACU,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC;WAenC,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;WAe7B,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuCtD;;;OAGG;mBACkB,gBAAgB;IAmBrC;;;;OAIG;mBACkB,UAAU;mBAkBV,gBAAgB;CAUtC"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { exec, spawn } from 'child_process';
|
|
2
|
+
import { access, readFile, writeFile } from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import ErrorUtils from '../utils/ErrorUtils.js';
|
|
6
|
+
import Logger from '../utils/Logger.js';
|
|
7
|
+
import FileSystemService from './FileSystemService/FileSystemService.js';
|
|
8
|
+
const execAsync = promisify(exec);
|
|
9
|
+
/**
|
|
10
|
+
* A service which can be used to assist in publishing or validating packages
|
|
11
|
+
* for the current project.
|
|
12
|
+
*/
|
|
13
|
+
export default class PackageService {
|
|
14
|
+
/**
|
|
15
|
+
* Validates the current project for publishing to JSR. This will check if the
|
|
16
|
+
* project has any pending changes first, then update the version of the
|
|
17
|
+
* jsr.json to match the package.json file, then run the
|
|
18
|
+
* `jsr publish --dry-run` command, and finally cleanup the changes made.
|
|
19
|
+
*/
|
|
20
|
+
static async validateJsrPublish() {
|
|
21
|
+
if (await FileSystemService.hasPendingChanges()) {
|
|
22
|
+
Logger.error('Please commit or stash your changes before publishing.');
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
await PackageService.updateJsrFromPackageJson();
|
|
26
|
+
const successfulDryRun = await PackageService.publishJsrDryRun();
|
|
27
|
+
await PackageService.revertGitChanges();
|
|
28
|
+
if (!successfulDryRun) {
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
Logger.success('Successfully validated JSR publishing.');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static async publishToJsr() {
|
|
36
|
+
if (await FileSystemService.hasPendingChanges()) {
|
|
37
|
+
Logger.error('Please commit or stash your changes before publishing.');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
await PackageService.updateJsrFromPackageJson();
|
|
41
|
+
const result = await PackageService.publishJsr();
|
|
42
|
+
await PackageService.revertGitChanges();
|
|
43
|
+
if (!result) {
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
Logger.success('Successfully published to JSR.');
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
static async updateJsrFromPackageJson() {
|
|
51
|
+
const rootDir = process.cwd();
|
|
52
|
+
const packageJsonPath = path.join(rootDir, 'package.json');
|
|
53
|
+
const jsrJsonPath = path.join(rootDir, 'jsr.json');
|
|
54
|
+
try {
|
|
55
|
+
await access(packageJsonPath);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
Logger.error('No package.json file found in the current directory.');
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
await access(jsrJsonPath);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
Logger.error('No jsr.json file found in the current directory.');
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
const packageJsonData = JSON.parse(await readFile(packageJsonPath, 'utf-8'));
|
|
70
|
+
const jsrJsonData = JSON.parse(await readFile(jsrJsonPath, 'utf-8'));
|
|
71
|
+
jsrJsonData.version = packageJsonData.version;
|
|
72
|
+
await writeFile(jsrJsonPath, JSON.stringify(jsrJsonData, null, 2));
|
|
73
|
+
Logger.info('Updated jsr.json from package.json to version ' + jsrJsonData.version);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
const errorString = ErrorUtils.getErrorString(error);
|
|
77
|
+
Logger.error(`Failed to update jsr.json from package.json: ${errorString}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Executes a dry run of JSR publishing. Returns true if the dry run was
|
|
82
|
+
* successful, false otherwise.
|
|
83
|
+
*/
|
|
84
|
+
static async publishJsrDryRun() {
|
|
85
|
+
Logger.info('Running `jsr publish --dry-run`');
|
|
86
|
+
try {
|
|
87
|
+
const { stdout, stderr } = await execAsync('jsr publish --allow-dirty --dry-run');
|
|
88
|
+
if (stderr) {
|
|
89
|
+
Logger.info(stderr);
|
|
90
|
+
}
|
|
91
|
+
Logger.info(stdout);
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
Logger.error(`Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`);
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Publishes the current project to JSR.
|
|
101
|
+
*
|
|
102
|
+
* @returns true if the publish was successful, false otherwise.
|
|
103
|
+
*/
|
|
104
|
+
static async publishJsr() {
|
|
105
|
+
Logger.info('Running `jsr publish`');
|
|
106
|
+
return new Promise((resolve) => {
|
|
107
|
+
const child = spawn('jsr publish', ['--allow-dirty'], {
|
|
108
|
+
stdio: 'inherit',
|
|
109
|
+
shell: true
|
|
110
|
+
});
|
|
111
|
+
child.on('exit', (code) => {
|
|
112
|
+
if (code === 0) {
|
|
113
|
+
resolve(true);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
resolve(false);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
static async revertGitChanges() {
|
|
122
|
+
Logger.info('Reverting changes made to jsr.json');
|
|
123
|
+
try {
|
|
124
|
+
await execAsync('git checkout jsr.json');
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
Logger.error(`Failed to revert changes made to jsr.json: ${ErrorUtils.getErrorString(error)}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=PackageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageService.js","sourceRoot":"./src/","sources":["services/PackageService.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { exec, spawn } from 'child_process';
|
|
2
|
+
import { access, readFile, writeFile } from 'fs/promises';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { promisify } from 'util';
|
|
5
|
+
import ErrorUtils from '../utils/ErrorUtils.js';
|
|
6
|
+
import Logger from '../utils/Logger.js';
|
|
7
|
+
import { JsonWithVersionProperty, PackageJson } from './DependencyService.js';
|
|
8
|
+
import FileSystemService from './FileSystemService/FileSystemService.js';
|
|
9
|
+
|
|
10
|
+
const execAsync = promisify(exec);
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A service which can be used to assist in publishing or validating packages
|
|
14
|
+
* for the current project.
|
|
15
|
+
*/
|
|
16
|
+
export default class PackageService {
|
|
17
|
+
/**
|
|
18
|
+
* Validates the current project for publishing to JSR. This will check if the
|
|
19
|
+
* project has any pending changes first, then update the version of the
|
|
20
|
+
* jsr.json to match the package.json file, then run the
|
|
21
|
+
* `jsr publish --dry-run` command, and finally cleanup the changes made.
|
|
22
|
+
*/
|
|
23
|
+
static async validateJsrPublish(): Promise<void> {
|
|
24
|
+
if (await FileSystemService.hasPendingChanges()) {
|
|
25
|
+
Logger.error('Please commit or stash your changes before publishing.');
|
|
26
|
+
process.exit(1);
|
|
27
|
+
}
|
|
28
|
+
await PackageService.updateJsrFromPackageJson();
|
|
29
|
+
const successfulDryRun = await PackageService.publishJsrDryRun();
|
|
30
|
+
await PackageService.revertGitChanges();
|
|
31
|
+
if (!successfulDryRun) {
|
|
32
|
+
process.exit(1);
|
|
33
|
+
} else {
|
|
34
|
+
Logger.success('Successfully validated JSR publishing.');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static async publishToJsr(): Promise<void> {
|
|
39
|
+
if (await FileSystemService.hasPendingChanges()) {
|
|
40
|
+
Logger.error('Please commit or stash your changes before publishing.');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
await PackageService.updateJsrFromPackageJson();
|
|
44
|
+
const result = await PackageService.publishJsr();
|
|
45
|
+
await PackageService.revertGitChanges();
|
|
46
|
+
if (!result) {
|
|
47
|
+
process.exit(1);
|
|
48
|
+
} else {
|
|
49
|
+
Logger.success('Successfully published to JSR.');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
static async updateJsrFromPackageJson(): Promise<void> {
|
|
54
|
+
const rootDir = process.cwd();
|
|
55
|
+
const packageJsonPath = path.join(rootDir, 'package.json');
|
|
56
|
+
const jsrJsonPath = path.join(rootDir, 'jsr.json');
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
await access(packageJsonPath);
|
|
60
|
+
} catch {
|
|
61
|
+
Logger.error('No package.json file found in the current directory.');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
await access(jsrJsonPath);
|
|
67
|
+
} catch {
|
|
68
|
+
Logger.error('No jsr.json file found in the current directory.');
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
try {
|
|
73
|
+
const packageJsonData = JSON.parse(
|
|
74
|
+
await readFile(packageJsonPath, 'utf-8')
|
|
75
|
+
) as PackageJson;
|
|
76
|
+
const jsrJsonData = JSON.parse(
|
|
77
|
+
await readFile(jsrJsonPath, 'utf-8')
|
|
78
|
+
) as JsonWithVersionProperty;
|
|
79
|
+
jsrJsonData.version = packageJsonData.version;
|
|
80
|
+
await writeFile(jsrJsonPath, JSON.stringify(jsrJsonData, null, 2));
|
|
81
|
+
Logger.info(
|
|
82
|
+
'Updated jsr.json from package.json to version ' + jsrJsonData.version
|
|
83
|
+
);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
const errorString = ErrorUtils.getErrorString(error);
|
|
86
|
+
Logger.error(
|
|
87
|
+
`Failed to update jsr.json from package.json: ${errorString}`
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Executes a dry run of JSR publishing. Returns true if the dry run was
|
|
94
|
+
* successful, false otherwise.
|
|
95
|
+
*/
|
|
96
|
+
private static async publishJsrDryRun(): Promise<boolean> {
|
|
97
|
+
Logger.info('Running `jsr publish --dry-run`');
|
|
98
|
+
try {
|
|
99
|
+
const { stdout, stderr } = await execAsync(
|
|
100
|
+
'jsr publish --allow-dirty --dry-run'
|
|
101
|
+
);
|
|
102
|
+
if (stderr) {
|
|
103
|
+
Logger.info(stderr);
|
|
104
|
+
}
|
|
105
|
+
Logger.info(stdout);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
Logger.error(
|
|
108
|
+
`Failed to run 'jsr publish --dry-run': ${ErrorUtils.getErrorString(error)}`
|
|
109
|
+
);
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Publishes the current project to JSR.
|
|
117
|
+
*
|
|
118
|
+
* @returns true if the publish was successful, false otherwise.
|
|
119
|
+
*/
|
|
120
|
+
private static async publishJsr(): Promise<boolean> {
|
|
121
|
+
Logger.info('Running `jsr publish`');
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
const child = spawn('jsr publish', ['--allow-dirty'], {
|
|
124
|
+
stdio: 'inherit',
|
|
125
|
+
shell: true
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
child.on('exit', (code) => {
|
|
129
|
+
if (code === 0) {
|
|
130
|
+
resolve(true);
|
|
131
|
+
} else {
|
|
132
|
+
resolve(false);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private static async revertGitChanges(): Promise<void> {
|
|
139
|
+
Logger.info('Reverting changes made to jsr.json');
|
|
140
|
+
try {
|
|
141
|
+
await execAsync('git checkout jsr.json');
|
|
142
|
+
} catch (error) {
|
|
143
|
+
Logger.error(
|
|
144
|
+
`Failed to revert changes made to jsr.json: ${ErrorUtils.getErrorString(error)}`
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringService.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"StringService.d.ts","sourceRoot":"./src/","sources":["services/StringService.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAGlE"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
/**
|
|
4
2
|
* A service which can be used to interact with strings.
|
|
5
3
|
*/
|
|
6
|
-
class StringService {
|
|
4
|
+
export default class StringService {
|
|
7
5
|
/**
|
|
8
6
|
* Gets the file extension of the provided file name.
|
|
9
7
|
*
|
|
@@ -15,4 +13,4 @@ class StringService {
|
|
|
15
13
|
return fileName.split('.').pop();
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
16
|
+
//# sourceMappingURL=StringService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StringService.js","sourceRoot":"./src/","sources":["services/StringService.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,oBAAoB,CAAC,QAAgB;QAC1C,OAAO,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A service which can be used to interact with strings.
|
|
3
|
+
*/
|
|
4
|
+
export default class StringService {
|
|
5
|
+
/**
|
|
6
|
+
* Gets the file extension of the provided file name.
|
|
7
|
+
*
|
|
8
|
+
* @param fileName the full name of the file or the entire file path
|
|
9
|
+
* @returns a string containing the extension of the file name or undefined
|
|
10
|
+
* if there is no extension
|
|
11
|
+
*/
|
|
12
|
+
static getFileNameExtension(fileName: string): string | undefined {
|
|
13
|
+
return fileName.split('.').pop();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some utility functions for handling errors.
|
|
3
|
+
*/
|
|
1
4
|
export default class ErrorUtils {
|
|
2
5
|
/**
|
|
3
6
|
* Throws an array of errors in a formatted list.
|
|
@@ -7,5 +10,9 @@ export default class ErrorUtils {
|
|
|
7
10
|
* Throws an error along with an accompanying erroroneous object.
|
|
8
11
|
*/
|
|
9
12
|
static throwError(errorMessage: string, erroneousObject: object): void;
|
|
13
|
+
/**
|
|
14
|
+
* Gets the error string from an unknown error object.
|
|
15
|
+
*/
|
|
16
|
+
static getErrorString(error: unknown): string;
|
|
10
17
|
}
|
|
11
18
|
//# sourceMappingURL=ErrorUtils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorUtils.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"ErrorUtils.d.ts","sourceRoot":"./src/","sources":["utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM;IAUlE;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAI/D;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;CAS9C"}
|
package/lib/utils/ErrorUtils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Some utility functions for handling errors.
|
|
3
|
+
*/
|
|
4
|
+
export default class ErrorUtils {
|
|
4
5
|
/**
|
|
5
6
|
* Throws an array of errors in a formatted list.
|
|
6
7
|
*/
|
|
@@ -17,5 +18,19 @@ class ErrorUtils {
|
|
|
17
18
|
static throwError(errorMessage, erroneousObject) {
|
|
18
19
|
ErrorUtils.throwErrorList([errorMessage], erroneousObject);
|
|
19
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Gets the error string from an unknown error object.
|
|
23
|
+
*/
|
|
24
|
+
static getErrorString(error) {
|
|
25
|
+
if (error instanceof Error) {
|
|
26
|
+
return error.message;
|
|
27
|
+
}
|
|
28
|
+
else if (typeof error === 'string') {
|
|
29
|
+
return error;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return JSON.stringify(error);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
20
35
|
}
|
|
21
|
-
|
|
36
|
+
//# sourceMappingURL=ErrorUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorUtils.js","sourceRoot":"./src/","sources":["utils/ErrorUtils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,SAAmB,EAAE,eAAuB;QAChE,IAAI,WAAW,GAAG,EAAE,CAAC;QACrB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,WAAW,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC;QACrC,CAAC;QACD,MAAM,IAAI,KAAK,CACb,GAAG,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAC5D,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,YAAoB,EAAE,eAAuB;QAC7D,UAAU,CAAC,cAAc,CAAC,CAAC,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC;IAC7D,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,KAAc;QAClC,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,KAAK,CAAC,OAAO,CAAC;QACvB,CAAC;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some utility functions for handling errors.
|
|
3
|
+
*/
|
|
4
|
+
export default class ErrorUtils {
|
|
5
|
+
/**
|
|
6
|
+
* Throws an array of errors in a formatted list.
|
|
7
|
+
*/
|
|
8
|
+
static throwErrorList(errorList: string[], erroneousObject: object) {
|
|
9
|
+
let errorString = '';
|
|
10
|
+
for (let i = 0; i < errorList.length; i += 1) {
|
|
11
|
+
errorString += `${errorList[i]}\n`;
|
|
12
|
+
}
|
|
13
|
+
throw new Error(
|
|
14
|
+
`${errorString}${JSON.stringify(erroneousObject, null, 2)}`
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Throws an error along with an accompanying erroroneous object.
|
|
20
|
+
*/
|
|
21
|
+
static throwError(errorMessage: string, erroneousObject: object) {
|
|
22
|
+
ErrorUtils.throwErrorList([errorMessage], erroneousObject);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Gets the error string from an unknown error object.
|
|
27
|
+
*/
|
|
28
|
+
static getErrorString(error: unknown): string {
|
|
29
|
+
if (error instanceof Error) {
|
|
30
|
+
return error.message;
|
|
31
|
+
} else if (typeof error === 'string') {
|
|
32
|
+
return error;
|
|
33
|
+
} else {
|
|
34
|
+
return JSON.stringify(error);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/lib/utils/Logger.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"Logger.d.ts","sourceRoot":"./src/","sources":["utils/Logger.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,OAAc,qBAAqB,UAAS;IAE5C;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAAS;gBAErB,gBAAgB,CAAC,EAAE,OAAO;IAMtC;;;OAGG;IACH,MAAM,KAAK,OAAO,IAAI,MAAM,CAE3B;IAED;;OAEG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAW9C;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI;IAIrD;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM1B;;;;OAIG;IACH,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAIjC;;;;;;;OAOG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAMxB;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI/B,OAAO,CAAC,SAAS;CAMlB"}
|
package/lib/utils/Logger.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* A standard logger that can be used to log messages to the console.
|
|
3
|
+
*/
|
|
4
|
+
export default class Logger {
|
|
4
5
|
static verboseLoggingEnabled = false;
|
|
5
6
|
/**
|
|
6
7
|
* Private variable that sets if any logging on this instance of the Log
|
|
@@ -108,4 +109,4 @@ class Logger {
|
|
|
108
109
|
return false;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
|
|
112
|
+
//# sourceMappingURL=Logger.js.map
|