npmdata 0.10.3 → 0.12.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 +133 -58
- package/dist/cli/actions/check.d.ts +6 -0
- package/dist/cli/actions/check.d.ts.map +1 -0
- package/dist/cli/actions/check.js +57 -0
- package/dist/cli/actions/check.js.map +1 -0
- package/dist/cli/actions/extract.d.ts +7 -0
- package/dist/cli/actions/extract.d.ts.map +1 -0
- package/dist/cli/actions/extract.js +84 -0
- package/dist/cli/actions/extract.js.map +1 -0
- package/dist/cli/actions/init.d.ts +6 -0
- package/dist/cli/actions/init.d.ts.map +1 -0
- package/dist/cli/actions/init.js +36 -0
- package/dist/cli/actions/init.js.map +1 -0
- package/dist/cli/actions/list.d.ts +7 -0
- package/dist/cli/actions/list.d.ts.map +1 -0
- package/dist/cli/actions/list.js +42 -0
- package/dist/cli/actions/list.js.map +1 -0
- package/dist/cli/actions/purge.d.ts +6 -0
- package/dist/cli/actions/purge.d.ts.map +1 -0
- package/dist/cli/actions/purge.js +47 -0
- package/dist/cli/actions/purge.js.map +1 -0
- package/dist/cli/argv.d.ts +35 -0
- package/dist/cli/argv.d.ts.map +1 -0
- package/dist/cli/argv.js +125 -0
- package/dist/cli/argv.js.map +1 -0
- package/dist/cli/cli.d.ts +9 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/cli/cli.js +69 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/runner.d.ts +9 -0
- package/dist/cli/runner.d.ts.map +1 -0
- package/dist/cli/runner.js +106 -0
- package/dist/cli/runner.js.map +1 -0
- package/dist/cli/usage.d.ts +6 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +126 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/fileset/check.d.ts +15 -0
- package/dist/fileset/check.d.ts.map +1 -0
- package/dist/fileset/check.js +68 -0
- package/dist/fileset/check.js.map +1 -0
- package/dist/fileset/constants.d.ts +13 -0
- package/dist/fileset/constants.d.ts.map +1 -0
- package/dist/fileset/constants.js +22 -0
- package/dist/fileset/constants.js.map +1 -0
- package/dist/fileset/diff.d.ts +16 -0
- package/dist/fileset/diff.d.ts.map +1 -0
- package/dist/fileset/diff.js +116 -0
- package/dist/fileset/diff.js.map +1 -0
- package/dist/fileset/execute.d.ts +29 -0
- package/dist/fileset/execute.d.ts.map +1 -0
- package/dist/fileset/execute.js +136 -0
- package/dist/fileset/execute.js.map +1 -0
- package/dist/fileset/gitignore.d.ts +16 -0
- package/dist/fileset/gitignore.d.ts.map +1 -0
- package/dist/fileset/gitignore.js +82 -0
- package/dist/fileset/gitignore.js.map +1 -0
- package/dist/fileset/index.d.ts +5 -0
- package/dist/fileset/index.d.ts.map +1 -0
- package/dist/fileset/index.js +21 -0
- package/dist/fileset/index.js.map +1 -0
- package/dist/fileset/list.d.ts +6 -0
- package/dist/fileset/list.d.ts.map +1 -0
- package/dist/fileset/list.js +11 -0
- package/dist/fileset/list.js.map +1 -0
- package/dist/fileset/markers.d.ts +22 -0
- package/dist/fileset/markers.d.ts.map +1 -0
- package/dist/fileset/markers.js +68 -0
- package/dist/fileset/markers.js.map +1 -0
- package/dist/fileset/package-files.d.ts +14 -0
- package/dist/fileset/package-files.d.ts.map +1 -0
- package/dist/fileset/package-files.js +81 -0
- package/dist/fileset/package-files.js.map +1 -0
- package/dist/fileset/purge.d.ts +12 -0
- package/dist/fileset/purge.d.ts.map +1 -0
- package/dist/fileset/purge.js +95 -0
- package/dist/fileset/purge.js.map +1 -0
- package/dist/fileset/test-utils.d.ts +12 -0
- package/dist/fileset/test-utils.d.ts.map +1 -0
- package/dist/fileset/test-utils.js +65 -0
- package/dist/fileset/test-utils.js.map +1 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -17
- package/dist/index.js.map +1 -1
- package/dist/main.js +9 -16
- package/dist/main.js.map +1 -1
- package/dist/npmdata-0.0.1.tgz +0 -0
- package/dist/package/action-check.d.ts +20 -0
- package/dist/package/action-check.d.ts.map +1 -0
- package/dist/package/action-check.js +61 -0
- package/dist/package/action-check.js.map +1 -0
- package/dist/package/action-extract.d.ts +21 -0
- package/dist/package/action-extract.d.ts.map +1 -0
- package/dist/package/action-extract.js +186 -0
- package/dist/package/action-extract.js.map +1 -0
- package/dist/package/action-init.d.ts +13 -0
- package/dist/package/action-init.d.ts.map +1 -0
- package/dist/package/action-init.js +77 -0
- package/dist/package/action-init.js.map +1 -0
- package/dist/package/action-list.d.ts +14 -0
- package/dist/package/action-list.d.ts.map +1 -0
- package/dist/package/action-list.js +46 -0
- package/dist/package/action-list.js.map +1 -0
- package/dist/package/action-purge.d.ts +21 -0
- package/dist/package/action-purge.d.ts.map +1 -0
- package/dist/package/action-purge.js +60 -0
- package/dist/package/action-purge.js.map +1 -0
- package/dist/package/config-merge.d.ts +18 -0
- package/dist/package/config-merge.d.ts.map +1 -0
- package/dist/package/config-merge.js +48 -0
- package/dist/package/config-merge.js.map +1 -0
- package/dist/package/config.d.ts +13 -0
- package/dist/package/config.d.ts.map +1 -0
- package/dist/package/config.js +29 -0
- package/dist/package/config.js.map +1 -0
- package/dist/package/content-replacements.d.ts +21 -0
- package/dist/package/content-replacements.d.ts.map +1 -0
- package/dist/package/content-replacements.js +96 -0
- package/dist/package/content-replacements.js.map +1 -0
- package/dist/package/index.d.ts +10 -0
- package/dist/package/index.d.ts.map +1 -0
- package/dist/package/index.js +16 -0
- package/dist/package/index.js.map +1 -0
- package/dist/package/symlinks.d.ts +17 -0
- package/dist/package/symlinks.d.ts.map +1 -0
- package/dist/package/symlinks.js +125 -0
- package/dist/package/symlinks.js.map +1 -0
- package/dist/types.d.ts +184 -270
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -12
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +25 -55
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +82 -181
- package/dist/utils.js.map +1 -1
- package/package.json +5 -2
- package/dist/cli.d.ts +0 -6
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -514
- package/dist/cli.js.map +0 -1
- package/dist/consumer.d.ts +0 -74
- package/dist/consumer.d.ts.map +0 -1
- package/dist/consumer.js +0 -820
- package/dist/consumer.js.map +0 -1
- package/dist/publisher.d.ts +0 -38
- package/dist/publisher.d.ts.map +0 -1
- package/dist/publisher.js +0 -164
- package/dist/publisher.js.map +0 -1
- package/dist/runner.d.ts +0 -102
- package/dist/runner.d.ts.map +0 -1
- package/dist/runner.js +0 -748
- package/dist/runner.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.checkFileset = checkFileset;
|
|
7
|
+
/* eslint-disable no-restricted-syntax */
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const utils_1 = require("../utils");
|
|
11
|
+
const content_replacements_1 = require("../package/content-replacements");
|
|
12
|
+
const package_files_1 = require("./package-files");
|
|
13
|
+
/**
|
|
14
|
+
* Check whether locally extracted files are in sync with their package source.
|
|
15
|
+
* Reuses diff logic to classify files as missing, modified, or extra.
|
|
16
|
+
* Applies contentReplacements before hash comparison.
|
|
17
|
+
*
|
|
18
|
+
* @param pkgPath Absolute path to the installed package directory, or null if not installed.
|
|
19
|
+
* @param outputDir Absolute path to the output directory.
|
|
20
|
+
* @param selector SelectorConfig controlling which package files are in scope.
|
|
21
|
+
* @param outputConfig OutputConfig (used for contentReplacements).
|
|
22
|
+
* @param marker Managed file entries from the .npmdata marker.
|
|
23
|
+
* @returns CheckResult with missing, modified, and extra arrays.
|
|
24
|
+
*/
|
|
25
|
+
async function checkFileset(pkgPath, outputDir, selector, outputConfig, marker) {
|
|
26
|
+
const contentReplacements = outputConfig.contentReplacements ?? [];
|
|
27
|
+
if (!pkgPath) {
|
|
28
|
+
// Package not installed
|
|
29
|
+
return {
|
|
30
|
+
missing: marker.map((m) => m.path),
|
|
31
|
+
modified: [],
|
|
32
|
+
extra: [],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const managedByPath = new Map(marker.map((m) => [m.path, m]));
|
|
36
|
+
// Enumerate files from package (in scope)
|
|
37
|
+
const pkgFiles = await (0, package_files_1.enumeratePackageFiles)(pkgPath, selector);
|
|
38
|
+
const pkgFileSet = new Set(pkgFiles);
|
|
39
|
+
const result = { missing: [], modified: [], extra: [] };
|
|
40
|
+
// Check each managed file
|
|
41
|
+
for (const m of marker) {
|
|
42
|
+
const destPath = node_path_1.default.join(outputDir, m.path);
|
|
43
|
+
if (!node_fs_1.default.existsSync(destPath)) {
|
|
44
|
+
result.missing.push(m.path);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
// Compare hash with content replacements applied
|
|
48
|
+
if (pkgFileSet.has(m.path)) {
|
|
49
|
+
const srcPath = node_path_1.default.join(pkgPath, m.path);
|
|
50
|
+
const srcContent = node_fs_1.default.readFileSync(srcPath, 'utf8');
|
|
51
|
+
const transformed = (0, content_replacements_1.applyContentReplacementsToBuffer)(srcContent, contentReplacements);
|
|
52
|
+
const srcHash = (0, utils_1.hashBuffer)(transformed);
|
|
53
|
+
// eslint-disable-next-line no-await-in-loop
|
|
54
|
+
const destHash = await (0, utils_1.hashFile)(destPath);
|
|
55
|
+
if (srcHash !== destHash) {
|
|
56
|
+
result.modified.push(m.path);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// Find extra files: in filtered package source but never extracted (not in marker)
|
|
61
|
+
for (const relPath of pkgFiles) {
|
|
62
|
+
if (!managedByPath.has(relPath)) {
|
|
63
|
+
result.extra.push(relPath);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/fileset/check.ts"],"names":[],"mappings":";;;;;AA4BA,oCAyDC;AArFD,yCAAyC;AACzC,0DAA6B;AAC7B,sDAAyB;AASzB,oCAAgD;AAChD,0EAAmF;AAEnF,mDAAwD;AAExD;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,YAAY,CAChC,OAAsB,EACtB,SAAiB,EACjB,QAAwB,EACxB,YAA0B,EAC1B,MAA6B;IAE7B,MAAM,mBAAmB,GAA+B,YAAY,CAAC,mBAAmB,IAAI,EAAE,CAAC;IAE/F,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,wBAAwB;QACxB,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;YAClC,QAAQ,EAAE,EAAE;YACZ,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,GAAG,CAA8B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;IAE3F,0CAA0C;IAC1C,MAAM,QAAQ,GAAG,MAAM,IAAA,qCAAqB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC;IAErC,MAAM,MAAM,GAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC;IAErE,0BAA0B;IAC1B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAA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
/**
|
|
6
|
+
* Default filename patterns applied when no `files` glob patterns are specified in SelectorConfig.
|
|
7
|
+
* Excludes common package metadata files that are not meant to be extracted by consumers.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_FILENAME_PATTERNS: string[];
|
|
10
|
+
export declare const GITIGNORE_FILE = ".gitignore";
|
|
11
|
+
export declare const GITIGNORE_START = "# npmdata:start";
|
|
12
|
+
export declare const GITIGNORE_END = "# npmdata:end";
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/fileset/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,WAAW,aAAa,CAAC;AAEtC;;;GAGG;AACH,eAAO,MAAM,yBAAyB,UAMrC,CAAC;AAEF,eAAO,MAAM,cAAc,eAAe,CAAC;AAC3C,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,aAAa,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITIGNORE_END = exports.GITIGNORE_START = exports.GITIGNORE_FILE = exports.DEFAULT_FILENAME_PATTERNS = exports.MARKER_FILE = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Name of the npmdata marker file that tracks managed files.
|
|
6
|
+
*/
|
|
7
|
+
exports.MARKER_FILE = '.npmdata';
|
|
8
|
+
/**
|
|
9
|
+
* Default filename patterns applied when no `files` glob patterns are specified in SelectorConfig.
|
|
10
|
+
* Excludes common package metadata files that are not meant to be extracted by consumers.
|
|
11
|
+
*/
|
|
12
|
+
exports.DEFAULT_FILENAME_PATTERNS = [
|
|
13
|
+
'**',
|
|
14
|
+
'!package.json',
|
|
15
|
+
'!bin/**',
|
|
16
|
+
'!README.md',
|
|
17
|
+
'!node_modules/**',
|
|
18
|
+
];
|
|
19
|
+
exports.GITIGNORE_FILE = '.gitignore';
|
|
20
|
+
exports.GITIGNORE_START = '# npmdata:start';
|
|
21
|
+
exports.GITIGNORE_END = '# npmdata:end';
|
|
22
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/fileset/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,WAAW,GAAG,UAAU,CAAC;AAEtC;;;GAGG;AACU,QAAA,yBAAyB,GAAG;IACvC,IAAI;IACJ,eAAe;IACf,SAAS;IACT,YAAY;IACZ,kBAAkB;CACnB,CAAC;AAEW,QAAA,cAAc,GAAG,YAAY,CAAC;AAC9B,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,aAAa,GAAG,eAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SelectorConfig, OutputConfig, ExtractionMap, ManagedFileMetadata, ContentReplacementConfig } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Pure read-only diff between package source files and an output directory.
|
|
4
|
+
* Classifies each file as toAdd, toModify, toDelete, toSkip, or conflicts.
|
|
5
|
+
* Makes NO disk writes.
|
|
6
|
+
*
|
|
7
|
+
* @param pkgPath Absolute path to the installed package directory.
|
|
8
|
+
* @param outputDir Absolute path to the output directory.
|
|
9
|
+
* @param selector SelectorConfig controlling which package files are included.
|
|
10
|
+
* @param outputConfig OutputConfig controlling extraction behaviour.
|
|
11
|
+
* @param existingMarker Current managed file entries from the .npmdata marker.
|
|
12
|
+
* @param contentReplacements Content replacement configs to apply before hash comparison.
|
|
13
|
+
* @returns ExtractionMap classifying all file operations.
|
|
14
|
+
*/
|
|
15
|
+
export declare function diff(pkgPath: string, outputDir: string, selector: SelectorConfig, outputConfig: OutputConfig, existingMarker: ManagedFileMetadata[], contentReplacements: ContentReplacementConfig[]): Promise<ExtractionMap>;
|
|
16
|
+
//# sourceMappingURL=diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.d.ts","sourceRoot":"","sources":["../../src/fileset/diff.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAMlB;;;;;;;;;;;;GAYG;AACH,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,cAAc,EACxB,YAAY,EAAE,YAAY,EAC1B,cAAc,EAAE,mBAAmB,EAAE,EACrC,mBAAmB,EAAE,wBAAwB,EAAE,GAC9C,OAAO,CAAC,aAAa,CAAC,CAuFxB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.diff = diff;
|
|
7
|
+
/* eslint-disable functional/no-try-statements */
|
|
8
|
+
/* eslint-disable no-restricted-syntax */
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
12
|
+
const utils_1 = require("../utils");
|
|
13
|
+
const content_replacements_1 = require("../package/content-replacements");
|
|
14
|
+
const package_files_1 = require("./package-files");
|
|
15
|
+
/**
|
|
16
|
+
* Pure read-only diff between package source files and an output directory.
|
|
17
|
+
* Classifies each file as toAdd, toModify, toDelete, toSkip, or conflicts.
|
|
18
|
+
* Makes NO disk writes.
|
|
19
|
+
*
|
|
20
|
+
* @param pkgPath Absolute path to the installed package directory.
|
|
21
|
+
* @param outputDir Absolute path to the output directory.
|
|
22
|
+
* @param selector SelectorConfig controlling which package files are included.
|
|
23
|
+
* @param outputConfig OutputConfig controlling extraction behaviour.
|
|
24
|
+
* @param existingMarker Current managed file entries from the .npmdata marker.
|
|
25
|
+
* @param contentReplacements Content replacement configs to apply before hash comparison.
|
|
26
|
+
* @returns ExtractionMap classifying all file operations.
|
|
27
|
+
*/
|
|
28
|
+
async function diff(pkgPath, outputDir, selector, outputConfig, existingMarker, contentReplacements) {
|
|
29
|
+
const result = {
|
|
30
|
+
toAdd: [],
|
|
31
|
+
toModify: [],
|
|
32
|
+
toDelete: [],
|
|
33
|
+
toSkip: [],
|
|
34
|
+
conflicts: [],
|
|
35
|
+
};
|
|
36
|
+
// Build map of existing managed files by relPath -> metadata
|
|
37
|
+
const managedByPath = new Map(existingMarker.map((m) => [m.path, m]));
|
|
38
|
+
// Enumerate files from package
|
|
39
|
+
const pkgFiles = await (0, package_files_1.enumeratePackageFiles)(pkgPath, selector);
|
|
40
|
+
const pkgFileSet = new Set(pkgFiles);
|
|
41
|
+
for (const relPath of pkgFiles) {
|
|
42
|
+
const srcPath = node_path_1.default.join(pkgPath, relPath);
|
|
43
|
+
const destPath = node_path_1.default.join(outputDir, relPath);
|
|
44
|
+
const destExists = node_fs_1.default.existsSync(destPath);
|
|
45
|
+
const isManaged = managedByPath.has(relPath);
|
|
46
|
+
if (outputConfig.unmanaged) {
|
|
47
|
+
if (destExists) {
|
|
48
|
+
result.toSkip.push({ relPath, reason: 'unmanaged' });
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
// In unmanaged mode, new files are still added (without marker)
|
|
52
|
+
// eslint-disable-next-line no-await-in-loop
|
|
53
|
+
const srcHash = await (0, utils_1.hashFile)(srcPath);
|
|
54
|
+
result.toAdd.push({ relPath, sourcePath: srcPath, destPath, hash: srcHash });
|
|
55
|
+
}
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (outputConfig.keepExisting && destExists) {
|
|
59
|
+
result.toSkip.push({ relPath, reason: 'keep-existing' });
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
if (!destExists) {
|
|
63
|
+
// eslint-disable-next-line no-await-in-loop
|
|
64
|
+
const srcHash = await (0, utils_1.hashFile)(srcPath);
|
|
65
|
+
result.toAdd.push({ relPath, sourcePath: srcPath, destPath, hash: srcHash });
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
// Dest exists
|
|
69
|
+
if (!isManaged) {
|
|
70
|
+
// File exists but not in marker — it's unmanaged/foreign
|
|
71
|
+
if (outputConfig.force) {
|
|
72
|
+
// Override: treat as toModify
|
|
73
|
+
// eslint-disable-next-line no-await-in-loop
|
|
74
|
+
const srcHash = await hashSrcWithReplacements(srcPath, contentReplacements);
|
|
75
|
+
result.toModify.push({ relPath, sourcePath: srcPath, destPath, hash: srcHash });
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
result.conflicts.push({ relPath });
|
|
79
|
+
}
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
// Managed file — compare hashes
|
|
83
|
+
const srcContent = node_fs_1.default.readFileSync(srcPath);
|
|
84
|
+
const transformedContent = (0, content_replacements_1.applyContentReplacementsToBuffer)(srcContent.toString(), contentReplacements);
|
|
85
|
+
const srcHash = hashBuffer(transformedContent);
|
|
86
|
+
// eslint-disable-next-line no-await-in-loop
|
|
87
|
+
const destHash = await (0, utils_1.hashFile)(destPath);
|
|
88
|
+
if (srcHash === destHash) {
|
|
89
|
+
result.toSkip.push({ relPath, reason: 'keep-existing' });
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
result.toModify.push({ relPath, sourcePath: srcPath, destPath, hash: srcHash });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Find managed files that are no longer in the filtered package source
|
|
96
|
+
for (const managed of existingMarker) {
|
|
97
|
+
if (!pkgFileSet.has(managed.path)) {
|
|
98
|
+
result.toDelete.push(managed.path);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
async function hashSrcWithReplacements(srcPath, contentReplacements) {
|
|
104
|
+
if (contentReplacements.length === 0)
|
|
105
|
+
return (0, utils_1.hashFile)(srcPath);
|
|
106
|
+
const content = node_fs_1.default.readFileSync(srcPath, 'utf8');
|
|
107
|
+
const transformed = (0, content_replacements_1.applyContentReplacementsToBuffer)(content, contentReplacements);
|
|
108
|
+
return hashString(transformed);
|
|
109
|
+
}
|
|
110
|
+
function hashString(content) {
|
|
111
|
+
return node_crypto_1.default.createHash('sha256').update(content).digest('hex');
|
|
112
|
+
}
|
|
113
|
+
function hashBuffer(content) {
|
|
114
|
+
return hashString(content);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=diff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../src/fileset/diff.ts"],"names":[],"mappings":";;;;;AA+BA,oBA8FC;AA7HD,iDAAiD;AACjD,yCAAyC;AACzC,sDAAyB;AACzB,0DAA6B;AAC7B,8DAAiC;AASjC,oCAAoC;AACpC,0EAAmF;AAEnF,mDAAwD;AAExD;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,IAAI,CACxB,OAAe,EACf,SAAiB,EACjB,QAAwB,EACxB,YAA0B,EAC1B,cAAqC,EACrC,mBAA+C;IAE/C,MAAM,MAAM,GAAkB;QAC5B,KAAK,EAAE,EAAE;QACT,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,EAAE;KACd,CAAC;IAEF,6DAA6D;IAC7D,MAAM,aAAa,GAAG,IAAI,GAAG,CAC3B,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CACvC,CAAC;IAEF,+BAA+B;IAC/B,MAAM,QAAQ,GAAG,MAAM,IAAA,qCAAqB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;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uE;IACvE,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;QACrC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YAClC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,uBAAuB,CACpC,OAAe,EACf,mBAA+C;IAE/C,IAAI,mBAAmB,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAA,gBAAQ,EAAC,OAAO,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,iBAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,IAAA,uDAAgC,EAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;IACnF,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,qBAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,UAAU,CAAC,OAAe;IACjC,OAAO,UAAU,CAAC,OAAO,CAAC,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ExtractionMap, OutputConfig, PackageConfig, ExecuteResult, ManagedFileMetadata } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Apply an ExtractionMap to disk:
|
|
4
|
+
* - Copy toAdd and toModify files from source to dest
|
|
5
|
+
* - Make managed files read-only (unless unmanaged mode)
|
|
6
|
+
* - Delete toDelete files
|
|
7
|
+
* - Update .npmdata marker file (unless dryRun or unmanaged)
|
|
8
|
+
* - Update .gitignore (unless dryRun, unmanaged, or gitignore=false)
|
|
9
|
+
*
|
|
10
|
+
* @param map The ExtractionMap produced by diff().
|
|
11
|
+
* @param outputDir Absolute path to the output directory.
|
|
12
|
+
* @param outputConfig OutputConfig controlling write behaviour.
|
|
13
|
+
* @param pkg PackageConfig for marker metadata.
|
|
14
|
+
* @param pkgVersion Installed package version for marker metadata.
|
|
15
|
+
* @param existingMarker Existing managed file entries (for incremental update).
|
|
16
|
+
* @param cwd Working directory (kept for API compatibility).
|
|
17
|
+
* @returns ExecuteResult with counts and list of newly created files for rollback.
|
|
18
|
+
*/
|
|
19
|
+
export declare function execute(map: ExtractionMap, outputDir: string, outputConfig: OutputConfig, pkg: PackageConfig, pkgVersion: string, existingMarker: ManagedFileMetadata[], _cwd?: string): Promise<ExecuteResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Delete a list of files from disk and make them writable first.
|
|
22
|
+
* Used for deferred deletions after all filesets have been processed.
|
|
23
|
+
*/
|
|
24
|
+
export declare function deleteFiles(filePaths: string[]): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Rollback: delete newly created files (those that did not exist before this run).
|
|
27
|
+
*/
|
|
28
|
+
export declare function rollback(newlyCreated: string[]): Promise<void>;
|
|
29
|
+
//# sourceMappingURL=execute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/fileset/execute.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,mBAAmB,EACpB,MAAM,UAAU,CAAC;AAOlB;;;;;;;;;;;;;;;;GAgBG;AAEH,wBAAsB,OAAO,CAC3B,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,aAAa,EAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,mBAAmB,EAAE,EAErC,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,aAAa,CAAC,CAuFxB;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAUpE;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEpE"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.execute = execute;
|
|
7
|
+
exports.deleteFiles = deleteFiles;
|
|
8
|
+
exports.rollback = rollback;
|
|
9
|
+
/* eslint-disable functional/no-try-statements */
|
|
10
|
+
/* eslint-disable no-restricted-syntax */
|
|
11
|
+
/* eslint-disable no-console */
|
|
12
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
13
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
14
|
+
const utils_1 = require("../utils");
|
|
15
|
+
const content_replacements_1 = require("../package/content-replacements");
|
|
16
|
+
const markers_1 = require("./markers");
|
|
17
|
+
const gitignore_1 = require("./gitignore");
|
|
18
|
+
/**
|
|
19
|
+
* Apply an ExtractionMap to disk:
|
|
20
|
+
* - Copy toAdd and toModify files from source to dest
|
|
21
|
+
* - Make managed files read-only (unless unmanaged mode)
|
|
22
|
+
* - Delete toDelete files
|
|
23
|
+
* - Update .npmdata marker file (unless dryRun or unmanaged)
|
|
24
|
+
* - Update .gitignore (unless dryRun, unmanaged, or gitignore=false)
|
|
25
|
+
*
|
|
26
|
+
* @param map The ExtractionMap produced by diff().
|
|
27
|
+
* @param outputDir Absolute path to the output directory.
|
|
28
|
+
* @param outputConfig OutputConfig controlling write behaviour.
|
|
29
|
+
* @param pkg PackageConfig for marker metadata.
|
|
30
|
+
* @param pkgVersion Installed package version for marker metadata.
|
|
31
|
+
* @param existingMarker Existing managed file entries (for incremental update).
|
|
32
|
+
* @param cwd Working directory (kept for API compatibility).
|
|
33
|
+
* @returns ExecuteResult with counts and list of newly created files for rollback.
|
|
34
|
+
*/
|
|
35
|
+
// eslint-disable-next-line complexity
|
|
36
|
+
async function execute(map, outputDir, outputConfig, pkg, pkgVersion, existingMarker,
|
|
37
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
38
|
+
_cwd) {
|
|
39
|
+
const dryRun = outputConfig.dryRun ?? false;
|
|
40
|
+
const unmanaged = outputConfig.unmanaged ?? false;
|
|
41
|
+
const updateGitignore = outputConfig.gitignore !== false;
|
|
42
|
+
const result = {
|
|
43
|
+
newlyCreated: [],
|
|
44
|
+
added: 0,
|
|
45
|
+
modified: 0,
|
|
46
|
+
deleted: 0,
|
|
47
|
+
skipped: map.toSkip.length,
|
|
48
|
+
};
|
|
49
|
+
// Write toAdd files
|
|
50
|
+
for (const op of map.toAdd) {
|
|
51
|
+
if (!dryRun) {
|
|
52
|
+
(0, utils_1.ensureDir)(node_path_1.default.dirname(op.destPath));
|
|
53
|
+
// Make writable if it exists (should be rare for toAdd, but defensive)
|
|
54
|
+
if (node_fs_1.default.existsSync(op.destPath)) {
|
|
55
|
+
node_fs_1.default.chmodSync(op.destPath, 0o644);
|
|
56
|
+
}
|
|
57
|
+
node_fs_1.default.copyFileSync(op.sourcePath, op.destPath);
|
|
58
|
+
if (!unmanaged) {
|
|
59
|
+
node_fs_1.default.chmodSync(op.destPath, 0o444); // read-only
|
|
60
|
+
}
|
|
61
|
+
result.newlyCreated.push(op.destPath);
|
|
62
|
+
}
|
|
63
|
+
result.added += 1;
|
|
64
|
+
}
|
|
65
|
+
// Write toModify files
|
|
66
|
+
for (const op of map.toModify) {
|
|
67
|
+
if (!dryRun) {
|
|
68
|
+
(0, utils_1.ensureDir)(node_path_1.default.dirname(op.destPath));
|
|
69
|
+
if (node_fs_1.default.existsSync(op.destPath)) {
|
|
70
|
+
node_fs_1.default.chmodSync(op.destPath, 0o644); // make writable before overwriting
|
|
71
|
+
}
|
|
72
|
+
node_fs_1.default.copyFileSync(op.sourcePath, op.destPath);
|
|
73
|
+
if (!unmanaged) {
|
|
74
|
+
node_fs_1.default.chmodSync(op.destPath, 0o444); // read-only
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
result.modified += 1;
|
|
78
|
+
}
|
|
79
|
+
// Delete toDelete files (deferred — called by action-extract after all filesets)
|
|
80
|
+
// Here we just count them; actual deletion is done by the orchestrator
|
|
81
|
+
result.deleted = map.toDelete.length;
|
|
82
|
+
// Update marker and gitignore
|
|
83
|
+
if (!dryRun && !unmanaged) {
|
|
84
|
+
const marker = (0, markers_1.markerPath)(outputDir);
|
|
85
|
+
// Add newly extracted files to marker
|
|
86
|
+
const addedPaths = new Set([
|
|
87
|
+
...map.toAdd.map((op) => op.relPath),
|
|
88
|
+
...map.toModify.map((op) => op.relPath),
|
|
89
|
+
]);
|
|
90
|
+
// Remove deleted paths, add/update new paths
|
|
91
|
+
const updatedEntries = existingMarker.filter((m) => !map.toDelete.includes(m.path) && !addedPaths.has(m.path));
|
|
92
|
+
for (const op of [...map.toAdd, ...map.toModify]) {
|
|
93
|
+
updatedEntries.push({
|
|
94
|
+
path: op.relPath,
|
|
95
|
+
packageName: pkg.name,
|
|
96
|
+
packageVersion: pkgVersion,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// eslint-disable-next-line no-await-in-loop
|
|
100
|
+
await (0, markers_1.writeMarker)(marker, updatedEntries);
|
|
101
|
+
if (updateGitignore) {
|
|
102
|
+
const managedPaths = updatedEntries.map((m) => m.path);
|
|
103
|
+
// eslint-disable-next-line no-await-in-loop
|
|
104
|
+
await (0, gitignore_1.addToGitignore)(outputDir, managedPaths);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Apply content replacements
|
|
108
|
+
if (!dryRun && outputConfig.contentReplacements && outputConfig.contentReplacements.length > 0) {
|
|
109
|
+
await (0, content_replacements_1.applyContentReplacements)(outputDir, outputConfig.contentReplacements);
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Delete a list of files from disk and make them writable first.
|
|
115
|
+
* Used for deferred deletions after all filesets have been processed.
|
|
116
|
+
*/
|
|
117
|
+
async function deleteFiles(filePaths) {
|
|
118
|
+
for (const filePath of filePaths) {
|
|
119
|
+
if (!node_fs_1.default.existsSync(filePath))
|
|
120
|
+
continue;
|
|
121
|
+
try {
|
|
122
|
+
node_fs_1.default.chmodSync(filePath, 0o644);
|
|
123
|
+
node_fs_1.default.unlinkSync(filePath);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Ignore errors for files that could not be deleted
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Rollback: delete newly created files (those that did not exist before this run).
|
|
132
|
+
*/
|
|
133
|
+
async function rollback(newlyCreated) {
|
|
134
|
+
await deleteFiles(newlyCreated);
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=execute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/fileset/execute.ts"],"names":[],"mappings":";;;;;AAqCA,0BAgGC;AAMD,kCAUC;AAKD,4BAEC;AA5JD,iDAAiD;AACjD,yCAAyC;AACzC,+BAA+B;AAC/B,sDAAyB;AACzB,0DAA6B;AAS7B,oCAAqC;AACrC,0EAA2E;AAE3E,uCAAoD;AACpD,2CAA6C;AAE7C;;;;;;;;;;;;;;;;GAgBG;AACH,sCAAsC;AAC/B,KAAK,UAAU,OAAO,CAC3B,GAAkB,EAClB,SAAiB,EACjB,YAA0B,EAC1B,GAAkB,EAClB,UAAkB,EAClB,cAAqC;AACrC,6DAA6D;AAC7D,IAAa;IAEb,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,IAAI,KAAK,CAAC;IAC5C,MAAM,SAAS,GAAG,YAA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WAAW,CAAC,YAAY,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Add paths to the npmdata-managed section in .gitignore.
|
|
3
|
+
* Creates the file if it does not exist.
|
|
4
|
+
* Always includes the MARKER_FILE itself in the managed section.
|
|
5
|
+
*/
|
|
6
|
+
export declare function addToGitignore(markerDir: string, paths: string[]): Promise<void>;
|
|
7
|
+
/**
|
|
8
|
+
* Remove specific paths from the npmdata-managed section in .gitignore.
|
|
9
|
+
* Removes the entire section if no paths remain. Deletes the file if empty.
|
|
10
|
+
*/
|
|
11
|
+
export declare function removeFromGitignore(markerDir: string, paths: string[]): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Replace the entire npmdata-managed gitignore section with a new set of paths.
|
|
14
|
+
*/
|
|
15
|
+
export declare function updateGitignoreSection(markerDir: string, managedPaths: string[], createIfMissing: boolean): void;
|
|
16
|
+
//# sourceMappingURL=gitignore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.d.ts","sourceRoot":"","sources":["../../src/fileset/gitignore.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAEtF;AAED;;;GAGG;AACH,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EAAE,EACtB,eAAe,EAAE,OAAO,GACvB,IAAI,CAaN"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.addToGitignore = addToGitignore;
|
|
7
|
+
exports.removeFromGitignore = removeFromGitignore;
|
|
8
|
+
exports.updateGitignoreSection = updateGitignoreSection;
|
|
9
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const constants_1 = require("./constants");
|
|
12
|
+
/**
|
|
13
|
+
* Add paths to the npmdata-managed section in .gitignore.
|
|
14
|
+
* Creates the file if it does not exist.
|
|
15
|
+
* Always includes the MARKER_FILE itself in the managed section.
|
|
16
|
+
*/
|
|
17
|
+
async function addToGitignore(markerDir, paths) {
|
|
18
|
+
updateGitignoreSection(markerDir, paths, true);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Remove specific paths from the npmdata-managed section in .gitignore.
|
|
22
|
+
* Removes the entire section if no paths remain. Deletes the file if empty.
|
|
23
|
+
*/
|
|
24
|
+
async function removeFromGitignore(markerDir, paths) {
|
|
25
|
+
const gitignorePath = node_path_1.default.join(markerDir, constants_1.GITIGNORE_FILE);
|
|
26
|
+
if (!node_fs_1.default.existsSync(gitignorePath))
|
|
27
|
+
return;
|
|
28
|
+
const existingContent = node_fs_1.default.readFileSync(gitignorePath, 'utf8');
|
|
29
|
+
const { beforeSection, managedEntries, afterSection } = parseSections(existingContent);
|
|
30
|
+
// Remove specified paths from the managed section
|
|
31
|
+
const pathSet = new Set(paths);
|
|
32
|
+
const remaining = managedEntries.filter((e) => !pathSet.has(e) && e !== constants_1.MARKER_FILE);
|
|
33
|
+
writeGitignore(gitignorePath, beforeSection, remaining, afterSection);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Replace the entire npmdata-managed gitignore section with a new set of paths.
|
|
37
|
+
*/
|
|
38
|
+
function updateGitignoreSection(markerDir, managedPaths, createIfMissing) {
|
|
39
|
+
const gitignorePath = node_path_1.default.join(markerDir, constants_1.GITIGNORE_FILE);
|
|
40
|
+
let existingContent = '';
|
|
41
|
+
if (node_fs_1.default.existsSync(gitignorePath)) {
|
|
42
|
+
existingContent = node_fs_1.default.readFileSync(gitignorePath, 'utf8');
|
|
43
|
+
}
|
|
44
|
+
const { beforeSection, afterSection, hasSection } = parseSections(existingContent);
|
|
45
|
+
if (!createIfMissing && !hasSection)
|
|
46
|
+
return;
|
|
47
|
+
writeGitignore(gitignorePath, beforeSection, managedPaths, afterSection);
|
|
48
|
+
}
|
|
49
|
+
function parseSections(content) {
|
|
50
|
+
const startIdx = content.indexOf(constants_1.GITIGNORE_START);
|
|
51
|
+
const endIdx = content.indexOf(constants_1.GITIGNORE_END);
|
|
52
|
+
const hasSection = startIdx !== -1 && endIdx !== -1 && startIdx < endIdx;
|
|
53
|
+
if (!hasSection) {
|
|
54
|
+
return { beforeSection: content, managedEntries: [], afterSection: '', hasSection: false };
|
|
55
|
+
}
|
|
56
|
+
const beforeSection = content.slice(0, startIdx).trimEnd();
|
|
57
|
+
const sectionContent = content.slice(startIdx + constants_1.GITIGNORE_START.length, endIdx);
|
|
58
|
+
const managedEntries = sectionContent
|
|
59
|
+
.split('\n')
|
|
60
|
+
.map((l) => l.trim())
|
|
61
|
+
.filter((l) => l.length > 0 && l !== constants_1.MARKER_FILE);
|
|
62
|
+
const afterSection = content.slice(endIdx + constants_1.GITIGNORE_END.length).trimStart();
|
|
63
|
+
return { beforeSection, managedEntries, afterSection, hasSection: true };
|
|
64
|
+
}
|
|
65
|
+
function writeGitignore(gitignorePath, beforeSection, managedPaths, afterSection) {
|
|
66
|
+
if (managedPaths.length === 0) {
|
|
67
|
+
// Remove the managed section entirely
|
|
68
|
+
const updatedContent = [beforeSection, afterSection].filter(Boolean).join('\n');
|
|
69
|
+
if (updatedContent.trim()) {
|
|
70
|
+
node_fs_1.default.writeFileSync(gitignorePath, `${updatedContent.trimEnd()}\n`, 'utf8');
|
|
71
|
+
}
|
|
72
|
+
else if (node_fs_1.default.existsSync(gitignorePath)) {
|
|
73
|
+
node_fs_1.default.unlinkSync(gitignorePath);
|
|
74
|
+
}
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const section = [constants_1.GITIGNORE_START, constants_1.MARKER_FILE, ...managedPaths.sort(), constants_1.GITIGNORE_END].join('\n');
|
|
78
|
+
const parts = [beforeSection, section, afterSection].filter(Boolean);
|
|
79
|
+
const updatedContent = `${parts.join('\n')}\n`;
|
|
80
|
+
node_fs_1.default.writeFileSync(gitignorePath, updatedContent, 'utf8');
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=gitignore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore.js","sourceRoot":"","sources":["../../src/fileset/gitignore.ts"],"names":[],"mappings":";;;;;AAUA,wCAEC;AAMD,kDAYC;AAKD,wDAiBC;AApDD,sDAAyB;AACzB,0DAA6B;AAE7B,2CAA0F;AAE1F;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,SAAiB,EAAE,KAAe;IACrE,sBAAsB,CAAC,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC;AAED;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CAAC,SAAiB,EAAE,KAAe;IAC1E,MAAM,aAAa,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAAc,CAAC,CAAC;IAC3D,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO;IAE1C,MAAM,eAAe,GAAG,iBAAE,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/D,MAAM,EAAE,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;IAEvF,kDAAkD;IAClD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,SAAS,GAAG,cAAc,CAAC,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MAAM,OAAO,GAAG,CAAC,2BAAe,EAAE,uBAAW,EAAE,GAAG,YAAY,CAAC,IAAI,EAAE,EAAE,yBAAa,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjG,MAAM,KAAK,GAAG,CAAC,aAAa,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACrE,MAAM,cAAc,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;IAC/C,iBAAE,CAAC,aAAa,CAAC,aAAa,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { readMarker, writeMarker, markerPath, readOutputDirMarker } from './markers';
|
|
2
|
+
export { addToGitignore, removeFromGitignore, updateGitignoreSection } from './gitignore';
|
|
3
|
+
export { installedPackagePath, enumeratePackageFiles } from './package-files';
|
|
4
|
+
export { MARKER_FILE, DEFAULT_FILENAME_PATTERNS, GITIGNORE_FILE } from './constants';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/fileset/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GITIGNORE_FILE = exports.DEFAULT_FILENAME_PATTERNS = exports.MARKER_FILE = exports.enumeratePackageFiles = exports.installedPackagePath = exports.updateGitignoreSection = exports.removeFromGitignore = exports.addToGitignore = exports.readOutputDirMarker = exports.markerPath = exports.writeMarker = exports.readMarker = void 0;
|
|
4
|
+
// Public fileset-layer API
|
|
5
|
+
var markers_1 = require("./markers");
|
|
6
|
+
Object.defineProperty(exports, "readMarker", { enumerable: true, get: function () { return markers_1.readMarker; } });
|
|
7
|
+
Object.defineProperty(exports, "writeMarker", { enumerable: true, get: function () { return markers_1.writeMarker; } });
|
|
8
|
+
Object.defineProperty(exports, "markerPath", { enumerable: true, get: function () { return markers_1.markerPath; } });
|
|
9
|
+
Object.defineProperty(exports, "readOutputDirMarker", { enumerable: true, get: function () { return markers_1.readOutputDirMarker; } });
|
|
10
|
+
var gitignore_1 = require("./gitignore");
|
|
11
|
+
Object.defineProperty(exports, "addToGitignore", { enumerable: true, get: function () { return gitignore_1.addToGitignore; } });
|
|
12
|
+
Object.defineProperty(exports, "removeFromGitignore", { enumerable: true, get: function () { return gitignore_1.removeFromGitignore; } });
|
|
13
|
+
Object.defineProperty(exports, "updateGitignoreSection", { enumerable: true, get: function () { return gitignore_1.updateGitignoreSection; } });
|
|
14
|
+
var package_files_1 = require("./package-files");
|
|
15
|
+
Object.defineProperty(exports, "installedPackagePath", { enumerable: true, get: function () { return package_files_1.installedPackagePath; } });
|
|
16
|
+
Object.defineProperty(exports, "enumeratePackageFiles", { enumerable: true, get: function () { return package_files_1.enumeratePackageFiles; } });
|
|
17
|
+
var constants_1 = require("./constants");
|
|
18
|
+
Object.defineProperty(exports, "MARKER_FILE", { enumerable: true, get: function () { return constants_1.MARKER_FILE; } });
|
|
19
|
+
Object.defineProperty(exports, "DEFAULT_FILENAME_PATTERNS", { enumerable: true, get: function () { return constants_1.DEFAULT_FILENAME_PATTERNS; } });
|
|
20
|
+
Object.defineProperty(exports, "GITIGNORE_FILE", { enumerable: true, get: function () { return constants_1.GITIGNORE_FILE; } });
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fileset/index.ts"],"names":[],"mappings":";;;AAAA,2BAA2B;AAC3B,qCAAqF;AAA5E,qGAAA,UAAU,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,8GAAA,mBAAmB,OAAA;AACjE,yCAA0F;AAAjF,2GAAA,cAAc,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAAE,mHAAA,sBAAsB,OAAA;AACpE,iDAA8E;AAArE,qHAAA,oBAAoB,OAAA;AAAE,sHAAA,qBAAqB,OAAA;AACpD,yCAAqF;AAA5E,wGAAA,WAAW,OAAA;AAAE,sHAAA,yBAAyB,OAAA;AAAE,2GAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/fileset/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAExF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listManagedFiles = listManagedFiles;
|
|
4
|
+
const markers_1 = require("./markers");
|
|
5
|
+
/**
|
|
6
|
+
* Read all managed files from a single output directory's .npmdata marker.
|
|
7
|
+
*/
|
|
8
|
+
async function listManagedFiles(outputDir) {
|
|
9
|
+
return (0, markers_1.readOutputDirMarker)(outputDir);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../src/fileset/list.ts"],"names":[],"mappings":";;AAOA,4CAEC;AAPD,uCAAgD;AAEhD;;GAEG;AACI,KAAK,UAAU,gBAAgB,CAAC,SAAiB;IACtD,OAAO,IAAA,6BAAmB,EAAC,SAAS,CAAC,CAAC;AACxC,CAAC"}
|