@uniformdev/cli 19.22.1-alpha.8 → 19.23.1-alpha.12

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 (2) hide show
  1. package/dist/index.mjs +118 -3
  2. package/package.json +8 -7
package/dist/index.mjs CHANGED
@@ -3097,7 +3097,7 @@ import { PostHog } from "posthog-node";
3097
3097
  // package.json
3098
3098
  var package_default = {
3099
3099
  name: "@uniformdev/cli",
3100
- version: "19.22.0",
3100
+ version: "19.23.0",
3101
3101
  description: "Uniform command line interface tool",
3102
3102
  license: "SEE LICENSE IN LICENSE.txt",
3103
3103
  main: "./cli.js",
@@ -3135,6 +3135,7 @@ var package_default = {
3135
3135
  ora: "6.3.1",
3136
3136
  "posthog-node": "3.1.1",
3137
3137
  slugify: "1.6.6",
3138
+ "update-check": "^1.5.4",
3138
3139
  yargs: "^17.6.2",
3139
3140
  zod: "3.21.4"
3140
3141
  },
@@ -3144,7 +3145,7 @@ var package_default = {
3144
3145
  "@types/js-yaml": "4.0.5",
3145
3146
  "@types/jsonwebtoken": "9.0.2",
3146
3147
  "@types/lodash.isequalwith": "4.4.7",
3147
- "@types/node": "18.16.16",
3148
+ "@types/node": "18.16.17",
3148
3149
  "@types/yargs": "17.0.24"
3149
3150
  },
3150
3151
  bin: {
@@ -5150,7 +5151,121 @@ var RedirectCommand = {
5150
5151
  }
5151
5152
  };
5152
5153
 
5154
+ // src/middleware/checkForUpdateMiddleware.ts
5155
+ import { bold, gray as gray5, green as green4 } from "colorette";
5156
+ import updateCheck from "update-check";
5157
+
5158
+ // src/log.ts
5159
+ import { reset } from "colorette";
5160
+ function fillString(char, length) {
5161
+ return Array.from({ length }).map(() => char).join("");
5162
+ }
5163
+ function logCallout(options) {
5164
+ const message = typeof options === "string" ? options : options.message;
5165
+ const messageLines = message.trim().split("\n");
5166
+ const longestLine = messageLines.reduce((longest, next) => next.length > longest.length ? next : longest);
5167
+ const bar = "**" + fillString("*", reset(longestLine).length);
5168
+ console.log("");
5169
+ console.log(bar);
5170
+ for (const line of messageLines) {
5171
+ console.log(` ${line}`);
5172
+ }
5173
+ console.log(bar);
5174
+ console.log("");
5175
+ }
5176
+
5177
+ // src/middleware/checkForUpdateMiddleware.ts
5178
+ async function checkForUpdateMiddleware() {
5179
+ try {
5180
+ if (process.env.NO_UPDATE_CHECK || process.env.CI) {
5181
+ return;
5182
+ }
5183
+ const update = await updateCheck(package_default);
5184
+ if (update) {
5185
+ logCallout(`${bold("Update Available:")} ${gray5(package_default.version)} \u226B ${green4(update.latest)}`);
5186
+ }
5187
+ } catch (e) {
5188
+ console.error(`There was an error checking for updates`, e);
5189
+ }
5190
+ }
5191
+
5192
+ // src/middleware/checkLocalDepsVersionsMiddleware.ts
5193
+ import { magenta, red as red6 } from "colorette";
5194
+ import { join as join2 } from "path";
5195
+
5196
+ // src/fs.ts
5197
+ import { promises as fs4 } from "fs";
5198
+ async function readJSON(path4) {
5199
+ const fileContents = await fs4.readFile(path4, "utf-8");
5200
+ return JSON.parse(fileContents);
5201
+ }
5202
+ async function tryReadJSON(path4, missingValue = null) {
5203
+ try {
5204
+ const stat = await fs4.stat(path4);
5205
+ return stat.isFile() ? await readJSON(path4) : missingValue;
5206
+ } catch (e) {
5207
+ return missingValue;
5208
+ }
5209
+ }
5210
+
5211
+ // src/middleware/checkLocalDepsVersionsMiddleware.ts
5212
+ var uniformStrictVersions = [
5213
+ "@uniformdev/canvas",
5214
+ "@uniformdev/canvas-next",
5215
+ "@uniformdev/canvas-vue",
5216
+ "@uniformdev/cli",
5217
+ "@uniformdev/context",
5218
+ "@uniformdev/context-next",
5219
+ "@uniformdev/context-vue",
5220
+ "@uniformdev/mesh-sdk",
5221
+ "@uniformdev/mesh-sdk-react",
5222
+ "@uniformdev/project-map",
5223
+ "@uniformdev/redirect",
5224
+ "@uniformdev/richtext",
5225
+ "@uniformdev/uniform-design-system",
5226
+ "@uniformdev/uniform-nuxt",
5227
+ "@uniformdev/webhooks"
5228
+ ];
5229
+ var checkLocalDepsVersions = async (args) => {
5230
+ try {
5231
+ let isOutside = false;
5232
+ let warning = `${magenta("Warning:")} Installed Uniform packages should be the same version`;
5233
+ const localPackages = await tryReadJSON(join2(process.cwd(), "package.json"));
5234
+ if (!localPackages)
5235
+ return;
5236
+ let firstVersion;
5237
+ const allDependencies = {
5238
+ ...(localPackages == null ? void 0 : localPackages.dependencies) ?? {},
5239
+ ...(localPackages == null ? void 0 : localPackages.devDependencies) ?? {}
5240
+ };
5241
+ for (const [p, version] of Object.entries(allDependencies)) {
5242
+ if (uniformStrictVersions.includes(p)) {
5243
+ if (!firstVersion) {
5244
+ firstVersion = version;
5245
+ warning += `
5246
+ First found was: v${firstVersion}`;
5247
+ }
5248
+ if (version !== firstVersion) {
5249
+ isOutside = true;
5250
+ warning += red6(`
5251
+ ${p}: ${version}`);
5252
+ }
5253
+ }
5254
+ }
5255
+ if (isOutside)
5256
+ logCallout(warning);
5257
+ } catch (e) {
5258
+ if (args.verbose) {
5259
+ console.warn(`There was an error validating the local project dependencies`, e);
5260
+ }
5261
+ }
5262
+ };
5263
+
5153
5264
  // src/index.ts
5154
5265
  dotenv.config();
5155
5266
  var yarggery = yargs19(hideBin(process.argv));
5156
- yarggery.command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().argv;
5267
+ yarggery.option("verbose", {
5268
+ describe: "Include verbose logging",
5269
+ default: false,
5270
+ type: "boolean"
5271
+ }).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(NewCmd).command(NewMeshCmd).command(OptimizeCommand).demandCommand(1, "").strict().help().middleware([checkForUpdateMiddleware, checkLocalDepsVersions]).argv;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniformdev/cli",
3
- "version": "19.22.1-alpha.8+a8f730b12",
3
+ "version": "19.23.1-alpha.12+669adf812",
4
4
  "description": "Uniform command line interface tool",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "main": "./cli.js",
@@ -16,10 +16,10 @@
16
16
  "format": "prettier --write \"src/**/*.{js,ts,tsx}\""
17
17
  },
18
18
  "dependencies": {
19
- "@uniformdev/canvas": "19.22.1-alpha.8+a8f730b12",
20
- "@uniformdev/context": "19.22.1-alpha.8+a8f730b12",
21
- "@uniformdev/project-map": "19.22.1-alpha.8+a8f730b12",
22
- "@uniformdev/redirect": "19.22.1-alpha.8+a8f730b12",
19
+ "@uniformdev/canvas": "19.23.1-alpha.12+669adf812",
20
+ "@uniformdev/context": "19.23.1-alpha.12+669adf812",
21
+ "@uniformdev/project-map": "19.23.1-alpha.12+669adf812",
22
+ "@uniformdev/redirect": "19.23.1-alpha.12+669adf812",
23
23
  "colorette": "2.0.20",
24
24
  "diff": "^5.0.0",
25
25
  "dotenv": "^16.0.3",
@@ -38,6 +38,7 @@
38
38
  "ora": "6.3.1",
39
39
  "posthog-node": "3.1.1",
40
40
  "slugify": "1.6.6",
41
+ "update-check": "^1.5.4",
41
42
  "yargs": "^17.6.2",
42
43
  "zod": "3.21.4"
43
44
  },
@@ -47,7 +48,7 @@
47
48
  "@types/js-yaml": "4.0.5",
48
49
  "@types/jsonwebtoken": "9.0.2",
49
50
  "@types/lodash.isequalwith": "4.4.7",
50
- "@types/node": "18.16.16",
51
+ "@types/node": "18.16.17",
51
52
  "@types/yargs": "17.0.24"
52
53
  },
53
54
  "bin": {
@@ -59,5 +60,5 @@
59
60
  "publishConfig": {
60
61
  "access": "public"
61
62
  },
62
- "gitHead": "a8f730b12035a4d7c2e6a704d3777ff12df52ffc"
63
+ "gitHead": "669adf812df13a7856fb9bc5c4332c77e0697f3f"
63
64
  }