sb-mig 4.1.0-beta.13 → 4.1.0-beta.15
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.
|
@@ -15,8 +15,14 @@ export const discover = async (props) => {
|
|
|
15
15
|
Logger.log(`Syncing ALL components with ${storyblokConfig.schemaFileExt} extension...`);
|
|
16
16
|
const allComponents = discoverAllComponents();
|
|
17
17
|
const content = [
|
|
18
|
-
...allComponents.local.map((component) => component.name
|
|
19
|
-
|
|
18
|
+
...allComponents.local.map((component) => component.name
|
|
19
|
+
.replaceAll(".sb.js", "")
|
|
20
|
+
.replaceAll(".sb.cjs", "")
|
|
21
|
+
.replaceAll(".sb.mjs", "")),
|
|
22
|
+
...allComponents.external.map((component) => component.name
|
|
23
|
+
.replaceAll(".sb.js", "")
|
|
24
|
+
.replaceAll(".sb.cjs", "")
|
|
25
|
+
.replaceAll(".sb.mjs", "")),
|
|
20
26
|
];
|
|
21
27
|
Logger.success("#### Discovered components ####");
|
|
22
28
|
console.log(content);
|
package/dist/utils/files.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const isDirectoryExists: (path: string) => boolean;
|
|
2
2
|
export declare const createDir: (dirPath: string) => Promise<void>;
|
|
3
3
|
export declare const createJsonFile: (content: string, pathWithFilename: string) => Promise<void>;
|
|
4
|
-
export declare const createJSFile: (content: string, pathWithFilename: string) => Promise<void>;
|
|
4
|
+
export declare const createJSFile: (content: string, pathWithFilename: string, timestamp?: boolean) => Promise<void>;
|
|
5
5
|
export declare const copyFolder: (src: string, dest: string) => Promise<unknown>;
|
|
6
6
|
export declare const copyFile: (src: string, dest: string) => Promise<void>;
|
|
7
7
|
interface CreateAndSaveToFile {
|
|
@@ -13,8 +13,9 @@ interface CreateAndSaveComponentListToFile {
|
|
|
13
13
|
file?: string;
|
|
14
14
|
folder?: string;
|
|
15
15
|
res: any;
|
|
16
|
+
timestamp?: boolean;
|
|
16
17
|
}
|
|
17
18
|
export declare const createAndSaveToFile: ({ prefix, folder, res, }: CreateAndSaveToFile) => Promise<void>;
|
|
18
|
-
export declare const createAndSaveComponentListToFile: ({ file, folder, res, }: CreateAndSaveComponentListToFile) => Promise<void>;
|
|
19
|
+
export declare const createAndSaveComponentListToFile: ({ file, folder, res, timestamp, }: CreateAndSaveComponentListToFile) => Promise<void>;
|
|
19
20
|
export declare const readFile: (path: string) => Promise<string | undefined>;
|
|
20
21
|
export {};
|
package/dist/utils/files.js
CHANGED
|
@@ -13,12 +13,12 @@ export const createDir = async (dirPath) => {
|
|
|
13
13
|
export const createJsonFile = async (content, pathWithFilename) => {
|
|
14
14
|
await fs.promises.writeFile(pathWithFilename, content, { flag: "w" });
|
|
15
15
|
};
|
|
16
|
-
export const createJSFile = async (content, pathWithFilename) => {
|
|
16
|
+
export const createJSFile = async (content, pathWithFilename, timestamp = false) => {
|
|
17
17
|
const datestamp = new Date();
|
|
18
18
|
const finalContent = `/*
|
|
19
19
|
|
|
20
20
|
Auto-generated file by sb-mig discovery
|
|
21
|
-
on ${generateDatestamp(datestamp)}
|
|
21
|
+
${timestamp ? `Generated on: ${generateDatestamp(datestamp)}` : ""}
|
|
22
22
|
|
|
23
23
|
Do not edit manually (use yarn components:discover instead)
|
|
24
24
|
|
|
@@ -68,7 +68,7 @@ export const createAndSaveToFile = async ({ prefix, folder, res, }) => {
|
|
|
68
68
|
await createJsonFile(JSON.stringify(res, undefined, 2), `${storyblokConfig.sbmigWorkingDirectory}/${folder}/${filename}.json`);
|
|
69
69
|
Logger.success(`All groups written to a file: ${filename}`);
|
|
70
70
|
};
|
|
71
|
-
export const createAndSaveComponentListToFile = async ({ file, folder, res, }) => {
|
|
71
|
+
export const createAndSaveComponentListToFile = async ({ file, folder, res, timestamp = false, }) => {
|
|
72
72
|
const datestamp = new Date();
|
|
73
73
|
const filename = file ?? `all-components__${generateDatestamp(datestamp)}`;
|
|
74
74
|
await createDir(folder
|
|
@@ -76,7 +76,7 @@ export const createAndSaveComponentListToFile = async ({ file, folder, res, }) =
|
|
|
76
76
|
: `${storyblokConfig.sbmigWorkingDirectory}/`);
|
|
77
77
|
await createJSFile(JSON.stringify(res, null, 2), folder
|
|
78
78
|
? `${storyblokConfig.sbmigWorkingDirectory}/${folder}/${filename}.ts`
|
|
79
|
-
: `${storyblokConfig.sbmigWorkingDirectory}/${filename}.ts
|
|
79
|
+
: `${storyblokConfig.sbmigWorkingDirectory}/${filename}.ts`, timestamp);
|
|
80
80
|
Logger.success(`All components written to a file: ${filename}`);
|
|
81
81
|
};
|
|
82
82
|
export const readFile = async (path) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sb-mig",
|
|
3
|
-
"version": "4.1.0-beta.
|
|
3
|
+
"version": "4.1.0-beta.15",
|
|
4
4
|
"description": "CLI to rule the world. (and handle stuff related to Storyblok CMS)",
|
|
5
5
|
"author": "Marcin Krawczyk <marckraw@icloud.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"lint-staged": "^13.0.3",
|
|
83
83
|
"prettier": "^2.7.1",
|
|
84
84
|
"semantic-release": "^19.0.5",
|
|
85
|
+
"tsc-files": "^1.1.3",
|
|
85
86
|
"typescript": "^4.8.4"
|
|
86
87
|
},
|
|
87
88
|
"config": {
|