create-akan-workspace 3.1.2-rc.3 → 3.2.0-rc.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/index.js +13 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2074,6 +2074,10 @@ var readGlobalBinDir = () => {
|
|
|
2074
2074
|
};
|
|
2075
2075
|
var getPathKey = (env) => Object.keys(env).find((key) => key.toUpperCase() === "PATH") ?? "PATH";
|
|
2076
2076
|
var isOnPath = (env, dir) => (env[getPathKey(env)] ?? "").split(delimiter).includes(dir);
|
|
2077
|
+
var isBunOnLastingPath = (env) => {
|
|
2078
|
+
const PATH = (env[getPathKey(env)] ?? "").split(delimiter).filter((dir) => dir && !dir.split(/[\\/]/).some((part) => part.toLowerCase() === "node_modules")).join(delimiter);
|
|
2079
|
+
return Bun.which("bun", { PATH }) !== null;
|
|
2080
|
+
};
|
|
2077
2081
|
var prependToPath = (env, dir) => {
|
|
2078
2082
|
if (!dir || isOnPath(env, dir))
|
|
2079
2083
|
return env;
|
|
@@ -2113,7 +2117,8 @@ var run = async ({
|
|
|
2113
2117
|
argv = process.argv,
|
|
2114
2118
|
spawnCommand = spawn,
|
|
2115
2119
|
bunVersion = Bun.version,
|
|
2116
|
-
getGlobalBinDir = readGlobalBinDir
|
|
2120
|
+
getGlobalBinDir = readGlobalBinDir,
|
|
2121
|
+
isBunOnPath = () => isBunOnLastingPath(process.env)
|
|
2117
2122
|
} = {}) => {
|
|
2118
2123
|
if (!Bun.semver.satisfies(bunVersion.replace(/-.*$/, ""), engines.bun)) {
|
|
2119
2124
|
console.error(`create-akan-workspace requires Bun ${engines.bun}, but this is Bun ${bunVersion}. Run \`bun upgrade\`, then try again.`);
|
|
@@ -2133,6 +2138,7 @@ var run = async ({
|
|
|
2133
2138
|
const init = options.init === undefined || options.init === true || options.init === "true";
|
|
2134
2139
|
const sample = options.sample === undefined || options.sample === true || options.sample === "true";
|
|
2135
2140
|
const globalBinDir = getGlobalBinDir();
|
|
2141
|
+
const bunOnPath = isBunOnPath();
|
|
2136
2142
|
await spawnProcess(spawnCommand, "akan", [
|
|
2137
2143
|
"create-workspace",
|
|
2138
2144
|
...org ? [org] : [],
|
|
@@ -2142,9 +2148,13 @@ var run = async ({
|
|
|
2142
2148
|
`--init=${init}`,
|
|
2143
2149
|
`--sample=${sample}`,
|
|
2144
2150
|
...registryUrl ? [`--registry=${registryUrl}`] : [],
|
|
2145
|
-
...options.owner ? [`--owner=${options.owner}`] : []
|
|
2151
|
+
...options.owner ? [`--owner=${options.owner}`] : [],
|
|
2152
|
+
...bunOnPath ? [] : [`--bun-dependency=${bunVersion}`]
|
|
2146
2153
|
], { env: prependToPath(env, globalBinDir) });
|
|
2147
|
-
if (
|
|
2154
|
+
if (!bunOnPath)
|
|
2155
|
+
console.warn(`
|
|
2156
|
+
Bun ${bunVersion} is not on your PATH, so \`akan\` cannot run from the shell. The workspace lists bun in its dependencies instead: from the workspace, run \`npm run build\`, \`npm start\` or \`npx akan <command>\`.`);
|
|
2157
|
+
else if (globalBinDir && !isOnPath(process.env, globalBinDir))
|
|
2148
2158
|
console.warn(`
|
|
2149
2159
|
The \`akan\` command was installed to ${globalBinDir}, which is not on your PATH. Add that directory to PATH to run \`akan\` from the workspace.`);
|
|
2150
2160
|
});
|