screw-up 0.16.0 → 1.0.0
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 +1 -1
- package/dist/{analyzer-2k5jeoJo.cjs → analyzer-BxxtJjNH.cjs} +22 -15
- package/dist/{analyzer-2k5jeoJo.cjs.map → analyzer-BxxtJjNH.cjs.map} +1 -1
- package/dist/{analyzer-CU8VuwpB.js → analyzer-DxAKRQPj.js} +17 -10
- package/dist/{analyzer-CU8VuwpB.js.map → analyzer-DxAKRQPj.js.map} +1 -1
- package/dist/analyzer.d.ts +2 -2
- package/dist/analyzer.d.ts.map +1 -1
- package/dist/cli-internal.d.ts +2 -2
- package/dist/cli.d.ts +2 -2
- package/dist/generated/packageMetadata.d.ts +4 -4
- package/dist/generated/packageMetadata.d.ts.map +1 -1
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/internal.d.ts +2 -2
- package/dist/main.cjs +36 -36
- package/dist/main.cjs.map +1 -1
- package/dist/main.d.ts +2 -2
- package/dist/main.js +4 -4
- package/dist/{packageMetadata-BC5X00sF.js → packageMetadata-CwQxZ4Fj.js} +4 -4
- package/dist/packageMetadata-CwQxZ4Fj.js.map +1 -0
- package/dist/{packageMetadata--R5DYhGa.cjs → packageMetadata-CxY3Y3Qr.cjs} +4 -4
- package/dist/packageMetadata-CxY3Y3Qr.cjs.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/vite-plugin.d.ts +2 -2
- package/package.json +6 -6
- package/dist/packageMetadata--R5DYhGa.cjs.map +0 -1
- package/dist/packageMetadata-BC5X00sF.js.map +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: screw-up
|
|
3
|
-
* version: 0.
|
|
3
|
+
* version: 1.0.0
|
|
4
4
|
* description: Simply package metadata inserter on Vite plugin
|
|
5
5
|
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
6
|
* license: MIT
|
|
7
7
|
* repository.url: https://github.com/kekyo/screw-up.git
|
|
8
|
-
* git.commit.hash:
|
|
8
|
+
* git.commit.hash: 4129fb42a594608860d2ac0d9d10871739f39091
|
|
9
9
|
*/
|
|
10
|
-
import * as fs from "fs";
|
|
11
10
|
import { existsSync } from "fs";
|
|
11
|
+
import * as fs from "fs/promises";
|
|
12
12
|
import { readFile } from "fs/promises";
|
|
13
13
|
import { dirname, join } from "path";
|
|
14
14
|
import { glob } from "glob";
|
|
@@ -1809,10 +1809,10 @@ const getRelatedBranches = async (repositoryPath, commitHash) => {
|
|
|
1809
1809
|
return [];
|
|
1810
1810
|
}
|
|
1811
1811
|
};
|
|
1812
|
-
const
|
|
1812
|
+
const getModifiedFiles = async (repositoryPath) => {
|
|
1813
1813
|
try {
|
|
1814
1814
|
const status = await git.statusMatrix({ fs, dir: repositoryPath });
|
|
1815
|
-
return status.
|
|
1815
|
+
return status.filter(
|
|
1816
1816
|
([, head, workdir, stage]) => workdir === 2 || // modified in working directory (unstaged)
|
|
1817
1817
|
stage === 2 || // modified in stage (staged)
|
|
1818
1818
|
stage === 3 || // added to stage (staged)
|
|
@@ -1821,9 +1821,12 @@ const hasModifiedFiles = async (repositoryPath) => {
|
|
|
1821
1821
|
// untracked files (respecting .gitignore)
|
|
1822
1822
|
);
|
|
1823
1823
|
} catch (e) {
|
|
1824
|
-
return
|
|
1824
|
+
return [];
|
|
1825
1825
|
}
|
|
1826
1826
|
};
|
|
1827
|
+
const formatModifiedFile = (modifiedFile) => {
|
|
1828
|
+
return `'${modifiedFile[0]}':${modifiedFile[1]}:${modifiedFile[2]}:${modifiedFile[3]}`;
|
|
1829
|
+
};
|
|
1827
1830
|
const lookupVersionLabelRecursive = async (cwd, commit, reachedCommits) => {
|
|
1828
1831
|
const scheduledStack = [];
|
|
1829
1832
|
let version = { major: 0, minor: 0, build: 1, original: "0.0.1" };
|
|
@@ -1888,9 +1891,13 @@ const getGitMetadata = async (repositoryPath, checkWorkingDirectoryStatus, logge
|
|
|
1888
1891
|
const gitMetadata = { tags: [], branches: [] };
|
|
1889
1892
|
metadata.git = gitMetadata;
|
|
1890
1893
|
if (version) {
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
+
if (checkWorkingDirectoryStatus) {
|
|
1895
|
+
const modifiedFiles = await getModifiedFiles(gitRootPath);
|
|
1896
|
+
if (modifiedFiles.length >= 1) {
|
|
1897
|
+
const newVersion = incrementLastVersionComponent(version);
|
|
1898
|
+
logger.debug(`Increased git version by detected modified items: ${formatVersion(version)} ---> ${formatVersion(newVersion)}, Files=[${modifiedFiles.map(formatModifiedFile).join(", ")}]`);
|
|
1899
|
+
version = newVersion;
|
|
1900
|
+
}
|
|
1894
1901
|
}
|
|
1895
1902
|
const gitVersion = formatVersion(version);
|
|
1896
1903
|
gitMetadata.version = gitVersion;
|
|
@@ -1933,4 +1940,4 @@ export {
|
|
|
1933
1940
|
getFetchGitMetadata as g,
|
|
1934
1941
|
resolvePackageMetadata as r
|
|
1935
1942
|
};
|
|
1936
|
-
//# sourceMappingURL=analyzer-
|
|
1943
|
+
//# sourceMappingURL=analyzer-DxAKRQPj.js.map
|