@zokugun/artifact 0.5.2 → 0.6.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/bin/artifact +1 -1
- package/lib/cli.d.ts +1 -0
- package/lib/cli.js +12 -4
- package/lib/commands/add.d.ts +6 -0
- package/lib/commands/add.js +47 -36
- package/lib/commands/index.d.ts +4 -0
- package/lib/commands/index.js +9 -7
- package/lib/commands/list.d.ts +1 -0
- package/lib/commands/list.js +13 -8
- package/lib/commands/remove.d.ts +6 -0
- package/lib/commands/remove.js +79 -0
- package/lib/commands/update.d.ts +5 -0
- package/lib/commands/update.js +43 -39
- package/lib/compositors/compose.d.ts +7 -0
- package/lib/compositors/compose.js +13 -13
- package/lib/compositors/fork.d.ts +3 -0
- package/lib/compositors/fork.js +4 -4
- package/lib/compositors/index.d.ts +6 -0
- package/lib/compositors/index.js +12 -12
- package/lib/compositors/json.d.ts +2 -0
- package/lib/compositors/json.js +14 -12
- package/lib/compositors/map-sort.d.ts +2 -0
- package/lib/compositors/map-sort.js +2 -2
- package/lib/compositors/rc.d.ts +2 -0
- package/lib/compositors/rc.js +13 -10
- package/lib/compositors/yaml.d.ts +2 -0
- package/lib/compositors/yaml.js +8 -11
- package/lib/configs/index.d.ts +3 -0
- package/lib/configs/index.js +3 -2
- package/lib/configs/install/index.d.ts +3 -0
- package/lib/configs/install/index.js +6 -6
- package/lib/configs/install/read-install-config.d.ts +6 -0
- package/lib/configs/install/read-install-config.js +123 -80
- package/lib/configs/install/update-install-config.d.ts +2 -0
- package/lib/configs/install/write-install-config.d.ts +5 -0
- package/lib/configs/install/write-install-config.js +17 -9
- package/lib/configs/package/index.d.ts +1 -0
- package/lib/configs/package/index.js +2 -2
- package/lib/configs/package/read-package-config.d.ts +3 -0
- package/lib/configs/package/read-package-config.js +159 -40
- package/lib/configs/uninstall/index.d.ts +1 -0
- package/lib/configs/uninstall/index.js +5 -0
- package/lib/configs/uninstall/update-uninstall-config.d.ts +2 -0
- package/lib/configs/uninstall/update-uninstall-config.js +6 -0
- package/lib/configs/utils/constants.d.ts +11 -0
- package/lib/configs/utils/constants.js +24 -0
- package/lib/configs/utils/is-transform.d.ts +2 -0
- package/lib/configs/utils/is-transform.js +16 -0
- package/lib/configs/utils/merge-upsert-property.d.ts +3 -0
- package/lib/configs/utils/merge-upsert-property.js +68 -0
- package/lib/configs/utils/normalize-file-always.d.ts +3 -0
- package/lib/configs/utils/normalize-file-always.js +28 -0
- package/lib/configs/utils/normalize-file-uninstall.d.ts +3 -0
- package/lib/configs/utils/normalize-file-uninstall.js +31 -0
- package/lib/configs/utils/normalize-file-upsert.d.ts +3 -0
- package/lib/configs/utils/normalize-file-upsert.js +54 -0
- package/lib/journeys/commitlint/index.d.ts +2 -0
- package/lib/journeys/commitlint/index.js +15 -15
- package/lib/journeys/config.ts/index.d.ts +2 -0
- package/lib/journeys/config.ts/index.js +5 -5
- package/lib/journeys/default/index.d.ts +2 -0
- package/lib/journeys/default/index.js +11 -14
- package/lib/journeys/fixpack/index.d.ts +2 -0
- package/lib/journeys/fixpack/index.js +13 -13
- package/lib/journeys/gitignore/index.d.ts +2 -0
- package/lib/journeys/gitignore/index.js +5 -5
- package/lib/journeys/ignore/index.d.ts +2 -0
- package/lib/journeys/ignore/index.js +5 -5
- package/lib/journeys/index.d.ts +2 -0
- package/lib/journeys/index.js +20 -20
- package/lib/journeys/npmignore/index.d.ts +2 -0
- package/lib/journeys/npmignore/index.js +5 -5
- package/lib/journeys/package/index.d.ts +2 -0
- package/lib/journeys/package/index.js +27 -30
- package/lib/journeys/rc/index.d.ts +2 -0
- package/lib/journeys/rc/index.js +12 -12
- package/lib/journeys/tsconfig/index.d.ts +2 -0
- package/lib/journeys/tsconfig/index.js +13 -16
- package/lib/parsers/json.d.ts +2 -0
- package/lib/parsers/jsonc/index.d.ts +2 -0
- package/lib/parsers/jsonc/index.js +4 -4
- package/lib/parsers/jsonc/parse.d.ts +5 -0
- package/lib/parsers/jsonc/parse.js +1 -13
- package/lib/parsers/jsonc/stringify.d.ts +2 -0
- package/lib/parsers/jsonc/stringify.js +2 -2
- package/lib/parsers/jsonc/transform.d.ts +10 -0
- package/lib/parsers/yaml.d.ts +2 -0
- package/lib/routes/command.d.ts +4 -0
- package/lib/routes/command.js +10 -10
- package/lib/routes/index.d.ts +8 -0
- package/lib/routes/index.js +17 -15
- package/lib/routes/lines-concat.d.ts +4 -0
- package/lib/routes/lines-concat.js +7 -7
- package/lib/routes/list-concat.d.ts +4 -0
- package/lib/routes/list-concat.js +3 -7
- package/lib/routes/list-sort-concat.d.ts +4 -0
- package/lib/routes/list-sort-concat.js +1 -1
- package/lib/routes/map-concat.d.ts +4 -0
- package/lib/routes/map-concat.js +1 -1
- package/lib/routes/map-delete.d.ts +4 -0
- package/lib/routes/map-delete.js +32 -0
- package/lib/routes/overwrite.d.ts +4 -0
- package/lib/routes/overwrite.js +2 -2
- package/lib/routes/primitive.d.ts +4 -0
- package/lib/routes/primitive.js +3 -3
- package/lib/steps/apply-formatting.d.ts +8 -0
- package/lib/steps/apply-formatting.js +19 -15
- package/lib/steps/configure-branches.d.ts +3 -0
- package/lib/steps/configure-branches.js +8 -5
- package/lib/steps/configure-install-file-actions.d.ts +3 -0
- package/lib/steps/configure-install-file-actions.js +41 -86
- package/lib/steps/configure-uninstall-file-actions.d.ts +3 -0
- package/lib/steps/configure-uninstall-file-actions.js +53 -0
- package/lib/steps/configure-update-file-actions.d.ts +3 -0
- package/lib/steps/configure-update-file-actions.js +64 -97
- package/lib/steps/copy-binary-files.d.ts +3 -0
- package/lib/steps/copy-binary-files.js +24 -11
- package/lib/steps/execute-first-block.d.ts +3 -0
- package/lib/steps/execute-first-block.js +35 -14
- package/lib/steps/execute-next-block.d.ts +3 -0
- package/lib/steps/execute-next-block.js +8 -3
- package/lib/steps/index.d.ts +54 -0
- package/lib/steps/index.js +76 -54
- package/lib/steps/insert-final-new-line.d.ts +6 -0
- package/lib/steps/insert-final-new-line.js +13 -1
- package/lib/steps/merge-text-files.d.ts +3 -0
- package/lib/steps/merge-text-files.js +41 -27
- package/lib/steps/read-editor-config.d.ts +3 -0
- package/lib/steps/read-editor-config.js +21 -26
- package/lib/steps/read-files.d.ts +3 -0
- package/lib/steps/read-files.js +19 -8
- package/lib/steps/read-incoming-config.d.ts +3 -0
- package/lib/steps/read-incoming-config.js +7 -5
- package/lib/steps/read-incoming-package.d.ts +3 -0
- package/lib/steps/read-incoming-package.js +12 -7
- package/lib/steps/remove-files.d.ts +3 -0
- package/lib/steps/remove-files.js +10 -4
- package/lib/steps/rename-files.d.ts +3 -0
- package/lib/steps/rename-files.js +25 -0
- package/lib/steps/replace-templates.d.ts +3 -0
- package/lib/steps/replace-templates.js +19 -5
- package/lib/steps/transform-untouched-files.d.ts +3 -0
- package/lib/steps/transform-untouched-files.js +73 -0
- package/lib/steps/unmerge-text-files.d.ts +3 -0
- package/lib/steps/unmerge-text-files.js +63 -0
- package/lib/steps/validate-newer-package.d.ts +3 -0
- package/lib/steps/validate-newer-package.js +4 -2
- package/lib/steps/validate-not-present-package.d.ts +3 -0
- package/lib/steps/validate-not-present-package.js +7 -4
- package/lib/steps/validate-present-package.d.ts +3 -0
- package/lib/steps/validate-present-package.js +24 -0
- package/lib/steps/write-text-files.d.ts +3 -0
- package/lib/steps/write-text-files.js +16 -7
- package/lib/types/binary-file.d.ts +4 -0
- package/lib/types/command.d.ts +5 -0
- package/lib/types/config.d.ts +58 -0
- package/lib/types/context.d.ts +56 -0
- package/lib/types/format.d.ts +10 -0
- package/lib/types/step.d.ts +3 -0
- package/lib/types/text-file.d.ts +7 -0
- package/lib/types/travel.d.ts +14 -0
- package/lib/utils/apply-transforms.d.ts +2 -0
- package/lib/utils/apply-transforms.js +48 -0
- package/lib/utils/build-journey-plan.d.ts +2 -0
- package/lib/utils/build-route.d.ts +3 -0
- package/lib/utils/build-route.js +92 -0
- package/lib/utils/build-travel-plan.d.ts +2 -0
- package/lib/utils/build-travel.d.ts +3 -0
- package/lib/utils/build-travel.js +32 -0
- package/lib/utils/command/dedupe-strings.d.ts +1 -0
- package/lib/utils/command/index.d.ts +8 -0
- package/lib/utils/command/index.js +14 -14
- package/lib/utils/command/join-command.d.ts +2 -0
- package/lib/utils/command/merge-and-chains.d.ts +1 -0
- package/lib/utils/command/merge-and-chains.js +21 -21
- package/lib/utils/command/merge-command-records.d.ts +2 -0
- package/lib/utils/command/merge-command-records.js +43 -22
- package/lib/utils/command/merge-flag-tokens.d.ts +1 -0
- package/lib/utils/command/merge-flag-tokens.js +1 -1
- package/lib/utils/command/merge-flags-as-string.d.ts +4 -0
- package/lib/utils/command/merge-flags-as-string.js +4 -4
- package/lib/utils/command/merge-or-segments.d.ts +1 -0
- package/lib/utils/command/merge-or-segments.js +28 -28
- package/lib/utils/command/merge-parts-by-prefix.d.ts +1 -0
- package/lib/utils/command/merge-parts-by-prefix.js +6 -6
- package/lib/utils/command/merge-semicolon-segments.d.ts +1 -0
- package/lib/utils/command/merge-semicolon-segments.js +35 -35
- package/lib/utils/command/merge-with-semicolon-mix.d.ts +1 -0
- package/lib/utils/command/merge-with-semicolon-mix.js +12 -12
- package/lib/utils/command/prefix-of-command.d.ts +1 -0
- package/lib/utils/command/prefix-of-command.js +2 -2
- package/lib/utils/command/split-chain.d.ts +1 -0
- package/lib/utils/command/split-command.d.ts +2 -0
- package/lib/utils/command/split-command.js +8 -8
- package/lib/utils/command/split-prefix-and-flags.d.ts +4 -0
- package/lib/utils/command/split-prefix-and-flags.js +5 -5
- package/lib/utils/command/split-segments.d.ts +1 -0
- package/lib/utils/detect-indent.d.ts +5 -0
- package/lib/utils/detect-indent.js +60 -0
- package/lib/utils/flow.d.ts +3 -0
- package/lib/utils/flow.js +12 -0
- package/lib/utils/get-format.d.ts +2 -0
- package/lib/utils/get-format.js +19 -0
- package/lib/utils/has-final-new-line.d.ts +1 -0
- package/lib/utils/has-final-new-line.js +7 -0
- package/lib/utils/read-buffer.d.ts +2 -0
- package/lib/utils/resolve-request.d.ts +3 -0
- package/lib/utils/resolve-request.js +4 -3
- package/lib/utils/template.d.ts +17 -0
- package/lib/utils/template.js +79 -57
- package/lib/utils/to-lines.d.ts +1 -0
- package/lib/utils/trim-final-newline.d.ts +1 -0
- package/lib/utils/try-json.d.ts +1 -0
- package/lib/utils/try-json.js +2 -2
- package/package.json +123 -101
- package/lib/utils/dev-null.js +0 -7
package/lib/utils/template.js
CHANGED
|
@@ -39,92 +39,105 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.TemplateEngine = void 0;
|
|
40
40
|
exports.unescapeCode = unescapeCode;
|
|
41
41
|
const path_1 = __importDefault(require("path"));
|
|
42
|
+
const sync_1 = __importDefault(require("@zokugun/fs-extra-plus/sync"));
|
|
43
|
+
const xtry_1 = require("@zokugun/xtry");
|
|
42
44
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
43
45
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const try_json_1 = require("./try-json");
|
|
46
|
+
const lodash_es_1 = require("lodash-es");
|
|
47
|
+
const YAML = __importStar(require("../parsers/yaml.js"));
|
|
48
|
+
const try_json_js_1 = require("./try-json.js");
|
|
48
49
|
dayjs_1.default.extend(utc_1.default);
|
|
50
|
+
const EXPRESSION_REGEX = /#\[\[(.*?)]]/g;
|
|
49
51
|
const NEXT_PROPERTY_REGEX = /^(\w+?)((?=\.|$).*)$/;
|
|
50
52
|
const PLACEHOLDER_REGEX = /^((?:[^/.]+(?:[^/]+\/)*\/)?\.?[^.]+(?:\.(?:json|ya?ml))?)\.(.*)$/;
|
|
51
|
-
class TemplateError extends Error {
|
|
52
|
-
constructor(message) {
|
|
53
|
-
super(message);
|
|
54
|
-
this.name = 'TemplateError';
|
|
55
|
-
} // }}}
|
|
56
|
-
}
|
|
57
53
|
class TemplateEngine {
|
|
54
|
+
basePath;
|
|
55
|
+
fileCache = new Map();
|
|
56
|
+
variables;
|
|
57
|
+
variableCache = new Map();
|
|
58
58
|
constructor(basePath, variables) {
|
|
59
|
-
this.fileCache = new Map();
|
|
60
|
-
this.variableCache = new Map();
|
|
61
59
|
this.basePath = basePath;
|
|
62
60
|
this.variables = variables ?? {};
|
|
63
61
|
} // }}}
|
|
64
62
|
render(template) {
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
let content = '';
|
|
64
|
+
let lastIndex = 0;
|
|
65
|
+
let match;
|
|
66
|
+
while ((match = EXPRESSION_REGEX.exec(template))) {
|
|
67
|
+
const result = this.resolveExpression(match[1]);
|
|
68
|
+
if (result.fails) {
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
71
|
+
content += template.slice(lastIndex, match.index) + result.value;
|
|
72
|
+
lastIndex = EXPRESSION_REGEX.lastIndex;
|
|
73
|
+
}
|
|
74
|
+
content += template.slice(lastIndex);
|
|
75
|
+
return (0, xtry_1.ok)(content);
|
|
67
76
|
} // }}}
|
|
68
77
|
getValueByPath(values, propertyPath) {
|
|
69
78
|
let currentPath = propertyPath;
|
|
70
79
|
let currentValue = values;
|
|
71
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
72
80
|
let match;
|
|
73
81
|
while ((match = NEXT_PROPERTY_REGEX.exec(currentPath))) {
|
|
74
|
-
if (!(0,
|
|
75
|
-
|
|
82
|
+
if (!(0, lodash_es_1.isPlainObject)(currentValue)) {
|
|
83
|
+
return (0, xtry_1.err)(`Property path not found: ${propertyPath}`);
|
|
76
84
|
}
|
|
77
85
|
currentValue = currentValue[match[1]];
|
|
78
|
-
if ((0,
|
|
79
|
-
|
|
86
|
+
if ((0, lodash_es_1.isNil)(currentValue)) {
|
|
87
|
+
return (0, xtry_1.err)(`Property not found: ${propertyPath}`);
|
|
80
88
|
}
|
|
81
89
|
currentPath = match[2];
|
|
82
90
|
if (currentPath.length === 0) {
|
|
83
|
-
return currentValue;
|
|
91
|
+
return (0, xtry_1.ok)(currentValue);
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
// eslint-disable-next-line no-new-func
|
|
87
95
|
const fn = new Function('it', `return it${unescapeCode(currentPath)};`);
|
|
88
|
-
return fn(currentValue);
|
|
96
|
+
return (0, xtry_1.ok)(fn(currentValue));
|
|
89
97
|
} // }}}
|
|
90
98
|
parseFile(filename) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
throw new TemplateError(`File not found: ${filename}`);
|
|
99
|
+
const result = sync_1.default.readFile(filename, 'utf8');
|
|
100
|
+
if (result.fails) {
|
|
101
|
+
return (0, xtry_1.err)(`TemplateError: File not found: ${filename}`);
|
|
97
102
|
}
|
|
98
|
-
const
|
|
103
|
+
const content = result.value;
|
|
104
|
+
const extension = path_1.default.extname(filename).toLowerCase();
|
|
99
105
|
try {
|
|
100
|
-
if (
|
|
101
|
-
return JSON.parse(content);
|
|
106
|
+
if (extension === '.json') {
|
|
107
|
+
return (0, xtry_1.ok)(JSON.parse(content));
|
|
102
108
|
}
|
|
103
|
-
else if (
|
|
104
|
-
return YAML.parse(content);
|
|
109
|
+
else if (extension === '.yaml' || extension === '.yml') {
|
|
110
|
+
return (0, xtry_1.ok)(YAML.parse(content));
|
|
105
111
|
}
|
|
106
112
|
else {
|
|
107
|
-
return (0,
|
|
113
|
+
return (0, xtry_1.ok)((0, try_json_js_1.tryJSON)(content) ?? YAML.parse(content));
|
|
108
114
|
}
|
|
109
115
|
}
|
|
110
116
|
catch (parseError) {
|
|
111
|
-
|
|
117
|
+
return (0, xtry_1.err)(`Failed to parse ${filename}: ${parseError.message}`);
|
|
112
118
|
}
|
|
113
119
|
} // }}}
|
|
114
120
|
readConfigFile(filename) {
|
|
115
121
|
// Check cache first
|
|
116
122
|
if (this.fileCache.has(filename)) {
|
|
117
|
-
return this.fileCache.get(filename);
|
|
123
|
+
return (0, xtry_1.ok)(this.fileCache.get(filename));
|
|
118
124
|
}
|
|
119
125
|
const filePath = path_1.default.resolve(this.basePath, filename);
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
const result = this.parseFile(filePath);
|
|
127
|
+
if (result.fails) {
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
this.fileCache.set(filename, result.value);
|
|
131
|
+
return result;
|
|
123
132
|
} // }}}
|
|
124
133
|
resolveExpression(expression) {
|
|
125
|
-
const
|
|
134
|
+
const result = this.splitPlaceholder(expression);
|
|
135
|
+
if (result.fails) {
|
|
136
|
+
return result;
|
|
137
|
+
}
|
|
138
|
+
const { name, propertyPath } = result.value;
|
|
126
139
|
if (!name || !propertyPath) {
|
|
127
|
-
|
|
140
|
+
return (0, xtry_1.err)(`Invalid expression format: ${expression}. Expected format: #[[filename.property]]`);
|
|
128
141
|
}
|
|
129
142
|
if (name === 'date') {
|
|
130
143
|
return this.toDate(propertyPath);
|
|
@@ -133,48 +146,57 @@ class TemplateEngine {
|
|
|
133
146
|
return this.resolveVariable(propertyPath);
|
|
134
147
|
}
|
|
135
148
|
else {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
149
|
+
const readResult = this.readConfigFile(name);
|
|
150
|
+
if (readResult.fails) {
|
|
151
|
+
return readResult;
|
|
152
|
+
}
|
|
153
|
+
const getValueResult = this.getValueByPath(readResult.value, propertyPath);
|
|
154
|
+
if (getValueResult.fails) {
|
|
155
|
+
return getValueResult;
|
|
140
156
|
}
|
|
141
|
-
|
|
157
|
+
if ((0, lodash_es_1.isNil)(getValueResult.value)) {
|
|
158
|
+
return (0, xtry_1.err)(expression);
|
|
159
|
+
}
|
|
160
|
+
return (0, xtry_1.ok)(String(getValueResult.value));
|
|
142
161
|
}
|
|
143
162
|
} // }}}
|
|
144
163
|
resolveVariable(name) {
|
|
145
164
|
if (this.variableCache.has(name)) {
|
|
146
|
-
return this.variableCache.get(name);
|
|
165
|
+
return (0, xtry_1.ok)(this.variableCache.get(name));
|
|
147
166
|
}
|
|
148
167
|
const expression = this.variables[name];
|
|
149
168
|
if (typeof expression !== 'string' || expression.trim().length === 0) {
|
|
150
|
-
|
|
169
|
+
return (0, xtry_1.err)(`Invalid variable: ${name}.`);
|
|
170
|
+
}
|
|
171
|
+
const result = this.resolveExpression(expression);
|
|
172
|
+
if (result.fails) {
|
|
173
|
+
return result;
|
|
151
174
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return content;
|
|
175
|
+
this.variableCache.set(name, result.value);
|
|
176
|
+
return result;
|
|
155
177
|
} // }}}
|
|
156
178
|
splitPlaceholder(placeholder) {
|
|
157
179
|
const matches = PLACEHOLDER_REGEX.exec(placeholder);
|
|
158
180
|
if (!matches) {
|
|
159
|
-
|
|
181
|
+
return (0, xtry_1.err)(`Invalid expression format: ${placeholder}. Expected format: #[[filename.property]]`);
|
|
160
182
|
}
|
|
161
|
-
const [,
|
|
162
|
-
return
|
|
183
|
+
const [, name, propertyPath] = matches;
|
|
184
|
+
return (0, xtry_1.ok)({ name, propertyPath });
|
|
163
185
|
} // }}}
|
|
164
186
|
toDate(format) {
|
|
165
187
|
try {
|
|
166
188
|
const now = (0, dayjs_1.default)().utc();
|
|
167
189
|
if (format === 'utc') {
|
|
168
|
-
return now.format('YYYY-MM-DD HH:mm:ss');
|
|
190
|
+
return (0, xtry_1.ok)(now.format('YYYY-MM-DD HH:mm:ss'));
|
|
169
191
|
}
|
|
170
|
-
return now.format(format);
|
|
192
|
+
return (0, xtry_1.ok)(now.format(format));
|
|
171
193
|
}
|
|
172
194
|
catch {
|
|
173
|
-
|
|
195
|
+
return (0, xtry_1.err)(`Invalid date format: ${format}`);
|
|
174
196
|
}
|
|
175
197
|
} // }}}
|
|
176
198
|
}
|
|
177
199
|
exports.TemplateEngine = TemplateEngine;
|
|
178
200
|
function unescapeCode(code) {
|
|
179
|
-
return code.
|
|
201
|
+
return code.replaceAll(/\\('|\\)/g, '$1').replaceAll(/[\r\t\n]/g, ' ');
|
|
180
202
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function toLines(value: string): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function trimFinalNewLine(value: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJSON(value: string): Record<string, unknown> | undefined;
|
package/lib/utils/try-json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,103 +1,125 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
2
|
+
"name": "@zokugun/artifact",
|
|
3
|
+
"description": "Boilerplate your project & keep your configurations up to date",
|
|
4
|
+
"version": "0.6.0",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "Baptiste Augrain",
|
|
7
|
+
"email": "daiyam@zokugun.org"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"homepage": "https://github.com/zokugun/artifact",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/zokugun/artifact.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/zokugun/artifact/discussions/categories/issue-triage"
|
|
17
|
+
},
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=18.20"
|
|
20
|
+
},
|
|
21
|
+
"bin": {
|
|
22
|
+
"artifact": "bin/artifact",
|
|
23
|
+
"atf": "bin/artifact"
|
|
24
|
+
},
|
|
25
|
+
"scripts": {
|
|
26
|
+
"audit:fix": "npm audit fix --min-release-age=0",
|
|
27
|
+
"build": "npm run clean && npm run compile:src",
|
|
28
|
+
"ci:lint": "zizmor .",
|
|
29
|
+
"ci:lint:fix": "zizmor . --fix=all",
|
|
30
|
+
"clean": "rimraf .test lib",
|
|
31
|
+
"compile:src": "tsc -p src",
|
|
32
|
+
"lint": "xo",
|
|
33
|
+
"lint:all": "fixpack && npm run ci:lint && npm run lint",
|
|
34
|
+
"lint:fix": "xo --fix",
|
|
35
|
+
"prepare": "husky; fixpack || true",
|
|
36
|
+
"release": "release-it",
|
|
37
|
+
"test": "tsc -p test && mocha",
|
|
38
|
+
"test:dev": "mocha",
|
|
39
|
+
"test:watch": "tsc-watch -p src -p test --onSuccess 'mocha -g=\"\"'",
|
|
40
|
+
"update:artifacts": "artifact update",
|
|
41
|
+
"update:ci": "PINACT_MIN_AGE=7 pinact run",
|
|
42
|
+
"update:deps": "taze",
|
|
43
|
+
"watch:build": "tsc-watch -p src --onSuccess 'npm run build'",
|
|
44
|
+
"watch:src": "tsc-watch -p src",
|
|
45
|
+
"watch:test": "tsc-watch -p test"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@zokugun/cli-utils": "0.3.1",
|
|
49
|
+
"@zokugun/configdotts-merge": "0.2.1",
|
|
50
|
+
"@zokugun/fs-extra-plus": "0.3.7",
|
|
51
|
+
"@zokugun/is-it-type": "0.8.1",
|
|
52
|
+
"@zokugun/xtry": "0.11.4",
|
|
53
|
+
"dayjs": "1.11.20",
|
|
54
|
+
"detect-indent": "6.1.0",
|
|
55
|
+
"editorconfig": "0.15.3",
|
|
56
|
+
"globby": "11.1.0",
|
|
57
|
+
"istextorbinary": "6.0.0",
|
|
58
|
+
"jq-wasm": "1.1.0-jq-1.8.1",
|
|
59
|
+
"jsonc-parser": "3.3.1",
|
|
60
|
+
"lodash-es": "4.18.1",
|
|
61
|
+
"micromatch": "4.0.8",
|
|
62
|
+
"pacote": "21.5.0",
|
|
63
|
+
"semver": "7.7.4",
|
|
64
|
+
"tempy": "1.0.1",
|
|
65
|
+
"untildify": "4.0.0",
|
|
66
|
+
"yaml": "2.8.3"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@commitlint/cli": "19.8.1",
|
|
70
|
+
"@commitlint/config-conventional": "19.8.1",
|
|
71
|
+
"@types/chai": "4.3.20",
|
|
72
|
+
"@types/chai-as-promised": "7.1.8",
|
|
73
|
+
"@types/lodash-es": "4.17.12",
|
|
74
|
+
"@types/micromatch": "4.0.10",
|
|
75
|
+
"@types/mocha": "9.1.1",
|
|
76
|
+
"@types/node": "20.19.39",
|
|
77
|
+
"@types/npm": "7.19.3",
|
|
78
|
+
"@types/pacote": "11.1.8",
|
|
79
|
+
"@types/semver": "7.7.1",
|
|
80
|
+
"@types/universalify": "1.0.3",
|
|
81
|
+
"camelcase": "6.3.0",
|
|
82
|
+
"chai": "4.5.0",
|
|
83
|
+
"chai-as-promised": "7.1.2",
|
|
84
|
+
"eslint": "8.11.0",
|
|
85
|
+
"eslint-plugin-chai-friendly": "0.7.4",
|
|
86
|
+
"fixpack": "4.0.0",
|
|
87
|
+
"husky": "9.1.7",
|
|
88
|
+
"lint-staged": "16.4.0",
|
|
89
|
+
"memfs": "3.6.0",
|
|
90
|
+
"mocha": "9.2.2",
|
|
91
|
+
"release-it": "20.0.0-1",
|
|
92
|
+
"rewiremock": "3.14.6",
|
|
93
|
+
"source-map-support": "0.5.21",
|
|
94
|
+
"taze": "19.11.0",
|
|
95
|
+
"tsc-watch": "7.2.0",
|
|
96
|
+
"typescript": "5.9.3",
|
|
97
|
+
"universalify": "2.0.1",
|
|
98
|
+
"xo": "0.60.0"
|
|
99
|
+
},
|
|
100
|
+
"overrides": {
|
|
101
|
+
"mocha": {
|
|
102
|
+
"diff": "5.2.2",
|
|
103
|
+
"js-yaml": "4.1.1",
|
|
104
|
+
"minimatch": "4.2.6",
|
|
105
|
+
"nanoid": "3.3.11",
|
|
106
|
+
"serialize-javascript": "7.0.5"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"keywords": [
|
|
110
|
+
"artifact",
|
|
111
|
+
"boilerplate",
|
|
112
|
+
"boilerplates",
|
|
113
|
+
"codegeneration",
|
|
114
|
+
"codemod",
|
|
115
|
+
"codemods",
|
|
116
|
+
"configuration",
|
|
117
|
+
"configurations",
|
|
118
|
+
"generate",
|
|
119
|
+
"generator",
|
|
120
|
+
"project-generator",
|
|
121
|
+
"project-starter",
|
|
122
|
+
"project-template",
|
|
123
|
+
"scaffold"
|
|
124
|
+
]
|
|
103
125
|
}
|
package/lib/utils/dev-null.js
DELETED