@plumeria/init 19.1.3 → 19.1.4
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/dist/cli.js +5 -8
- package/dist/source.js +5 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -148,15 +148,11 @@ function show(actions) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
function apply(root, action) {
|
|
151
|
-
if (action.kind !== 'write' && action.kind !== 'patch')
|
|
152
|
-
return;
|
|
153
151
|
const file = node_path_1.default.join(root, action.file);
|
|
154
152
|
node_fs_1.default.mkdirSync(node_path_1.default.dirname(file), { recursive: true });
|
|
155
153
|
node_fs_1.default.writeFileSync(file, action.contents);
|
|
156
154
|
}
|
|
157
155
|
function install(root, action) {
|
|
158
|
-
if (action.kind !== 'install')
|
|
159
|
-
return 0;
|
|
160
156
|
const [command, ...args] = action.command.split(' ');
|
|
161
157
|
const result = (0, node_child_process_1.spawnSync)(command, args, {
|
|
162
158
|
cwd: root,
|
|
@@ -213,8 +209,11 @@ async function main(argv) {
|
|
|
213
209
|
return 0;
|
|
214
210
|
}
|
|
215
211
|
}
|
|
216
|
-
for (const action of actions)
|
|
217
|
-
|
|
212
|
+
for (const action of actions) {
|
|
213
|
+
if (action.kind === 'write' || action.kind === 'patch') {
|
|
214
|
+
apply(detected.root, action);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
218
217
|
const wanted = actions.find((action) => action.kind === 'install');
|
|
219
218
|
if (wanted && answers.install) {
|
|
220
219
|
console.log('');
|
|
@@ -233,8 +232,6 @@ async function main(argv) {
|
|
|
233
232
|
return 0;
|
|
234
233
|
console.log(`\n${style_1.style.manual('Left to you — these could not be written safely:')}\n`);
|
|
235
234
|
for (const action of manual) {
|
|
236
|
-
if (action.kind !== 'manual')
|
|
237
|
-
continue;
|
|
238
235
|
console.log(` ${style_1.style.strong(action.file)} ${action.note}`);
|
|
239
236
|
for (const line of action.snippet.split('\n'))
|
|
240
237
|
console.log(style_1.style.faint(` ${line}`));
|
package/dist/source.js
CHANGED
|
@@ -210,15 +210,11 @@ const directProperty = (source, open, key) => {
|
|
|
210
210
|
const char = source[i];
|
|
211
211
|
if (char === '/' && source[i + 1] === '/') {
|
|
212
212
|
const line = source.indexOf('\n', i);
|
|
213
|
-
if (line === -1)
|
|
214
|
-
return undefined;
|
|
215
213
|
i = line;
|
|
216
214
|
continue;
|
|
217
215
|
}
|
|
218
216
|
if (char === '/' && source[i + 1] === '*') {
|
|
219
217
|
const end = source.indexOf('*/', i + 2);
|
|
220
|
-
if (end === -1)
|
|
221
|
-
return undefined;
|
|
222
218
|
i = end + 1;
|
|
223
219
|
continue;
|
|
224
220
|
}
|
|
@@ -233,7 +229,7 @@ const directProperty = (source, open, key) => {
|
|
|
233
229
|
i = inner;
|
|
234
230
|
continue;
|
|
235
231
|
}
|
|
236
|
-
if (/[A-Za-z0-9_$]/.test(source[i - 1]
|
|
232
|
+
if (/[A-Za-z0-9_$]/.test(source[i - 1]))
|
|
237
233
|
continue;
|
|
238
234
|
const match = pattern.exec(source.slice(i, close));
|
|
239
235
|
if (match)
|
|
@@ -250,8 +246,7 @@ const configObjects = (source) => {
|
|
|
250
246
|
const pattern = /(?:\(|=>)\s*\(?\s*\{/g;
|
|
251
247
|
for (let match = pattern.exec(source); match; match = pattern.exec(source)) {
|
|
252
248
|
const at = match.index + match[0].length - 1;
|
|
253
|
-
|
|
254
|
-
found.push(at);
|
|
249
|
+
found.push(at);
|
|
255
250
|
}
|
|
256
251
|
return found;
|
|
257
252
|
};
|
|
@@ -304,7 +299,7 @@ const codeMask = (source) => {
|
|
|
304
299
|
return true;
|
|
305
300
|
if (!/[A-Za-z0-9_$]/.test(source[i]))
|
|
306
301
|
return false;
|
|
307
|
-
const word = /[A-Za-z0-9_$]+$/.exec(source.slice(0, i + 1))
|
|
302
|
+
const word = /[A-Za-z0-9_$]+$/.exec(source.slice(0, i + 1))[0];
|
|
308
303
|
return REGEX_AFTER.has(word);
|
|
309
304
|
}
|
|
310
305
|
return true;
|
|
@@ -371,7 +366,7 @@ const bindingNames = (binding) => {
|
|
|
371
366
|
if (braced) {
|
|
372
367
|
for (const part of braced[1].split(',')) {
|
|
373
368
|
const pieces = part.trim().split(/\s+as\s+/);
|
|
374
|
-
const name = /([A-Za-z_$][\w$]*)/.exec(pieces[pieces.length - 1]
|
|
369
|
+
const name = /([A-Za-z_$][\w$]*)/.exec(pieces[pieces.length - 1]);
|
|
375
370
|
if (name)
|
|
376
371
|
names.push(name[1]);
|
|
377
372
|
}
|
|
@@ -395,7 +390,7 @@ const importedFrom = (source, specifier) => {
|
|
|
395
390
|
if (!keyword || code[match.index + keyword.index] === ' ')
|
|
396
391
|
continue;
|
|
397
392
|
cuts.push([match.index, match.index + match[0].length]);
|
|
398
|
-
names.push(...bindingNames(match[1]
|
|
393
|
+
names.push(...bindingNames(match[1]));
|
|
399
394
|
}
|
|
400
395
|
}
|
|
401
396
|
let rest = source;
|
package/package.json
CHANGED