@uniformdev/cli 19.40.1-alpha.16 → 19.42.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 (2) hide show
  1. package/dist/index.mjs +44 -37
  2. package/package.json +6 -6
package/dist/index.mjs CHANGED
@@ -1,10 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { cosmiconfigSync } from "cosmiconfig";
5
- import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
6
4
  import * as dotenv from "dotenv";
7
- import fs5 from "fs";
8
5
  import yargs22 from "yargs";
9
6
  import { hideBin } from "yargs/helpers";
10
7
 
@@ -78,6 +75,9 @@ import { readdir, unlink } from "fs/promises";
78
75
  import { extname as extname2, join } from "path";
79
76
 
80
77
  // src/util.ts
78
+ import { cosmiconfigSync } from "cosmiconfig";
79
+ import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
80
+ import fs from "fs";
81
81
  var omit = (object, keys) => {
82
82
  const result = keys.reduce((current, key) => {
83
83
  const { [key]: _, ...rest } = current;
@@ -88,6 +88,30 @@ var omit = (object, keys) => {
88
88
  var cleanFileName = (proposedFileName) => {
89
89
  return proposedFileName.replace(/[/<>$+%>!`&*'|{}?"=:\\@]/g, "-");
90
90
  };
91
+ var loadConfig = (configPath) => {
92
+ const moduleName = "uniform";
93
+ const syncCosmicExplorer = cosmiconfigSync("uniform", {
94
+ searchPlaces: [`${moduleName}.config.js`, `${moduleName}.config.ts`, `${moduleName}.config.json`],
95
+ loaders: {
96
+ ".ts": TypeScriptLoader()
97
+ }
98
+ });
99
+ if (configPath) {
100
+ if (!fs.existsSync(configPath)) {
101
+ throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
102
+ }
103
+ const configFile = syncCosmicExplorer.load(configPath);
104
+ if (!(configFile == null ? void 0 : configFile.config.serialization)) {
105
+ throw new Error(
106
+ `Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
107
+ );
108
+ }
109
+ return applyDefaultSyncConfiguration((configFile == null ? void 0 : configFile.config) ?? {});
110
+ } else {
111
+ const searchedForm = syncCosmicExplorer.search();
112
+ return applyDefaultSyncConfiguration((searchedForm == null ? void 0 : searchedForm.config) ?? {});
113
+ }
114
+ };
91
115
 
92
116
  // src/sync/util.ts
93
117
  import { readFileSync, writeFileSync } from "fs";
@@ -354,9 +378,9 @@ ${e == null ? void 0 : e.message}`));
354
378
  }
355
379
 
356
380
  // src/sync/package.ts
357
- import fs from "fs";
381
+ import fs2 from "fs";
358
382
  function readUniformPackage(filename, assertExists) {
359
- if (!assertExists && !fs.existsSync(filename)) {
383
+ if (!assertExists && !fs2.existsSync(filename)) {
360
384
  return {};
361
385
  }
362
386
  const packageContents = readFileToObject(filename);
@@ -3751,7 +3775,7 @@ import { PostHog } from "posthog-node";
3751
3775
  // package.json
3752
3776
  var package_default = {
3753
3777
  name: "@uniformdev/cli",
3754
- version: "19.40.0",
3778
+ version: "19.42.0",
3755
3779
  description: "Uniform command line interface tool",
3756
3780
  license: "SEE LICENSE IN LICENSE.txt",
3757
3781
  main: "./cli.js",
@@ -4125,7 +4149,7 @@ ${err.message}`);
4125
4149
 
4126
4150
  // src/projects/cloneStarter.ts
4127
4151
  import crypto2 from "crypto";
4128
- import fs2 from "fs";
4152
+ import fs3 from "fs";
4129
4153
  import fsj from "fs-jetpack";
4130
4154
  import * as git from "isomorphic-git";
4131
4155
  import * as http from "isomorphic-git/http/node/index.js";
@@ -4142,7 +4166,7 @@ async function cloneStarter({
4142
4166
  const [user, repo, ...pathSegments] = githubPath.split("/");
4143
4167
  try {
4144
4168
  await git.clone({
4145
- fs: fs2,
4169
+ fs: fs3,
4146
4170
  http,
4147
4171
  url: `https://github.com/${user}/${repo}`,
4148
4172
  dir: cloneDir,
@@ -4153,13 +4177,13 @@ async function cloneStarter({
4153
4177
  throw new Error(`Failed to fetch starter code: ${err.message}`);
4154
4178
  }
4155
4179
  await done();
4156
- if (fs2.existsSync(targetDir) && fs2.readdirSync(targetDir).length > 0) {
4180
+ if (fs3.existsSync(targetDir) && fs3.readdirSync(targetDir).length > 0) {
4157
4181
  throw new Error(`"${targetDir}" is not empty`);
4158
4182
  }
4159
4183
  const starterDir = path.join(cloneDir, ...pathSegments);
4160
4184
  fsj.copy(starterDir, targetDir, { overwrite: true });
4161
4185
  if (dotEnvFile) {
4162
- fs2.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
4186
+ fs3.writeFileSync(path.resolve(targetDir, ".env"), dotEnvFile, "utf-8");
4163
4187
  }
4164
4188
  console.log(`
4165
4189
  Your project now lives in ${targetDir} \u2728`);
@@ -4175,7 +4199,7 @@ Installing project dependencies...
4175
4199
  }
4176
4200
 
4177
4201
  // src/projects/getOrCreateProject.ts
4178
- import fs3, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
4202
+ import fs4, { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
4179
4203
  import inquirer2 from "inquirer";
4180
4204
  import path2 from "path";
4181
4205
  import slugify from "slugify";
@@ -4302,9 +4326,9 @@ function validateProjectName(projectName, checkTargetDir, explicitTargetDir) {
4302
4326
  if (!existsSync2(targetDir)) {
4303
4327
  mkdirSync2(targetDir, { recursive: true });
4304
4328
  }
4305
- if (fs3.readdirSync(targetDir).length > 0) {
4329
+ if (fs4.readdirSync(targetDir).length > 0) {
4306
4330
  targetDir = path2.resolve(targetDir, projectNameSlug);
4307
- if (fs3.existsSync(targetDir)) {
4331
+ if (fs4.existsSync(targetDir)) {
4308
4332
  throw new Error(`${targetDir} already exists, choose a different name.`);
4309
4333
  }
4310
4334
  }
@@ -6064,14 +6088,14 @@ import { magenta, red as red6 } from "colorette";
6064
6088
  import { join as join2 } from "path";
6065
6089
 
6066
6090
  // src/fs.ts
6067
- import { promises as fs4 } from "fs";
6091
+ import { promises as fs5 } from "fs";
6068
6092
  async function readJSON(path4) {
6069
- const fileContents = await fs4.readFile(path4, "utf-8");
6093
+ const fileContents = await fs5.readFile(path4, "utf-8");
6070
6094
  return JSON.parse(fileContents);
6071
6095
  }
6072
6096
  async function tryReadJSON(path4, missingValue = null) {
6073
6097
  try {
6074
- const stat = await fs4.stat(path4);
6098
+ const stat = await fs5.stat(path4);
6075
6099
  return stat.isFile() ? await readJSON(path4) : missingValue;
6076
6100
  } catch (e) {
6077
6101
  return missingValue;
@@ -6134,29 +6158,12 @@ First found was: v${firstVersion}`;
6134
6158
  // src/index.ts
6135
6159
  dotenv.config();
6136
6160
  var yarggery = yargs22(hideBin(process.argv));
6137
- var moduleName = "uniform";
6138
- var syncCosmicExplorer = cosmiconfigSync("uniform", {
6139
- searchPlaces: [`${moduleName}.config.js`, `${moduleName}.config.ts`, `${moduleName}.config.json`],
6140
- loaders: {
6141
- ".ts": TypeScriptLoader()
6142
- }
6143
- });
6144
- var searchedForm = syncCosmicExplorer.search();
6145
- var cosmicConfig = applyDefaultSyncConfiguration((searchedForm == null ? void 0 : searchedForm.config) ?? {});
6161
+ var inlineConfigurationFilePath = "config" in yarggery.argv && yarggery.argv.config;
6162
+ var configuration = loadConfig(inlineConfigurationFilePath || null);
6146
6163
  yarggery.option("verbose", {
6147
6164
  describe: "Include verbose logging",
6148
6165
  default: false,
6149
6166
  type: "boolean"
6150
- }).scriptName("uniform").config(cosmicConfig).config("config", function(configPath) {
6151
- if (!fs5.existsSync(configPath)) {
6152
- throw new Error(`Invalid configuration file path: ${configPath}. File does not exist.`);
6153
- }
6154
- const config2 = syncCosmicExplorer.load(configPath);
6155
- if (!(config2 == null ? void 0 : config2.config.serialization)) {
6156
- throw new Error(
6157
- `Invalid configuration file: ${configPath}. Missing config.serialization configuration.`
6158
- );
6159
- }
6160
- const configuration = applyDefaultSyncConfiguration((config2 == null ? void 0 : config2.config) ?? {});
6161
- return { serialization: configuration.serialization };
6167
+ }).scriptName("uniform").config(configuration).config("config", function() {
6168
+ return {};
6162
6169
  }).command(CanvasCommand).command(ContextCommand).command(ProjectMapCommand).command(RedirectCommand).command(SyncCommand).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.40.1-alpha.16+810fa24de",
3
+ "version": "19.42.0",
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.40.1-alpha.16+810fa24de",
20
- "@uniformdev/context": "19.40.1-alpha.16+810fa24de",
21
- "@uniformdev/project-map": "19.40.1-alpha.16+810fa24de",
22
- "@uniformdev/redirect": "19.40.1-alpha.16+810fa24de",
19
+ "@uniformdev/canvas": "19.42.0",
20
+ "@uniformdev/context": "19.42.0",
21
+ "@uniformdev/project-map": "19.42.0",
22
+ "@uniformdev/redirect": "19.42.0",
23
23
  "colorette": "2.0.20",
24
24
  "cosmiconfig": "8.2.0",
25
25
  "cosmiconfig-typescript-loader": "5.0.0",
@@ -62,5 +62,5 @@
62
62
  "publishConfig": {
63
63
  "access": "public"
64
64
  },
65
- "gitHead": "810fa24de01ecdc5411e39456f2b5341db908cb0"
65
+ "gitHead": "33ed87d09bfb50c8557c6bcf4eb232c76f7c99d8"
66
66
  }