create-akan-workspace 2.1.0-rc.8 → 2.1.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 +10 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2163,14 +2163,19 @@ var getPackageVersion = async () => {
|
|
|
2163
2163
|
throw new Error("create-akan-workspace package version is missing");
|
|
2164
2164
|
return packageJson.version;
|
|
2165
2165
|
};
|
|
2166
|
+
var normalizeRegistryUrl = (registryUrl) => registryUrl.replace(/\/+$/, "");
|
|
2166
2167
|
var run = async ({
|
|
2167
2168
|
argv = process.argv,
|
|
2168
2169
|
spawnCommand = spawn
|
|
2169
2170
|
} = {}) => {
|
|
2170
2171
|
const program2 = new Command().name("create-akan-workspace");
|
|
2171
|
-
program2.argument("[org]", "organization name").option("-a, --app <string>", "application name").option("-d, --dir <string>", "directory").option("-l, --libs <boolean>", "install shared and util libraries", false).option("-i, --init <boolean>", "install dependencies and initialize git", true).action(async (org, options) => {
|
|
2172
|
+
program2.argument("[org]", "organization name").option("-a, --app <string>", "application name").option("-d, --dir <string>", "directory").option("-l, --libs <boolean>", "install shared and util libraries", false).option("-i, --init <boolean>", "install dependencies and initialize git", true).option("-r, --registry <string>", "npm registry URL for installing Akan packages").action(async (org, options) => {
|
|
2172
2173
|
const packageVersion = await getPackageVersion();
|
|
2173
|
-
|
|
2174
|
+
const registry = options.registry ?? process.env.AKAN_NPM_REGISTRY;
|
|
2175
|
+
const registryUrl = registry ? normalizeRegistryUrl(registry) : undefined;
|
|
2176
|
+
const registryArgs = registryUrl ? ["--registry", registryUrl] : [];
|
|
2177
|
+
const spawnOptions = registryUrl ? { env: { ...process.env, AKAN_NPM_REGISTRY: registryUrl, NPM_CONFIG_REGISTRY: registryUrl } } : {};
|
|
2178
|
+
await spawnProcess(spawnCommand, "bun", ["install", "-g", `@akanjs/cli@${packageVersion}`, ...registryArgs], spawnOptions);
|
|
2174
2179
|
const libs = options.libs === true || options.libs === "true";
|
|
2175
2180
|
const init = options.init === undefined || options.init === true || options.init === "true";
|
|
2176
2181
|
await spawnProcess(spawnCommand, "akan", [
|
|
@@ -2179,8 +2184,9 @@ var run = async ({
|
|
|
2179
2184
|
...options.app ? [`--app=${options.app}`] : [],
|
|
2180
2185
|
...options.dir ? [`--dir=${options.dir}`] : [],
|
|
2181
2186
|
`--libs=${libs}`,
|
|
2182
|
-
`--init=${init}
|
|
2183
|
-
|
|
2187
|
+
`--init=${init}`,
|
|
2188
|
+
...registryUrl ? [`--registry=${registryUrl}`] : []
|
|
2189
|
+
], spawnOptions);
|
|
2184
2190
|
});
|
|
2185
2191
|
await program2.parseAsync(argv);
|
|
2186
2192
|
};
|