@tbsten/mir 0.0.1-alpha03 → 0.0.1-alpha04
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 +0 -44
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1327,7 +1327,6 @@ import path5 from "path";
|
|
|
1327
1327
|
import { MirError as MirError3 } from "@tbsten/mir-core";
|
|
1328
1328
|
var SNIPPETS_SUBDIR = "snippets";
|
|
1329
1329
|
var CONFIG_FILE = "mirconfig.yaml";
|
|
1330
|
-
var README_FILE = "README.md";
|
|
1331
1330
|
var SAMPLE_SNIPPET_YAML = `name: hello-world
|
|
1332
1331
|
description: \u30B7\u30F3\u30D7\u30EB\u306A Hello World \u30B9\u30CB\u30DA\u30C3\u30C8
|
|
1333
1332
|
|
|
@@ -1352,49 +1351,16 @@ registry:
|
|
|
1352
1351
|
- name: default
|
|
1353
1352
|
path: ~/.mir/registry
|
|
1354
1353
|
`;
|
|
1355
|
-
var README = `# mir Project
|
|
1356
|
-
|
|
1357
|
-
\u3053\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F [mir](https://github.com/tbsten/mir) \u3067\u7BA1\u7406\u3055\u308C\u3066\u3044\u307E\u3059\u3002
|
|
1358
|
-
|
|
1359
|
-
## \u30D5\u30A1\u30A4\u30EB\u69CB\u6210
|
|
1360
|
-
|
|
1361
|
-
\`\`\`
|
|
1362
|
-
.mir/
|
|
1363
|
-
\u251C\u2500\u2500 mirconfig.yaml # \u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB
|
|
1364
|
-
\u251C\u2500\u2500 README.md # \u3053\u306E\u30D5\u30A1\u30A4\u30EB
|
|
1365
|
-
\u2514\u2500\u2500 snippets/ # snippet \u5B9A\u7FA9
|
|
1366
|
-
\u2514\u2500\u2500 hello-world.yaml
|
|
1367
|
-
\`\`\`
|
|
1368
|
-
|
|
1369
|
-
## \u30B3\u30DE\u30F3\u30C9
|
|
1370
|
-
|
|
1371
|
-
- \`mir list\` - \u5229\u7528\u53EF\u80FD\u306A snippet \u3092\u4E00\u89A7\u8868\u793A
|
|
1372
|
-
- \`mir info <name>\` - snippet \u306E\u8A73\u7D30\u60C5\u5831\u3092\u8868\u793A
|
|
1373
|
-
- \`mir install <name>\` - snippet \u3092\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
|
|
1374
|
-
- \`mir create <name>\` - \u65B0\u3057\u3044 snippet \u3092\u4F5C\u6210
|
|
1375
|
-
- \`mir publish <name>\` - snippet \u3092 registry \u306B\u767B\u9332
|
|
1376
|
-
|
|
1377
|
-
## \u6B21\u306E\u30B9\u30C6\u30C3\u30D7
|
|
1378
|
-
|
|
1379
|
-
1. \`mir create my-snippet\` \u3067\u65B0\u3057\u3044 snippet \u3092\u4F5C\u6210
|
|
1380
|
-
2. \u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30D5\u30A1\u30A4\u30EB\u3092\u7DE8\u96C6
|
|
1381
|
-
3. \`mir publish my-snippet\` \u3067 registry \u306B\u767B\u9332
|
|
1382
|
-
4. \u5225\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3067 \`mir install my-snippet\` \u3067\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB
|
|
1383
|
-
`;
|
|
1384
1354
|
async function initProject(cwd = process.cwd(), opts2 = {}) {
|
|
1385
1355
|
const mirDir = path5.join(cwd, ".mir");
|
|
1386
1356
|
const snippetsDir = path5.join(mirDir, SNIPPETS_SUBDIR);
|
|
1387
1357
|
const configPath = path5.join(cwd, CONFIG_FILE);
|
|
1388
|
-
const readmePath = path5.join(cwd, README_FILE);
|
|
1389
1358
|
if (fs9.existsSync(mirDir)) {
|
|
1390
1359
|
if (opts2.force) {
|
|
1391
1360
|
fs9.rmSync(mirDir, { recursive: true });
|
|
1392
1361
|
if (fs9.existsSync(configPath)) {
|
|
1393
1362
|
fs9.unlinkSync(configPath);
|
|
1394
1363
|
}
|
|
1395
|
-
if (fs9.existsSync(readmePath)) {
|
|
1396
|
-
fs9.unlinkSync(readmePath);
|
|
1397
|
-
}
|
|
1398
1364
|
warn("\u65E2\u5B58\u306E .mir/ \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u524A\u9664\u3057\u307E\u3059");
|
|
1399
1365
|
} else if (opts2.interactive) {
|
|
1400
1366
|
const shouldDelete = await confirm(
|
|
@@ -1408,9 +1374,6 @@ async function initProject(cwd = process.cwd(), opts2 = {}) {
|
|
|
1408
1374
|
if (fs9.existsSync(configPath)) {
|
|
1409
1375
|
fs9.unlinkSync(configPath);
|
|
1410
1376
|
}
|
|
1411
|
-
if (fs9.existsSync(readmePath)) {
|
|
1412
|
-
fs9.unlinkSync(readmePath);
|
|
1413
|
-
}
|
|
1414
1377
|
} else {
|
|
1415
1378
|
throw new MirError3(".mir \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306F\u65E2\u306B\u5B58\u5728\u3057\u307E\u3059");
|
|
1416
1379
|
}
|
|
@@ -1430,10 +1393,6 @@ async function initProject(cwd = process.cwd(), opts2 = {}) {
|
|
|
1430
1393
|
fs9.writeFileSync(configPath, SAMPLE_MIRCONFIG, "utf-8");
|
|
1431
1394
|
success("\u2713 mirconfig.yaml \u3092\u4F5C\u6210\u3057\u307E\u3057\u305F");
|
|
1432
1395
|
}
|
|
1433
|
-
if (!fs9.existsSync(readmePath)) {
|
|
1434
|
-
fs9.writeFileSync(readmePath, README, "utf-8");
|
|
1435
|
-
success("\u2713 README.md \u3092\u4F5C\u6210\u3057\u307E\u3057\u305F");
|
|
1436
|
-
}
|
|
1437
1396
|
info("");
|
|
1438
1397
|
step("\u521D\u671F\u5316\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F!");
|
|
1439
1398
|
info("\n\u6B21\u306E\u30B9\u30C6\u30C3\u30D7:");
|
|
@@ -1447,9 +1406,6 @@ async function initProject(cwd = process.cwd(), opts2 = {}) {
|
|
|
1447
1406
|
if (fs9.existsSync(configPath)) {
|
|
1448
1407
|
fs9.unlinkSync(configPath);
|
|
1449
1408
|
}
|
|
1450
|
-
if (fs9.existsSync(readmePath)) {
|
|
1451
|
-
fs9.unlinkSync(readmePath);
|
|
1452
|
-
}
|
|
1453
1409
|
if (error2 instanceof Error) {
|
|
1454
1410
|
throw error2;
|
|
1455
1411
|
}
|