shipd 0.1.1 → 0.1.3
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/index.js +25 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -89,20 +89,25 @@ import { existsSync as existsSync2 } from "fs";
|
|
|
89
89
|
import { join, resolve as resolve2, dirname } from "path";
|
|
90
90
|
import { fileURLToPath } from "url";
|
|
91
91
|
var __filename = fileURLToPath(import.meta.url);
|
|
92
|
-
var
|
|
92
|
+
var __dirname = dirname(__filename);
|
|
93
93
|
function getTemplatePath() {
|
|
94
94
|
const triedPaths = [];
|
|
95
|
-
const
|
|
95
|
+
const bundledPath = resolve2(__dirname, "../template");
|
|
96
|
+
triedPaths.push(bundledPath);
|
|
97
|
+
if (existsSync2(bundledPath)) {
|
|
98
|
+
return bundledPath;
|
|
99
|
+
}
|
|
100
|
+
const distPath = resolve2(__dirname, "../../template");
|
|
96
101
|
triedPaths.push(distPath);
|
|
97
102
|
if (existsSync2(distPath)) {
|
|
98
103
|
return distPath;
|
|
99
104
|
}
|
|
100
|
-
const srcPath = resolve2(
|
|
105
|
+
const srcPath = resolve2(__dirname, "../../../template");
|
|
101
106
|
triedPaths.push(srcPath);
|
|
102
107
|
if (existsSync2(srcPath)) {
|
|
103
108
|
return srcPath;
|
|
104
109
|
}
|
|
105
|
-
let currentDir =
|
|
110
|
+
let currentDir = __dirname;
|
|
106
111
|
for (let i = 0; i < 10; i++) {
|
|
107
112
|
const pkgJsonPath = join(currentDir, "package.json");
|
|
108
113
|
if (existsSync2(pkgJsonPath)) {
|
|
@@ -111,11 +116,6 @@ function getTemplatePath() {
|
|
|
111
116
|
if (existsSync2(templatePath)) {
|
|
112
117
|
return templatePath;
|
|
113
118
|
}
|
|
114
|
-
const parentTemplatePath = join(resolve2(currentDir, ".."), "template");
|
|
115
|
-
triedPaths.push(parentTemplatePath);
|
|
116
|
-
if (existsSync2(parentTemplatePath)) {
|
|
117
|
-
return parentTemplatePath;
|
|
118
|
-
}
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
121
|
const parentDir = resolve2(currentDir, "..");
|
|
@@ -124,7 +124,7 @@ function getTemplatePath() {
|
|
|
124
124
|
}
|
|
125
125
|
currentDir = parentDir;
|
|
126
126
|
}
|
|
127
|
-
const absolutePath = resolve2(
|
|
127
|
+
const absolutePath = resolve2(__dirname, "../../../../packages/template");
|
|
128
128
|
triedPaths.push(absolutePath);
|
|
129
129
|
if (existsSync2(absolutePath)) {
|
|
130
130
|
return absolutePath;
|
|
@@ -1026,9 +1026,12 @@ function createLogoutCommand() {
|
|
|
1026
1026
|
// src/commands/append.ts
|
|
1027
1027
|
import inquirer2 from "inquirer";
|
|
1028
1028
|
import { existsSync as existsSync5 } from "fs";
|
|
1029
|
-
import { join as join7, resolve as resolve4 } from "path";
|
|
1029
|
+
import { join as join7, resolve as resolve4, dirname as dirname2 } from "path";
|
|
1030
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
1030
1031
|
import ora3 from "ora";
|
|
1031
1032
|
import fs4 from "fs-extra";
|
|
1033
|
+
var __filename2 = fileURLToPath2(import.meta.url);
|
|
1034
|
+
var __dirname2 = dirname2(__filename2);
|
|
1032
1035
|
async function detectProject(cwd) {
|
|
1033
1036
|
const pkgPath = join7(cwd, "package.json");
|
|
1034
1037
|
if (!existsSync5(pkgPath)) {
|
|
@@ -1063,9 +1066,18 @@ async function detectProject(cwd) {
|
|
|
1063
1066
|
};
|
|
1064
1067
|
}
|
|
1065
1068
|
async function appendDocsFeature(targetPath, dryRun = false) {
|
|
1066
|
-
|
|
1069
|
+
let docsSourcePath = resolve4(__dirname2, "../docs-template");
|
|
1070
|
+
if (!existsSync5(docsSourcePath)) {
|
|
1071
|
+
docsSourcePath = resolve4(__dirname2, "../../docs-template");
|
|
1072
|
+
}
|
|
1073
|
+
if (!existsSync5(docsSourcePath)) {
|
|
1074
|
+
docsSourcePath = resolve4(__dirname2, "../../../docs-template");
|
|
1075
|
+
}
|
|
1067
1076
|
if (!existsSync5(docsSourcePath)) {
|
|
1068
|
-
throw new Error(
|
|
1077
|
+
throw new Error(`Docs template not found. Tried paths:
|
|
1078
|
+
- ${resolve4(__dirname2, "../docs-template")}
|
|
1079
|
+
- ${resolve4(__dirname2, "../../docs-template")}
|
|
1080
|
+
- ${resolve4(__dirname2, "../../../docs-template")}`);
|
|
1069
1081
|
}
|
|
1070
1082
|
const spinner = ora3("Copying docs feature (pages + components)...").start();
|
|
1071
1083
|
try {
|