@syncify/cli 0.3.0-beta → 1.0.0-unstable.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.
Files changed (42) hide show
  1. package/LICENSE +10 -6
  2. package/dist/api.js +32 -12
  3. package/dist/cli.js +610 -6
  4. package/dist/index.d.ts +2264 -0
  5. package/dist/index.js +10 -10
  6. package/dist/syncify.js +24248 -0
  7. package/hot.js.liquid +13 -2
  8. package/package.json +118 -115
  9. package/readme.md +110 -2176
  10. package/scripts/postinstall.js +116 -0
  11. package/scripts/postversion.js +60 -0
  12. package/dist/cjs.js +0 -236
  13. package/pnpm-lock.yaml +0 -5662
  14. package/schema/syncify.config.json +0 -676
  15. package/schema/syncify.env.json +0 -58
  16. package/schema/syncify.package.json +0 -11
  17. package/types/api.d.ts +0 -319
  18. package/types/bundle/cache.d.ts +0 -101
  19. package/types/bundle/commands.d.ts +0 -396
  20. package/types/bundle/errors.d.ts +0 -101
  21. package/types/bundle/file.d.ts +0 -285
  22. package/types/bundle/filters.d.ts +0 -81
  23. package/types/bundle/hot.d.ts +0 -185
  24. package/types/bundle/index.d.ts +0 -603
  25. package/types/bundle/plugin.d.ts +0 -127
  26. package/types/bundle/processors.d.ts +0 -54
  27. package/types/bundle/reports.d.ts +0 -123
  28. package/types/bundle/requests.d.ts +0 -374
  29. package/types/bundle/shared.d.ts +0 -124
  30. package/types/cli.d.ts +0 -547
  31. package/types/config/index.d.ts +0 -550
  32. package/types/config/terser.d.ts +0 -319
  33. package/types/config/views.d.ts +0 -191
  34. package/types/index.d.ts +0 -55
  35. package/types/modules/html-minifier-terser.d.ts +0 -218
  36. package/types/stores.d.ts +0 -11
  37. package/types/transforms/image.d.ts +0 -15
  38. package/types/transforms/json.d.ts +0 -51
  39. package/types/transforms/pages.d.ts +0 -254
  40. package/types/transforms/script.d.ts +0 -308
  41. package/types/transforms/style.d.ts +0 -219
  42. package/types/transforms/svg.d.ts +0 -189
@@ -0,0 +1,116 @@
1
+ // This script uses conditional logic to work in both CJS and ESM environments
2
+ (async () => {
3
+
4
+ let fs;
5
+ let path;
6
+ let os;
7
+
8
+ if (typeof require === 'function') {
9
+
10
+ // CommonJS environment
11
+ fs = require('fs');
12
+ path = require('path');
13
+ os = require('os');
14
+
15
+ } else {
16
+
17
+ // ES Module environment
18
+ ({ default: fs } = await import('fs'));
19
+ ({ default: path } = await import('path'));
20
+ ({ default: os } = await import('os'));
21
+
22
+ }
23
+
24
+ // Files to be generated
25
+
26
+ const green = (text) => `\x1b[1;32m${text}\x1b[0m`;
27
+ const gray = (text) => `\x1b[0;90m${text}\x1b[0m`;
28
+ const whiteBold = (text) => `\x1b[1;37m${text}\x1b[0m`;
29
+
30
+ const created = 'created' + gray(':');
31
+ const updated = 'updated' + gray(':');
32
+
33
+ const syncifyDir = path.join(os.homedir(), '.syncify');
34
+ const keychainFile = path.join(syncifyDir, '.keychain');
35
+ const versionsFile = path.join(syncifyDir, '.version');
36
+ const notifyIconFile = path.join(syncifyDir, 'icon.png');
37
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
38
+
39
+ let hasLogged = false;
40
+ let hasNewline = 1;
41
+
42
+ const logName = () => {
43
+ if (!hasLogged) {
44
+ console.log(' ');
45
+ console.log(` ${green('@syncify/cli')} ${gray('→')} ${whiteBold('postinstall')}`);
46
+ console.log(' ');
47
+ console.log(` version${gray(':')} ${gray(`v${pkg.version}`)}`);
48
+ hasLogged = true;
49
+ }
50
+ };
51
+
52
+ // First we create the .syncify directory
53
+ if (!fs.existsSync(syncifyDir)) {
54
+ logName();
55
+ fs.mkdirSync(syncifyDir);
56
+ console.log(` ${created} ${gray(syncifyDir)}`);
57
+ hasNewline = 2;
58
+ }
59
+
60
+ // Lets create the .syncify/.keychain file if it does not exist
61
+ if (!fs.existsSync(keychainFile)) {
62
+ logName();
63
+ fs.writeFileSync(keychainFile, '{}');
64
+ console.log(` ${created} ${gray(keychainFile)}`);
65
+ hasNewline = 2;
66
+ }
67
+
68
+ // Lets copy the notifier icon if it does not exist
69
+ if (!fs.existsSync(notifyIconFile)) {
70
+ logName();
71
+ fs.copyFileSync('icon.png', notifyIconFile);
72
+ console.log(` ${created} ${gray(notifyIconFile)}`);
73
+ hasNewline = 2;
74
+ }
75
+
76
+ const cwd = process.cwd();
77
+
78
+ // Lets create the .syncify/.versions file if it does not exist
79
+ if (!fs.existsSync(versionsFile)) {
80
+
81
+ logName();
82
+
83
+ fs.writeFileSync(versionsFile, JSON.stringify({ [cwd]: pkg.version }));
84
+
85
+ console.log(` ${created} ${gray(versionsFile)}`);
86
+ console.log(' ');
87
+ hasNewline = 3;
88
+
89
+ } else {
90
+
91
+ const ver = JSON.parse(fs.readFileSync(versionsFile).toString());
92
+ const hasVer = cwd in ver;
93
+
94
+ if (hasVer === false || (hasVer === true && ver[cwd] !== pkg.version)) {
95
+
96
+ logName();
97
+
98
+ ver[cwd] = pkg.version;
99
+
100
+ fs.writeFileSync(versionsFile, JSON.stringify(ver));
101
+
102
+ console.log(` ${updated} ${gray(versionsFile)}`);
103
+ console.log(' ');
104
+ hasNewline = 3;
105
+ }
106
+ }
107
+
108
+ if (hasNewline === 2) {
109
+ console.log(' ');
110
+ }
111
+
112
+ })().catch(err => {
113
+
114
+ console.error('𐄂 syncify postinstall:', err);
115
+
116
+ });
@@ -0,0 +1,60 @@
1
+ // This script uses conditional logic to work in both CJS and ESM environments
2
+ (async () => {
3
+
4
+ let fs;
5
+ let path;
6
+ let os;
7
+
8
+ if (typeof require === 'function') {
9
+
10
+ // CommonJS environment
11
+ fs = require('fs');
12
+ path = require('path');
13
+ os = require('os');
14
+
15
+ } else {
16
+
17
+ // ES Module environment
18
+ ({ default: fs } = await import('fs'));
19
+ ({ default: path } = await import('path'));
20
+ ({ default: os } = await import('os'));
21
+
22
+ }
23
+
24
+ // Read package.json for version information
25
+ const cwd = process.cwd();
26
+ const pkg = JSON.parse(fs.readFileSync('package.json', 'utf8'));
27
+ const gray = (text) => `\x1b[0;90m${text}\x1b[0m`;
28
+
29
+ // Files to be generated
30
+ const syncifyDir = path.join(os.homedir(), '.syncify');
31
+ const versionsFile = path.join(syncifyDir, '.version');
32
+ const versions = JSON.parse(fs.readFileSync(versionsFile).toString());
33
+
34
+ if (cwd in versions) {
35
+
36
+ const ver = versions[cwd];
37
+
38
+ if (ver !== pkg.version) {
39
+
40
+ console.log(' ');
41
+ console.log(` ${green('@syncify/cli')} ${gray('→')} ${whiteBold('postversion')}`);
42
+ console.log(' ');
43
+ console.log(` version${gray(':')} ${gray(`v${pkg.version}`)}`);
44
+
45
+ versions[cwd] = pkg.version;
46
+
47
+ fs.writeFileSync(versionsFile, JSON.stringify(versions));
48
+
49
+ console.log(` updated${gray(':')}${gray(`${versionsFile}`)}`);
50
+ console.log(' ');
51
+
52
+ }
53
+
54
+ }
55
+
56
+ })().catch(err => {
57
+
58
+ console.error('𐄂 syncify postversion:', err);
59
+
60
+ });