blokctl 0.2.4 → 0.2.7
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.
|
@@ -16,7 +16,7 @@ const exec = util.promisify(child_process.exec);
|
|
|
16
16
|
const HOME_DIR = `${os.homedir()}/.blok`;
|
|
17
17
|
const GITHUB_REPO_LOCAL = `${HOME_DIR}/blok`;
|
|
18
18
|
const GITHUB_REPO_REMOTE = "https://github.com/well-prado/blok.git";
|
|
19
|
-
const GITHUB_REPO_RELEASE_TAG = "v0.
|
|
19
|
+
const GITHUB_REPO_RELEASE_TAG = "v0.2.1";
|
|
20
20
|
fsExtra.ensureDirSync(HOME_DIR);
|
|
21
21
|
const options = {
|
|
22
22
|
baseDir: HOME_DIR,
|
|
@@ -312,6 +312,7 @@ export async function createProject(opts, version, currentPath = false, localRep
|
|
|
312
312
|
const triggerDestDir = `${dirPath}/src/triggers/${triggerKind}`;
|
|
313
313
|
fixRunnerImportPaths(triggerDestDir, triggerKind);
|
|
314
314
|
}
|
|
315
|
+
replaceBlokImportsInDirectory(`${dirPath}/src`);
|
|
315
316
|
const sharedNodesContent = generateSharedNodesFile(selectedTriggers, repoSource);
|
|
316
317
|
fsExtra.writeFileSync(`${dirPath}/src/Nodes.ts`, sharedNodesContent);
|
|
317
318
|
const sharedWorkflowsContent = generateSharedWorkflowsFile(selectedTriggers);
|
|
@@ -382,13 +383,20 @@ export async function createProject(opts, version, currentPath = false, localRep
|
|
|
382
383
|
const deps = packageJsonContent[depGroup];
|
|
383
384
|
if (!deps)
|
|
384
385
|
continue;
|
|
386
|
+
for (const pkg of Object.keys(deps)) {
|
|
387
|
+
if (pkg.startsWith("@blok/")) {
|
|
388
|
+
const newPkg = pkg.replace("@blok/", "@blokjs/");
|
|
389
|
+
deps[newPkg] = "^0.2.0";
|
|
390
|
+
delete deps[pkg];
|
|
391
|
+
}
|
|
392
|
+
}
|
|
385
393
|
for (const [pkg, ver] of Object.entries(deps)) {
|
|
386
394
|
if (typeof ver === "string" && ver.startsWith("workspace:")) {
|
|
387
395
|
if (localRepoPath && workspacePackageMap[pkg]) {
|
|
388
396
|
deps[pkg] = `file:${path.resolve(repoSource, workspacePackageMap[pkg])}`;
|
|
389
397
|
}
|
|
390
398
|
else {
|
|
391
|
-
deps[pkg] = "^0.
|
|
399
|
+
deps[pkg] = "^0.2.0";
|
|
392
400
|
}
|
|
393
401
|
}
|
|
394
402
|
}
|
|
@@ -782,6 +790,24 @@ if (process.env.DISABLE_TRIGGER_RUN !== "true") {
|
|
|
782
790
|
console.log("${triggerKind} trigger not yet implemented");
|
|
783
791
|
`;
|
|
784
792
|
}
|
|
793
|
+
function replaceBlokImportsInDirectory(dirPath) {
|
|
794
|
+
const files = fsExtra.readdirSync(dirPath, { withFileTypes: true });
|
|
795
|
+
for (const file of files) {
|
|
796
|
+
const fullPath = path.join(dirPath, file.name);
|
|
797
|
+
if (file.isDirectory()) {
|
|
798
|
+
if (file.name !== "node_modules" && file.name !== ".blok") {
|
|
799
|
+
replaceBlokImportsInDirectory(fullPath);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
else if (file.name.endsWith(".ts") || file.name.endsWith(".tsx")) {
|
|
803
|
+
let content = fsExtra.readFileSync(fullPath, "utf8");
|
|
804
|
+
if (content.includes("@blok/")) {
|
|
805
|
+
content = content.replace(/@blok\//g, "@blokjs/");
|
|
806
|
+
fsExtra.writeFileSync(fullPath, content);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
785
811
|
function fixRunnerImportPaths(triggerDestDir, triggerKind) {
|
|
786
812
|
const filesToFix = [];
|
|
787
813
|
if (triggerKind === "http") {
|