@akinon/projectzero 1.14.1 → 1.16.0

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/.gitattributes ADDED
@@ -0,0 +1,15 @@
1
+ *.js text eol=lf
2
+ *.jsx text eol=lf
3
+ *.ts text eol=lf
4
+ *.tsx text eol=lf
5
+ *.json text eol=lf
6
+ *.md text eol=lf
7
+
8
+ .eslintignore text eol=lf
9
+ .eslintrc text eol=lf
10
+ .gitignore text eol=lf
11
+ .prettierrc text eol=lf
12
+ .yarnrc text eol=lf
13
+
14
+ * text=auto
15
+
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @akinon/projectzero
2
2
 
3
+ ## 1.16.0
4
+
5
+ ## 1.15.0
6
+
7
+ ### Minor Changes
8
+
9
+ - 96dd05f: ZERO-2373: Add credit payment
10
+ - 96dd05f: ZERO-2385: Add gitattributes file
11
+
3
12
  ## 1.14.1
4
13
 
5
14
  ### Patch Changes
package/README.md CHANGED
@@ -1,18 +1,18 @@
1
- # Project Zero CLI
2
-
3
- This is the command line interface for Project Zero Next.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install -g @akinon/projectzero
9
- ```
10
-
11
- ## Available Commands
12
-
13
- ### `create`
14
- It creates a new project.
15
-
16
- ```bash
17
- npx @akinon/projectzero --create
1
+ # Project Zero CLI
2
+
3
+ This is the command line interface for Project Zero Next.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @akinon/projectzero
9
+ ```
10
+
11
+ ## Available Commands
12
+
13
+ ### `create`
14
+ It creates a new project.
15
+
16
+ ```bash
17
+ npx @akinon/projectzero --create
18
18
  ```
@@ -1,111 +1,111 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const argv = require("yargs").argv;
6
-
7
- export default () => {
8
- /**
9
- * @param {string} src The path to the thing to copy.
10
- * @param {string} dest The path to the new copy.
11
- * @param {string} lng Get Language
12
- */
13
- const addLanguage = (src: string, dest: string, lng: string) => {
14
- const exists = fs.existsSync(src);
15
- const stats = exists && fs.statSync(src);
16
- const isDirectory = exists && stats.isDirectory();
17
- if (isDirectory) {
18
- fs.mkdirSync(dest);
19
- fs.readdirSync(src).forEach((childItemName: string) => {
20
- addLanguage(
21
- path.join(src, childItemName),
22
- path.join(dest, childItemName),
23
- lng
24
- );
25
- });
26
-
27
- console.log(
28
- "\x1b[32m%s\x1b[0m",
29
- `\n✓ Added language option ${lng.toUpperCase()}.\nDon't forget to translate '${lng.toUpperCase()}' translation files inside 'public/locales/${lng.toUpperCase()}'\n`
30
- );
31
-
32
- console.log("\x1b[33m%s\x1b[0m", "Project Zero - Akinon\n");
33
- } else {
34
- fs.copyFileSync(src, dest);
35
- }
36
- };
37
-
38
- const i18nDocumentUpdate = (lng: string) => {
39
- /* next-i18next.config.js */
40
- const workingDir = path.resolve(process.cwd());
41
-
42
- const i18nPath = path.resolve(workingDir, "next-i18next.config.js");
43
-
44
- if (!fs.existsSync(i18nPath)) {
45
- return;
46
- }
47
-
48
- const i18nData = fs.readFileSync(i18nPath, {
49
- encoding: "utf8",
50
- flag: "r",
51
- });
52
-
53
- fs.writeFileSync(
54
- i18nPath,
55
- i18nData.replace(/locales: '*.'/, `locales: ['${lng}', '`)
56
- );
57
-
58
- /* settings.js */
59
-
60
- const settingsPath = path.resolve(workingDir, "src/settings.js");
61
-
62
- if (!fs.existsSync(settingsPath)) {
63
- return;
64
- }
65
-
66
- const settingsData = fs.readFileSync(settingsPath, {
67
- encoding: "utf8",
68
- flag: "r",
69
- });
70
-
71
- const data = `{ label: '${lng.toUpperCase()}', value: '${lng.toLowerCase()}', apiValue: '${
72
- argv.addLanguage
73
- }' }`;
74
-
75
- const changes = "languages: [";
76
-
77
- fs.writeFileSync(
78
- settingsPath,
79
- settingsData.replace(changes, `languages: [\n\t\t${data},`)
80
- );
81
- };
82
-
83
- const init = () => {
84
- if (!argv.addLanguage) return;
85
- let lng = argv.addLanguage;
86
- lng = lng.split("-")[0];
87
-
88
- const dest = `public/locales/${lng}`;
89
- const exists = fs.existsSync(dest);
90
-
91
- try {
92
- if (exists)
93
- throw new Error(`${lng.toUpperCase()} has already been added`);
94
- addLanguage("public/locales/en", `public/locales/${lng}`, lng);
95
- i18nDocumentUpdate(lng);
96
- } catch (err) {
97
- const typedError = err as Error;
98
-
99
- console.log(
100
- "\n\x1b[31m%s\x1b[0m",
101
- `${
102
- typedError.message
103
- ? typedError.message + "\n"
104
- : "Something went wrong.\n"
105
- }`
106
- );
107
- }
108
- };
109
-
110
- init();
111
- };
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const argv = require("yargs").argv;
6
+
7
+ export default () => {
8
+ /**
9
+ * @param {string} src The path to the thing to copy.
10
+ * @param {string} dest The path to the new copy.
11
+ * @param {string} lng Get Language
12
+ */
13
+ const addLanguage = (src: string, dest: string, lng: string) => {
14
+ const exists = fs.existsSync(src);
15
+ const stats = exists && fs.statSync(src);
16
+ const isDirectory = exists && stats.isDirectory();
17
+ if (isDirectory) {
18
+ fs.mkdirSync(dest);
19
+ fs.readdirSync(src).forEach((childItemName: string) => {
20
+ addLanguage(
21
+ path.join(src, childItemName),
22
+ path.join(dest, childItemName),
23
+ lng
24
+ );
25
+ });
26
+
27
+ console.log(
28
+ "\x1b[32m%s\x1b[0m",
29
+ `\n✓ Added language option ${lng.toUpperCase()}.\nDon't forget to translate '${lng.toUpperCase()}' translation files inside 'public/locales/${lng.toUpperCase()}'\n`
30
+ );
31
+
32
+ console.log("\x1b[33m%s\x1b[0m", "Project Zero - Akinon\n");
33
+ } else {
34
+ fs.copyFileSync(src, dest);
35
+ }
36
+ };
37
+
38
+ const i18nDocumentUpdate = (lng: string) => {
39
+ /* next-i18next.config.js */
40
+ const workingDir = path.resolve(process.cwd());
41
+
42
+ const i18nPath = path.resolve(workingDir, "next-i18next.config.js");
43
+
44
+ if (!fs.existsSync(i18nPath)) {
45
+ return;
46
+ }
47
+
48
+ const i18nData = fs.readFileSync(i18nPath, {
49
+ encoding: "utf8",
50
+ flag: "r",
51
+ });
52
+
53
+ fs.writeFileSync(
54
+ i18nPath,
55
+ i18nData.replace(/locales: '*.'/, `locales: ['${lng}', '`)
56
+ );
57
+
58
+ /* settings.js */
59
+
60
+ const settingsPath = path.resolve(workingDir, "src/settings.js");
61
+
62
+ if (!fs.existsSync(settingsPath)) {
63
+ return;
64
+ }
65
+
66
+ const settingsData = fs.readFileSync(settingsPath, {
67
+ encoding: "utf8",
68
+ flag: "r",
69
+ });
70
+
71
+ const data = `{ label: '${lng.toUpperCase()}', value: '${lng.toLowerCase()}', apiValue: '${
72
+ argv.addLanguage
73
+ }' }`;
74
+
75
+ const changes = "languages: [";
76
+
77
+ fs.writeFileSync(
78
+ settingsPath,
79
+ settingsData.replace(changes, `languages: [\n\t\t${data},`)
80
+ );
81
+ };
82
+
83
+ const init = () => {
84
+ if (!argv.addLanguage) return;
85
+ let lng = argv.addLanguage;
86
+ lng = lng.split("-")[0];
87
+
88
+ const dest = `public/locales/${lng}`;
89
+ const exists = fs.existsSync(dest);
90
+
91
+ try {
92
+ if (exists)
93
+ throw new Error(`${lng.toUpperCase()} has already been added`);
94
+ addLanguage("public/locales/en", `public/locales/${lng}`, lng);
95
+ i18nDocumentUpdate(lng);
96
+ } catch (err) {
97
+ const typedError = err as Error;
98
+
99
+ console.log(
100
+ "\n\x1b[31m%s\x1b[0m",
101
+ `${
102
+ typedError.message
103
+ ? typedError.message + "\n"
104
+ : "Something went wrong.\n"
105
+ }`
106
+ );
107
+ }
108
+ };
109
+
110
+ init();
111
+ };
@@ -1,70 +1,70 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
-
6
- const argv = require("yargs").argv;
7
-
8
- export default () => {
9
- const i18nDocumentUpdate = (lng: string) => {
10
- /* next-i18next.config.js */
11
- const workingDir = path.resolve(process.cwd());
12
- const i18nPath = path.resolve(workingDir, "next-i18next.config.js");
13
-
14
- if (!fs.existsSync(i18nPath)) {
15
- return;
16
- }
17
-
18
- const i18nData = fs.readFileSync(i18nPath, {
19
- encoding: "utf8",
20
- flag: "r",
21
- });
22
-
23
- const regExpLiteral = "locales:(.+)+";
24
-
25
- const result = i18nData.match(regExpLiteral);
26
-
27
- if (result[1].search(lng) < 0) {
28
- throw new Error(`${lng.toUpperCase()} not available`);
29
- }
30
-
31
- let updatedData = i18nData.replace(
32
- /defaultLocale: '.*'/,
33
- `defaultLocale: '${lng}'`
34
- );
35
-
36
- updatedData = updatedData.replace(
37
- /fallbackLng: '.*'/,
38
- `fallbackLng: '${lng}'`
39
- );
40
-
41
- fs.writeFileSync(i18nPath, updatedData);
42
- };
43
-
44
- const init = () => {
45
- if (!argv.defaultLanguage) return;
46
- let lng = argv.defaultLanguage;
47
-
48
- try {
49
- i18nDocumentUpdate(lng);
50
- console.log(
51
- "\x1b[32m%s\x1b[0m",
52
- `\n✓ Set as the default language option ${lng.toUpperCase()}.\n`
53
- );
54
- console.log("\x1b[33m%s\x1b[0m", "Project Zero - Akinon\n");
55
- } catch (err) {
56
- const typedError = err as Error;
57
-
58
- console.log(
59
- "\n\x1b[31m%s\x1b[0m",
60
- `${
61
- typedError.message
62
- ? typedError.message + "\n"
63
- : "Something went wrong.\n"
64
- }`
65
- );
66
- }
67
- };
68
-
69
- init();
70
- };
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+
6
+ const argv = require("yargs").argv;
7
+
8
+ export default () => {
9
+ const i18nDocumentUpdate = (lng: string) => {
10
+ /* next-i18next.config.js */
11
+ const workingDir = path.resolve(process.cwd());
12
+ const i18nPath = path.resolve(workingDir, "next-i18next.config.js");
13
+
14
+ if (!fs.existsSync(i18nPath)) {
15
+ return;
16
+ }
17
+
18
+ const i18nData = fs.readFileSync(i18nPath, {
19
+ encoding: "utf8",
20
+ flag: "r",
21
+ });
22
+
23
+ const regExpLiteral = "locales:(.+)+";
24
+
25
+ const result = i18nData.match(regExpLiteral);
26
+
27
+ if (result[1].search(lng) < 0) {
28
+ throw new Error(`${lng.toUpperCase()} not available`);
29
+ }
30
+
31
+ let updatedData = i18nData.replace(
32
+ /defaultLocale: '.*'/,
33
+ `defaultLocale: '${lng}'`
34
+ );
35
+
36
+ updatedData = updatedData.replace(
37
+ /fallbackLng: '.*'/,
38
+ `fallbackLng: '${lng}'`
39
+ );
40
+
41
+ fs.writeFileSync(i18nPath, updatedData);
42
+ };
43
+
44
+ const init = () => {
45
+ if (!argv.defaultLanguage) return;
46
+ let lng = argv.defaultLanguage;
47
+
48
+ try {
49
+ i18nDocumentUpdate(lng);
50
+ console.log(
51
+ "\x1b[32m%s\x1b[0m",
52
+ `\n✓ Set as the default language option ${lng.toUpperCase()}.\n`
53
+ );
54
+ console.log("\x1b[33m%s\x1b[0m", "Project Zero - Akinon\n");
55
+ } catch (err) {
56
+ const typedError = err as Error;
57
+
58
+ console.log(
59
+ "\n\x1b[31m%s\x1b[0m",
60
+ `${
61
+ typedError.message
62
+ ? typedError.message + "\n"
63
+ : "Something went wrong.\n"
64
+ }`
65
+ );
66
+ }
67
+ };
68
+
69
+ init();
70
+ };
@@ -14,38 +14,42 @@ try {
14
14
  } catch (error) {}
15
15
 
16
16
  const definedPlugins = [
17
- {
18
- name: 'Basket Gift Pack',
19
- value: 'pz-basket-gift-pack'
20
- },
21
- {
22
- name: 'Click & Collect',
23
- value: 'pz-click-collect'
24
- },
25
- {
26
- name: 'Checkout Gift Pack',
27
- value: 'pz-checkout-gift-pack'
28
- },
29
- {
30
- name: 'One Click Checkout',
31
- value: 'pz-one-click-checkout'
32
- },
17
+ // {
18
+ // name: 'Basket Gift Pack',
19
+ // value: 'pz-basket-gift-pack'
20
+ // },
21
+ // {
22
+ // name: 'Click & Collect',
23
+ // value: 'pz-click-collect'
24
+ // },
25
+ // {
26
+ // name: 'Checkout Gift Pack',
27
+ // value: 'pz-checkout-gift-pack'
28
+ // },
29
+ // {
30
+ // name: 'One Click Checkout',
31
+ // value: 'pz-one-click-checkout'
32
+ // },
33
33
  {
34
34
  name: 'Garanti Pay',
35
35
  value: 'pz-gpay'
36
36
  },
37
+ // {
38
+ // name: 'Pay On Delivery',
39
+ // value: 'pz-pay-on-delivery'
40
+ // },
37
41
  {
38
- name: 'Pay On Delivery',
39
- value: 'pz-pay-on-delivery'
40
- },
41
- {
42
- name: 'Otp',
42
+ name: 'OTP',
43
43
  value: 'pz-otp'
44
- },
45
- {
46
- name: 'BKM Express',
47
- value: 'pz-bkm'
48
44
  }
45
+ // {
46
+ // name: 'BKM Express',
47
+ // value: 'pz-bkm'
48
+ // },
49
+ // {
50
+ // name: 'Credit Payment',
51
+ // value: 'pz-credit-payment'
52
+ // }
49
53
  ];
50
54
 
51
55
  export default async () => {
@@ -1,91 +1,91 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require("fs");
4
- const path = require("path");
5
- const argv = require("yargs").argv;
6
-
7
- export default () => {
8
- /**
9
- * @param {string} lng Get Language
10
- */
11
-
12
- const removeLanguage = (lng: string) => {
13
- const workingDir = path.resolve(process.cwd());
14
-
15
- try {
16
- fs.rm(`public/locales/${lng}`, { recursive: true }, (err: any) => {
17
- if (err) {
18
- console.error(err);
19
- return;
20
- }
21
- });
22
- } catch (error) {
23
- console.log("error", error);
24
- }
25
-
26
- /* settings.js */
27
-
28
- const settingsPath = path.resolve(workingDir, "src/settings.js");
29
-
30
- if (!fs.existsSync(settingsPath)) {
31
- return;
32
- }
33
-
34
- const settingsData = fs.readFileSync(settingsPath, {
35
- encoding: "utf8",
36
- flag: "r",
37
- });
38
-
39
- const data = `{ label: '${lng.toUpperCase()}', value: '${lng.toLowerCase()}', apiValue: '${lng.toLowerCase()}-${lng.toLowerCase()}' },`;
40
-
41
- let updatedData = settingsData.replace(data.toString(), "");
42
-
43
- updatedData = updatedData.replace(/^\s*$(?:\r\n?|\n)/gm, "");
44
-
45
- fs.writeFileSync(settingsPath, updatedData);
46
-
47
- /* next-i18next.config.js */
48
-
49
- const i18nPath = path.resolve(workingDir, "next-i18next.config.js");
50
-
51
- if (!fs.existsSync(i18nPath)) {
52
- return;
53
- }
54
-
55
- const i18nData = fs.readFileSync(i18nPath, {
56
- encoding: "utf8",
57
- flag: "r",
58
- });
59
-
60
- fs.writeFileSync(i18nPath, i18nData.replace(`'${lng}',\u0020`, ""));
61
-
62
- console.log(
63
- "\x1b[32m%s\x1b[0m",
64
- `\n✓ Remove language option ${lng.toUpperCase()}.\n`
65
- );
66
-
67
- console.log("\x1b[33m%s\x1b[0m", "Project Zero - Akinon\n");
68
- };
69
-
70
- const init = () => {
71
- if (!argv.removeLanguage) return;
72
- let lng = argv.removeLanguage;
73
-
74
- try {
75
- removeLanguage(lng);
76
- } catch (err) {
77
- const typedError = err as Error;
78
-
79
- console.log(
80
- "\n\x1b[31m%s\x1b[0m",
81
- `${
82
- typedError.message
83
- ? typedError.message + "\n"
84
- : "Something went wrong.\n"
85
- }`
86
- );
87
- }
88
- };
89
-
90
- init();
91
- };
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs");
4
+ const path = require("path");
5
+ const argv = require("yargs").argv;
6
+
7
+ export default () => {
8
+ /**
9
+ * @param {string} lng Get Language
10
+ */
11
+
12
+ const removeLanguage = (lng: string) => {
13
+ const workingDir = path.resolve(process.cwd());
14
+
15
+ try {
16
+ fs.rm(`public/locales/${lng}`, { recursive: true }, (err: any) => {
17
+ if (err) {
18
+ console.error(err);
19
+ return;
20
+ }
21
+ });
22
+ } catch (error) {
23
+ console.log("error", error);
24
+ }
25
+
26
+ /* settings.js */
27
+
28
+ const settingsPath = path.resolve(workingDir, "src/settings.js");
29
+
30
+ if (!fs.existsSync(settingsPath)) {
31
+ return;
32
+ }
33
+
34
+ const settingsData = fs.readFileSync(settingsPath, {
35
+ encoding: "utf8",
36
+ flag: "r",
37
+ });
38
+
39
+ const data = `{ label: '${lng.toUpperCase()}', value: '${lng.toLowerCase()}', apiValue: '${lng.toLowerCase()}-${lng.toLowerCase()}' },`;
40
+
41
+ let updatedData = settingsData.replace(data.toString(), "");
42
+
43
+ updatedData = updatedData.replace(/^\s*$(?:\r\n?|\n)/gm, "");
44
+
45
+ fs.writeFileSync(settingsPath, updatedData);
46
+
47
+ /* next-i18next.config.js */
48
+
49
+ const i18nPath = path.resolve(workingDir, "next-i18next.config.js");
50
+
51
+ if (!fs.existsSync(i18nPath)) {
52
+ return;
53
+ }
54
+
55
+ const i18nData = fs.readFileSync(i18nPath, {
56
+ encoding: "utf8",
57
+ flag: "r",
58
+ });
59
+
60
+ fs.writeFileSync(i18nPath, i18nData.replace(`'${lng}',\u0020`, ""));
61
+
62
+ console.log(
63
+ "\x1b[32m%s\x1b[0m",
64
+ `\n✓ Remove language option ${lng.toUpperCase()}.\n`
65
+ );
66
+
67
+ console.log("\x1b[33m%s\x1b[0m", "Project Zero - Akinon\n");
68
+ };
69
+
70
+ const init = () => {
71
+ if (!argv.removeLanguage) return;
72
+ let lng = argv.removeLanguage;
73
+
74
+ try {
75
+ removeLanguage(lng);
76
+ } catch (err) {
77
+ const typedError = err as Error;
78
+
79
+ console.log(
80
+ "\n\x1b[31m%s\x1b[0m",
81
+ `${
82
+ typedError.message
83
+ ? typedError.message + "\n"
84
+ : "Something went wrong.\n"
85
+ }`
86
+ );
87
+ }
88
+ };
89
+
90
+ init();
91
+ };