blokctl 0.2.5 → 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);
|
|
@@ -789,6 +790,24 @@ if (process.env.DISABLE_TRIGGER_RUN !== "true") {
|
|
|
789
790
|
console.log("${triggerKind} trigger not yet implemented");
|
|
790
791
|
`;
|
|
791
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
|
+
}
|
|
792
811
|
function fixRunnerImportPaths(triggerDestDir, triggerKind) {
|
|
793
812
|
const filesToFix = [];
|
|
794
813
|
if (triggerKind === "http") {
|