sb-mig 3.1.8 → 3.1.9

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.
@@ -1 +1 @@
1
- export declare const debug: (props: any) => void;
1
+ export declare const debug: () => Promise<void>;
@@ -1,5 +1,4 @@
1
1
  import config from "../config/config.js";
2
- export const debug = (props) => {
3
- const { input, flags, unnormalizedFlags, pkg, help, showHelp, showVersion, } = props;
2
+ export const debug = async () => {
4
3
  console.log("storyblok.config.js: ", config, "\n");
5
4
  };
@@ -1,7 +1,28 @@
1
1
  var _a, _b;
2
2
  import path from "path";
3
3
  import dotenv from "dotenv";
4
- import { getFileContent } from "../utils/main.js";
4
+ import Logger from "../utils/logger.js";
5
+ const getStoryblokConfigContent = (data) => {
6
+ return import(`${data.filePath}${data.ext}`)
7
+ .then((res) => {
8
+ Logger.success("Found storyblok.config.js!");
9
+ return res.default;
10
+ })
11
+ .catch(() => {
12
+ Logger.warning("Cannot find requested file with .js extension.");
13
+ Logger.log("Trying .mjs extension\n");
14
+ import(`${data.filePath}.mjs`)
15
+ .then((res) => {
16
+ Logger.success("Found storyblok.config.mjs!");
17
+ return res.default;
18
+ })
19
+ .catch(() => {
20
+ Logger.error("Cannot find requested file with .mjs extension.");
21
+ Logger.log("Create storyblok.config.js or storyblok.config.mjs in your project. If u want to have custom configuration");
22
+ Logger.log("Using default configruration.");
23
+ });
24
+ });
25
+ };
5
26
  dotenv.config();
6
27
  const defaultConfig = {
7
28
  storyblokComponentsLocalDirectory: "src/@storyblok-components",
@@ -17,8 +38,10 @@ const defaultConfig = {
17
38
  process.env["NEXT_PUBLIC_STORYBLOK_ACCESS_TOKEN"] ||
18
39
  "",
19
40
  };
20
- const customConfig = await getFileContent({
21
- file: path.resolve(process.cwd(), "storyblok.config") + ".js",
41
+ const filePath = path.resolve(process.cwd(), "storyblok.config");
42
+ const customConfig = await getStoryblokConfigContent({
43
+ filePath,
44
+ ext: ".js",
22
45
  });
23
46
  export default {
24
47
  ...defaultConfig,
package/dist/index.js CHANGED
@@ -35,8 +35,8 @@ app.debug = () => ({
35
35
  importMeta: import.meta,
36
36
  booleanDefault: undefined,
37
37
  }),
38
- action: (cli) => {
39
- debug(cli);
38
+ action: () => {
39
+ debug();
40
40
  },
41
41
  });
42
42
  const getSubcommand = (cliObject, level) => pipe(prop("input"), prop(level), (name) => prop(name)(cliObject))(prop("cli")(cliObject()));
@@ -15,7 +15,7 @@ export const getFileContent = (data) => {
15
15
  return res.default;
16
16
  })
17
17
  .catch(() => {
18
- console.log("Cannot find requested file. (in terms of storyblok.config.js, using default values. ");
18
+ console.log("Cannot find requested file.");
19
19
  });
20
20
  };
21
21
  export const getFileContentWithRequire = (data) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sb-mig",
3
- "version": "3.1.8",
3
+ "version": "3.1.9",
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",
@@ -35,6 +35,7 @@
35
35
  ],
36
36
  "scripts": {
37
37
  "build": "rm -rf dist && tsc",
38
+ "build:dev": "rm -rf dist && tsc && chmod +x ./dist/index.js",
38
39
  "test": "echo \"Error: no test specified\" && exit 1",
39
40
  "start": "yarn build && ./dist/index.js",
40
41
  "debug": "yarn build && ./dist/index.js sync components accordion accordion-item",
@@ -57,5 +58,5 @@
57
58
  "conventional-changelog-cli": "^2.0.31",
58
59
  "typescript": "^4.5.5"
59
60
  },
60
- "gitHead": "0965a4b3896f2e94c052d3990fa33f1166747811"
61
+ "gitHead": "d411b03fe6bdd2a7b147ab746316e1cb279ec67b"
61
62
  }