sb-mig 2.9.0 → 2.9.13

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.
@@ -9,28 +9,28 @@ try {
9
9
  }
10
10
  catch (error) {
11
11
  // default config will be used
12
- if (error.code !== "MODULE_NOT_FOUND")
12
+ if (error.code !== 'MODULE_NOT_FOUND')
13
13
  throw error;
14
14
  }
15
15
  const defaultConfig = {
16
- componentsMatchFile: "src/components/components.js",
17
- storyblokComponentsListfile: "src/components/storyblok-components.componentList.js",
18
- storyblokComponentsLocalDirectory: "src/@storyblok-components",
19
- componentsStylesMatchFile: "src/@storyblok-components/_storyblok-components.scss",
20
- boilerplateUrl: "git@github.com:storyblok-components/gatsby-storyblok-boilerplate.git",
21
- sbmigWorkingDirectory: "sbmig",
22
- componentDirectory: "storyblok",
23
- datasourcesDirectory: "storyblok",
24
- componentsDirectories: ["src", "storyblok"],
25
- schemaFileExt: "sb.js",
26
- datasourceExt: "sb.datasource.js",
27
- rolesExt: "sb.roles.js",
28
- storyblokApiUrl: "https://api.storyblok.com/v1",
16
+ componentsMatchFile: 'src/components/components.js',
17
+ storyblokComponentsListfile: 'src/components/storyblok-components.componentList.js',
18
+ storyblokComponentsLocalDirectory: 'src/@storyblok-components',
19
+ componentsStylesMatchFile: 'src/@storyblok-components/_storyblok-components.scss',
20
+ boilerplateUrl: 'git@github.com:storyblok-components/gatsby-storyblok-boilerplate.git',
21
+ sbmigWorkingDirectory: 'sbmig',
22
+ componentDirectory: 'storyblok',
23
+ datasourcesDirectory: 'storyblok',
24
+ componentsDirectories: ['src', 'storyblok'],
25
+ schemaFileExt: 'sb.js',
26
+ datasourceExt: 'sb.datasource.js',
27
+ rolesExt: 'sb.roles.js',
28
+ storyblokApiUrl: 'https://api.storyblok.com/v1',
29
29
  oauthToken: process.env.STORYBLOK_OAUTH_TOKEN,
30
30
  spaceId: process.env.STORYBLOK_SPACE_ID,
31
- accessToken: process.env.GATSBY_STORYBLOK_ACCESS_TOKEN || process.env.NEXT_STORYBLOK_ACCESS_TOKEN
31
+ accessToken: process.env.GATSBY_STORYBLOK_ACCESS_TOKEN || process.env.NEXT_STORYBLOK_ACCESS_TOKEN,
32
32
  };
33
33
  exports.default = {
34
34
  ...defaultConfig,
35
- ...customConfig
35
+ ...customConfig,
36
36
  };
package/lib/core.js CHANGED
@@ -26,7 +26,7 @@ class default_1 extends command_1.default {
26
26
  createDir: files_1.createDir,
27
27
  createJsonFile: files_1.createJsonFile,
28
28
  copyFolder: files_1.copyFolder,
29
- copyFile: files_1.copyFile
29
+ copyFile: files_1.copyFile,
30
30
  };
31
31
  }
32
32
  api() {
@@ -56,19 +56,19 @@ class default_1 extends command_1.default {
56
56
  syncComponents: migrate_1.syncComponents,
57
57
  syncAllComponents: migrate_1.syncAllComponents,
58
58
  updateComponent: mutateComponents_1.updateComponent,
59
- createComponent: mutateComponents_1.createComponent
59
+ createComponent: mutateComponents_1.createComponent,
60
60
  },
61
61
  presets: {
62
62
  getComponentPresets: componentPresets_1.getComponentPresets,
63
63
  getPreset: presets_1.getPreset,
64
64
  getAllPresets: presets_1.getAllPresets,
65
65
  createPreset: presets_1.createPreset,
66
- updatePreset: presets_1.updatePreset
66
+ updatePreset: presets_1.updatePreset,
67
67
  },
68
68
  spaces: {
69
69
  createSpace: spaces_1.createSpace,
70
- getSpace: spaces_1.getSpace
71
- }
70
+ getSpace: spaces_1.getSpace,
71
+ },
72
72
  };
73
73
  }
74
74
  }
package/lib/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.run = void 0;
3
4
  var command_1 = require("@oclif/command");
4
5
  Object.defineProperty(exports, "run", { enumerable: true, get: function () { return command_1.run; } });
@@ -1,4 +1,4 @@
1
1
  export declare const findComponents: (componentDirectory: string) => any[];
2
- export declare const findComponentsWithExt: (ext: string) => any[];
2
+ export declare const findComponentsWithExt: (ext: string | boolean) => any[];
3
3
  export declare const findComponentsByPackageName: (ext: string | boolean, specifiedComponents: string[], local?: boolean | undefined) => any[];
4
4
  export declare const findDatasources: () => any[];
@@ -6,89 +6,91 @@ exports.findDatasources = exports.findComponentsByPackageName = exports.findComp
6
6
  const glob = require("glob");
7
7
  const path = require("path");
8
8
  const config_1 = require("../config/config");
9
- exports.findComponents = (componentDirectory) => {
9
+ const findComponents = (componentDirectory) => {
10
10
  const directory = path.resolve(process.cwd(), componentDirectory);
11
11
  return glob
12
- .sync(path.join(directory, `**`, `!(_*|*.datasource)*.js`))
13
- .map((file) => require(path.resolve(directory, file)));
12
+ .sync(path.join(directory, '**', '!(_*|*.datasource)*.js'))
13
+ .map(file => require(path.resolve(directory, file)));
14
14
  };
15
- exports.findComponentsWithExt = (ext) => {
16
- const rootDirectory = "./";
15
+ exports.findComponents = findComponents;
16
+ const findComponentsWithExt = (ext) => {
17
+ const rootDirectory = './';
17
18
  const directory = path.resolve(process.cwd(), rootDirectory);
18
19
  const files = glob
19
- .sync(path.join(`${directory}/{${config_1.default.componentsDirectories.join(",")}}`, `**`, `[^_]*.${ext}`), {
20
+ .sync(path.join(`${directory}/{${config_1.default.componentsDirectories.join(',')}}`, '**', `[^_]*.${ext}`), {
20
21
  follow: true,
21
22
  })
22
- .map((file) => require(path.resolve(directory, file)));
23
- const fileNames = files.map((file) => file.name);
23
+ .map(file => require(path.resolve(directory, file)));
24
+ const fileNames = files.map(file => file.name);
24
25
  return files;
25
26
  };
26
- exports.findComponentsByPackageName = (ext, specifiedComponents, local) => {
27
- const rootDirectory = "./";
27
+ exports.findComponentsWithExt = findComponentsWithExt;
28
+ const findComponentsByPackageName = (ext, specifiedComponents, local) => {
29
+ const rootDirectory = './';
28
30
  const directory = path.resolve(process.cwd(), rootDirectory);
29
31
  // @ts-ignore
30
32
  if (local === true) {
31
- const onlyLocalComponentsDirectories = config_1.default.componentsDirectories.filter((dir) => !dir.includes("node_modules"));
32
- const onlyLocalPackages = glob.sync(path.join(`${directory}/{${onlyLocalComponentsDirectories.join(",")}}`, `**`, `package.json`), {
33
+ const onlyLocalComponentsDirectories = config_1.default.componentsDirectories.filter(dir => !dir.includes('node_modules'));
34
+ const onlyLocalPackages = glob.sync(path.join(`${directory}/{${onlyLocalComponentsDirectories.join(',')}}`, '**', 'package.json'), {
33
35
  follow: true,
34
36
  });
35
37
  return onlyLocalPackages
36
- .filter((file) => {
38
+ .filter(file => {
37
39
  return specifiedComponents.includes(require(path.resolve(directory, file)).name);
38
40
  })
39
- .map((file) => {
40
- const fileFolderPath = file.split("/").slice(0, -1).join("/");
41
+ .map(file => {
42
+ const fileFolderPath = file.split('/').slice(0, -1).join('/');
41
43
  return glob
42
- .sync(path.join(`${fileFolderPath}`, `**`, `[^_]*.${ext}`), {
44
+ .sync(path.join(`${fileFolderPath}`, '**', `[^_]*.${ext}`), {
43
45
  follow: true,
44
46
  })
45
- .map((file) => require(path.resolve(directory, file)).name);
47
+ .map(file => require(path.resolve(directory, file)).name);
46
48
  })
47
49
  .flat();
48
50
  }
49
- else if (local === false) {
50
- const onlyNodeModulesPackagesComponentsDirectories = config_1.default.componentsDirectories.filter((dir) => dir.includes("node_modules"));
51
- const onlyNodeModulesPackages = glob.sync(path.join(`${directory}/{${onlyNodeModulesPackagesComponentsDirectories.join(",")}}`, `**`, `package.json`), {
51
+ if (local === false) {
52
+ const onlyNodeModulesPackagesComponentsDirectories = config_1.default.componentsDirectories.filter(dir => dir.includes('node_modules'));
53
+ const onlyNodeModulesPackages = glob.sync(path.join(`${directory}/{${onlyNodeModulesPackagesComponentsDirectories.join(',')}}`, '**', 'package.json'), {
52
54
  follow: true,
53
55
  });
54
56
  return onlyNodeModulesPackages
55
- .filter((file) => {
57
+ .filter(file => {
56
58
  return specifiedComponents.includes(require(path.resolve(directory, file)).name);
57
59
  })
58
- .map((file) => {
59
- const fileFolderPath = file.split("/").slice(0, -1).join("/");
60
+ .map(file => {
61
+ const fileFolderPath = file.split('/').slice(0, -1).join('/');
60
62
  return glob
61
- .sync(path.join(`${fileFolderPath}`, `**`, `[^_]*.${ext}`), {
63
+ .sync(path.join(`${fileFolderPath}`, '**', `[^_]*.${ext}`), {
62
64
  follow: true,
63
65
  })
64
- .map((file) => require(path.resolve(directory, file)).name);
66
+ .map(file => require(path.resolve(directory, file)).name);
65
67
  })
66
68
  .flat();
67
69
  }
68
- else {
70
+ return glob
71
+ .sync(path.join(`${directory}/{${config_1.default.componentsDirectories.join(',')}}`, '**', 'package.json'), {
72
+ follow: true,
73
+ })
74
+ .filter(file => {
75
+ return specifiedComponents.includes(require(path.resolve(directory, file)).name);
76
+ })
77
+ .map(file => {
78
+ const fileFolderPath = file.split('/').slice(0, -1).join('/');
69
79
  return glob
70
- .sync(path.join(`${directory}/{${config_1.default.componentsDirectories.join(",")}}`, `**`, `package.json`), {
80
+ .sync(path.join(`${fileFolderPath}`, '**', `[^_]*.${ext}`), {
71
81
  follow: true,
72
82
  })
73
- .filter((file) => {
74
- return specifiedComponents.includes(require(path.resolve(directory, file)).name);
75
- })
76
- .map((file) => {
77
- const fileFolderPath = file.split("/").slice(0, -1).join("/");
78
- return glob
79
- .sync(path.join(`${fileFolderPath}`, `**`, `[^_]*.${ext}`), {
80
- follow: true,
81
- })
82
- .map((file) => require(path.resolve(directory, file)).name);
83
- })
84
- .flat();
85
- }
83
+ .map(file => require(path.resolve(directory, file)).name);
84
+ })
85
+ .flat();
86
86
  };
87
- exports.findDatasources = () => {
88
- const rootDirectory = "./";
87
+ exports.findComponentsByPackageName = findComponentsByPackageName;
88
+ const findDatasources = () => {
89
+ const rootDirectory = './';
89
90
  const directory = path.resolve(process.cwd(), rootDirectory);
90
91
  return (glob
91
- .sync(path.join(`${directory}/${config_1.default.datasourcesDirectory}`, `**`, `[^_]*.sb.datasource.js`))
92
+ .sync(path.join(`${directory}/${config_1.default.datasourcesDirectory}`, '**', '[^_]*.sb.datasource.js'))
92
93
  // eslint-disable-next-line global-require, import/no-dynamic-require
93
- .map((file) => require(path.resolve(directory, file))));
94
+ .map(file => require(path.resolve(directory, file))));
94
95
  };
96
+ exports.findDatasources = findDatasources;