@loftyshaky/shared-app 0.0.2 → 0.0.3

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.
package/js/apps.js ADDED
@@ -0,0 +1,60 @@
1
+ const path = require('path');
2
+
3
+ const { projects_path } = require('./projects_path');
4
+ const { ProjectName } = require('./project_name');
5
+
6
+ const project_name = new ProjectName();
7
+
8
+ const apps = [
9
+ 'Advanced Extension Reloader Watch 1',
10
+ 'Advanced Extension Reloader Watch 2',
11
+ 'Browservery',
12
+ 'App Puppeteer',
13
+ 'Stock Screener',
14
+ 'Advanced Extension Reloader',
15
+ 'Search Enhancer for Google',
16
+ 'Clear New Tab',
17
+ 'Base64 font-face',
18
+ ];
19
+
20
+ const app_types = ['package', 'package', 'app', 'app', 'app', 'ext', 'ext', 'ext'];
21
+
22
+ const create_app_paths = () =>
23
+ apps.map((project) => path.join(projects_path.q, project, project_name.transform({ project })));
24
+
25
+ const app = create_app_paths();
26
+
27
+ const create_eslintrc_paths = () => app.map((app_dir) => path.join(app_dir, '.eslintrc.js'));
28
+
29
+ const eslintrc = create_eslintrc_paths();
30
+
31
+ const create_prettierrc_paths = () => app.map((app_dir) => path.join(app_dir, '.prettierrc.js'));
32
+
33
+ const prettierrc = create_prettierrc_paths();
34
+
35
+ const create_stylelintrc_paths = () =>
36
+ app.map((app_dir) => path.join(app_dir, '.stylelintrc.json'));
37
+
38
+ const stylelintrc = create_stylelintrc_paths();
39
+
40
+ const is_ext = ({ app_root }) => {
41
+ const current_app_name = path.basename(path.dirname(app_root));
42
+
43
+ const app_i = apps.findIndex((app_name) => app_name === current_app_name);
44
+
45
+ return app_types[app_i] === 'ext';
46
+ };
47
+
48
+ const paths = {
49
+ app,
50
+ eslintrc,
51
+ prettierrc,
52
+ stylelintrc,
53
+ };
54
+
55
+ module.exports = {
56
+ apps,
57
+ app_types,
58
+ paths,
59
+ is_ext,
60
+ };
package/js/locales.js CHANGED
@@ -1,6 +1,9 @@
1
1
  const path = require('path');
2
+
2
3
  const fs = require('fs-extra');
3
4
 
5
+ const { is_ext } = require('./apps');
6
+
4
7
  class Locales {
5
8
  constructor({ app_root }) {
6
9
  this.app_root = app_root;
@@ -12,7 +15,7 @@ class Locales {
12
15
  this.app_root,
13
16
  'node_modules',
14
17
  '@loftyshaky',
15
- 'shared',
18
+ `shared${is_ext({ app_root: this.app_root }) ? '' : '-app'}`,
16
19
  '_locales',
17
20
  );
18
21
  const locales = fs.readdirSync(app_locales_path);
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
2
 
3
- const fs = require('fs-extra');
3
+ const { is_ext } = require('./apps');
4
4
 
5
5
  const shared_config = ({
6
6
  app_type,
@@ -18,14 +18,11 @@ const shared_config = ({
18
18
  callback_begin = () => undefined,
19
19
  callback_done = () => undefined,
20
20
  }) => {
21
- const package_json = fs.readJSONSync(path.join(app_root, 'package.json'));
22
- const shared_app_is_added_as_dep = package_json.dependencies['@loftyshaky/shared-app'];
23
-
24
21
  const shared_path = path.join(
25
22
  app_root,
26
23
  'node_modules',
27
24
  '@loftyshaky',
28
- `shared${shared_app_is_added_as_dep ? '-app' : ''}`,
25
+ `shared${is_ext({ app_root }) ? '' : '-app'}`,
29
26
  'scss',
30
27
  'shared',
31
28
  );
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@loftyshaky/shared-app",
3
3
  "description": "-",
4
- "version": "0.0.2",
4
+ "version": "0.0.3",
5
5
  "author": "loftyshaky",
6
6
  "license": "MIT",
7
7
  "repository": {