@quilted/create 0.1.31 → 0.1.32

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.
@@ -164,7 +164,7 @@ async function pLocate(
164
164
  {
165
165
  concurrency = Number.POSITIVE_INFINITY,
166
166
  preserveOrder = true,
167
- },
167
+ } = {},
168
168
  ) {
169
169
  const limit = pLimit(concurrency);
170
170
 
@@ -255,7 +255,7 @@ const toPath = urlOrPath => urlOrPath instanceof URL ? fileURLToPath(urlOrPath)
255
255
 
256
256
  const findUpStop = Symbol('findUpStop');
257
257
 
258
- async function findUpMultiple(name, options) {
258
+ async function findUpMultiple(name, options = {}) {
259
259
  let directory = path__default.resolve(toPath(options.cwd) || '');
260
260
  const {root} = path__default.parse(directory);
261
261
  const stopAt = path__default.resolve(directory, options.stopAt || root);
@@ -299,7 +299,7 @@ async function findUpMultiple(name, options) {
299
299
  return matches;
300
300
  }
301
301
 
302
- function findUpMultipleSync(name, options) {
302
+ function findUpMultipleSync(name, options = {}) {
303
303
  let directory = path__default.resolve(toPath(options.cwd) || '');
304
304
  const {root} = path__default.parse(directory);
305
305
  const stopAt = options.stopAt || root;
@@ -342,12 +342,12 @@ function findUpMultipleSync(name, options) {
342
342
  return matches;
343
343
  }
344
344
 
345
- async function findUp(name, options) {
345
+ async function findUp(name, options = {}) {
346
346
  const matches = await findUpMultiple(name, {...options, limit: 1});
347
347
  return matches[0];
348
348
  }
349
349
 
350
- function findUpSync(name, options) {
350
+ function findUpSync(name, options = {}) {
351
351
  const matches = findUpMultipleSync(name, {...options, limit: 1});
352
352
  return matches[0];
353
353
  }
@@ -579,7 +579,7 @@ var anchors$2 = anchors$3;
579
579
  var visit$2 = visit$6;
580
580
  var Node$p = Node$t;
581
581
 
582
- class Alias$4 extends Node$p.NodeBase {
582
+ let Alias$4 = class Alias extends Node$p.NodeBase {
583
583
  constructor(source) {
584
584
  super(Node$p.ALIAS);
585
585
  this.source = source;
@@ -644,7 +644,7 @@ class Alias$4 extends Node$p.NodeBase {
644
644
  }
645
645
  return src;
646
646
  }
647
- }
647
+ };
648
648
  function getAliasCount(doc, node, anchors) {
649
649
  if (Node$p.isAlias(node)) {
650
650
  const source = node.resolve(doc);
@@ -720,7 +720,7 @@ var Node$n = Node$t;
720
720
  var toJS$4 = toJS$6;
721
721
 
722
722
  const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
723
- class Scalar$j extends Node$n.NodeBase {
723
+ let Scalar$j = class Scalar extends Node$n.NodeBase {
724
724
  constructor(value) {
725
725
  super(Node$n.SCALAR);
726
726
  this.value = value;
@@ -731,7 +731,7 @@ class Scalar$j extends Node$n.NodeBase {
731
731
  toString() {
732
732
  return String(this.value);
733
733
  }
734
- }
734
+ };
735
735
  Scalar$j.BLOCK_FOLDED = 'BLOCK_FOLDED';
736
736
  Scalar$j.BLOCK_LITERAL = 'BLOCK_LITERAL';
737
737
  Scalar$j.PLAIN = 'PLAIN';
@@ -857,7 +857,7 @@ function collectionFromPath(schema, path, value) {
857
857
  // as it does not cover untypable empty non-string iterables (e.g. []).
858
858
  const isEmptyPath = (path) => path == null ||
859
859
  (typeof path === 'object' && !!path[Symbol.iterator]().next().done);
860
- class Collection$4 extends Node$l.NodeBase {
860
+ let Collection$4 = class Collection extends Node$l.NodeBase {
861
861
  constructor(type, schema) {
862
862
  super(type);
863
863
  Object.defineProperty(this, 'schema', {
@@ -970,7 +970,7 @@ class Collection$4 extends Node$l.NodeBase {
970
970
  throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
971
971
  }
972
972
  }
973
- }
973
+ };
974
974
  Collection$4.maxFlowStringSingleLineLength = 60;
975
975
 
976
976
  Collection$5.Collection = Collection$4;
@@ -1851,7 +1851,7 @@ function createPair(key, value, ctx) {
1851
1851
  const v = createNode$2.createNode(value, undefined, ctx);
1852
1852
  return new Pair$8(k, v);
1853
1853
  }
1854
- class Pair$8 {
1854
+ let Pair$8 = class Pair {
1855
1855
  constructor(key, value = null) {
1856
1856
  Object.defineProperty(this, Node$h.NODE_TYPE, { value: Node$h.PAIR });
1857
1857
  this.key = key;
@@ -1874,7 +1874,7 @@ class Pair$8 {
1874
1874
  ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)
1875
1875
  : JSON.stringify(this);
1876
1876
  }
1877
- }
1877
+ };
1878
1878
 
1879
1879
  Pair$9.Pair = Pair$8;
1880
1880
  Pair$9.createPair = createPair;
@@ -2058,7 +2058,7 @@ function findPair(items, key) {
2058
2058
  }
2059
2059
  return undefined;
2060
2060
  }
2061
- class YAMLMap$6 extends Collection$2.Collection {
2061
+ let YAMLMap$6 = class YAMLMap extends Collection$2.Collection {
2062
2062
  constructor(schema) {
2063
2063
  super(Node$f.MAP, schema);
2064
2064
  this.items = [];
@@ -2152,7 +2152,7 @@ class YAMLMap$6 extends Collection$2.Collection {
2152
2152
  onComment
2153
2153
  });
2154
2154
  }
2155
- }
2155
+ };
2156
2156
 
2157
2157
  YAMLMap$7.YAMLMap = YAMLMap$6;
2158
2158
  YAMLMap$7.findPair = findPair;
@@ -2210,7 +2210,7 @@ var Node$d = Node$t;
2210
2210
  var Scalar$d = Scalar$k;
2211
2211
  var toJS$2 = toJS$6;
2212
2212
 
2213
- class YAMLSeq$6 extends Collection$1.Collection {
2213
+ let YAMLSeq$6 = class YAMLSeq extends Collection$1.Collection {
2214
2214
  constructor(schema) {
2215
2215
  super(Node$d.SEQ, schema);
2216
2216
  this.items = [];
@@ -2290,7 +2290,7 @@ class YAMLSeq$6 extends Collection$1.Collection {
2290
2290
  onComment
2291
2291
  });
2292
2292
  }
2293
- }
2293
+ };
2294
2294
  function asItemIndex(key) {
2295
2295
  let idx = Node$d.isScalar(key) ? key.value : key;
2296
2296
  if (idx && typeof idx === 'string')
@@ -3323,7 +3323,7 @@ var string = string$5;
3323
3323
  var tags = tags$1;
3324
3324
 
3325
3325
  const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
3326
- class Schema$2 {
3326
+ let Schema$2 = class Schema {
3327
3327
  constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
3328
3328
  this.compat = Array.isArray(compat)
3329
3329
  ? tags.getTags(compat, 'compat')
@@ -3351,7 +3351,7 @@ class Schema$2 {
3351
3351
  copy.tags = this.tags.slice();
3352
3352
  return copy;
3353
3353
  }
3354
- }
3354
+ };
3355
3355
 
3356
3356
  Schema$3.Schema = Schema$2;
3357
3357
 
@@ -3513,7 +3513,7 @@ var applyReviver = applyReviver$2;
3513
3513
  var createNode = createNode$5;
3514
3514
  var directives$1 = directives$2;
3515
3515
 
3516
- class Document$4 {
3516
+ let Document$4 = class Document {
3517
3517
  constructor(value, replacer, options) {
3518
3518
  /** A comment before this Document */
3519
3519
  this.commentBefore = null;
@@ -3824,7 +3824,7 @@ class Document$4 {
3824
3824
  }
3825
3825
  return stringifyDocument.stringifyDocument(this, options);
3826
3826
  }
3827
- }
3827
+ };
3828
3828
  function assertCollection(contents) {
3829
3829
  if (Node$6.isCollection(contents))
3830
3830
  return true;
@@ -3835,7 +3835,7 @@ Document$5.Document = Document$4;
3835
3835
 
3836
3836
  var errors$4 = {};
3837
3837
 
3838
- class YAMLError$1 extends Error {
3838
+ let YAMLError$1 = class YAMLError extends Error {
3839
3839
  constructor(name, pos, code, message) {
3840
3840
  super();
3841
3841
  this.name = name;
@@ -3843,17 +3843,17 @@ class YAMLError$1 extends Error {
3843
3843
  this.message = message;
3844
3844
  this.pos = pos;
3845
3845
  }
3846
- }
3847
- class YAMLParseError$1 extends YAMLError$1 {
3846
+ };
3847
+ let YAMLParseError$1 = class YAMLParseError extends YAMLError$1 {
3848
3848
  constructor(pos, code, message) {
3849
3849
  super('YAMLParseError', pos, code, message);
3850
3850
  }
3851
- }
3852
- class YAMLWarning$1 extends YAMLError$1 {
3851
+ };
3852
+ let YAMLWarning$1 = class YAMLWarning extends YAMLError$1 {
3853
3853
  constructor(pos, code, message) {
3854
3854
  super('YAMLWarning', pos, code, message);
3855
3855
  }
3856
- }
3856
+ };
3857
3857
  const prettifyError = (src, lc) => (error) => {
3858
3858
  if (error.pos[0] === -1)
3859
3859
  return;
@@ -5298,7 +5298,7 @@ function parsePrelude(prelude) {
5298
5298
  * const docs = new Composer().compose(tokens)
5299
5299
  * ```
5300
5300
  */
5301
- class Composer$1 {
5301
+ let Composer$1 = class Composer {
5302
5302
  constructor(options = {}) {
5303
5303
  this.doc = null;
5304
5304
  this.atDirectives = false;
@@ -5460,7 +5460,7 @@ class Composer$1 {
5460
5460
  yield doc;
5461
5461
  }
5462
5462
  }
5463
- }
5463
+ };
5464
5464
 
5465
5465
  composer$2.Composer = Composer$1;
5466
5466
 
@@ -6063,7 +6063,7 @@ const isNotAnchorChar = (ch) => !ch || invalidAnchorChars.includes(ch);
6063
6063
  * - `\x1f` (Unit Separator): Next token is a scalar value
6064
6064
  * - `\u{FEFF}` (Byte order mark): Emitted separately outside documents
6065
6065
  */
6066
- class Lexer$1 {
6066
+ let Lexer$1 = class Lexer {
6067
6067
  constructor() {
6068
6068
  /**
6069
6069
  * Flag indicating whether the end of the current buffer marks the end of
@@ -6660,7 +6660,7 @@ class Lexer$1 {
6660
6660
  ch = this.buffer[++i];
6661
6661
  return yield* this.pushToIndex(i, false);
6662
6662
  }
6663
- }
6663
+ };
6664
6664
 
6665
6665
  lexer$2.Lexer = Lexer$1;
6666
6666
 
@@ -6671,7 +6671,7 @@ var lineCounter$2 = {};
6671
6671
  * determining the one-indexed `{ line, col }` position for any offset
6672
6672
  * within the input.
6673
6673
  */
6674
- class LineCounter$1 {
6674
+ let LineCounter$1 = class LineCounter {
6675
6675
  constructor() {
6676
6676
  this.lineStarts = [];
6677
6677
  /**
@@ -6702,7 +6702,7 @@ class LineCounter$1 {
6702
6702
  return { line: low, col: offset - start + 1 };
6703
6703
  };
6704
6704
  }
6705
- }
6705
+ };
6706
6706
 
6707
6707
  lineCounter$2.LineCounter = LineCounter$1;
6708
6708
 
@@ -6827,7 +6827,7 @@ function fixFlowSeqItems(fc) {
6827
6827
  * }
6828
6828
  * ```
6829
6829
  */
6830
- class Parser$1 {
6830
+ let Parser$1 = class Parser {
6831
6831
  /**
6832
6832
  * @param onNewLine - If defined, called separately with the start position of
6833
6833
  * each new line (in `parse()`, including the start of input).
@@ -7657,7 +7657,7 @@ class Parser$1 {
7657
7657
  yield* this.pop();
7658
7658
  }
7659
7659
  }
7660
- }
7660
+ };
7661
7661
 
7662
7662
  parser$2.Parser = Parser$1;
7663
7663
 
@@ -7817,7 +7817,6 @@ var visitAsync = dist.visitAsync = visit.visitAsync;
7817
7817
 
7818
7818
  var index = /*#__PURE__*/_mergeNamespaces({
7819
7819
  __proto__: null,
7820
- 'default': dist,
7821
7820
  Composer: Composer,
7822
7821
  Document: Document_1,
7823
7822
  Schema: Schema_1,
@@ -7846,7 +7845,8 @@ var index = /*#__PURE__*/_mergeNamespaces({
7846
7845
  parseDocument: parseDocument,
7847
7846
  stringify: stringify,
7848
7847
  visit: visit_1,
7849
- visitAsync: visitAsync
7848
+ visitAsync: visitAsync,
7849
+ 'default': dist
7850
7850
  }, [dist]);
7851
7851
 
7852
7852
  export { index as i };
@@ -3,43 +3,34 @@ import * as path from 'node:path';
3
3
  import { s as stripIndent, c as cyan_1, p as printHelp, b as bold_1, d as dim_1, u as underline_1, m as magenta_1, e as parseArguments, a as prompt } from './index.mjs';
4
4
  import { g as getCreateAsMonorepo, a as getShouldInstall, d as getPackageManager, e as getExtrasToSetup, t as toValidPackageName, f as emptyDirectory, h as format, m as mergeDependencies, l as loadTemplate, i as addToTsConfig, j as addToPackageManagerWorkspaces, r as relativeDirectoryForDisplay, o as isEmpty, p as createOutputTarget } from './shared/package-manager.mjs';
5
5
  import 'node:tty';
6
- import 'node:url';
7
6
  import 'node:readline';
8
7
  import 'node:events';
9
8
  import 'node:child_process';
9
+ import 'node:url';
10
10
 
11
- let _ = t => t,
12
- _t,
13
- _t2,
14
- _t3,
15
- _t4;
16
11
  async function createProject() {
17
12
  const args = getArguments();
18
-
19
13
  if (args['--help']) {
20
- var _args$PackageManag;
21
-
22
- const additionalOptions = stripIndent(_t || (_t = _`
23
- ${0}, ${0}
14
+ const additionalOptions = stripIndent`
15
+ ${cyan_1(`--react`)}, ${cyan_1(`--no-react`)}
24
16
  Whether this package will use React. If you don’t provide this option, the command
25
17
  will ask you about it later.
26
18
 
27
- ${0}, ${0}
19
+ ${cyan_1(`--public`)}, ${cyan_1(`--private`)}
28
20
  Whether this package will be published for other projects to install. If you do not
29
21
  provide this option, the command will ask you about it later.
30
22
 
31
- ${0}
23
+ ${cyan_1(`--registry`)}
32
24
  The package registry to publish this package to. This option only applies if you create
33
25
  a public package. If you do not provide this option, it will use the default NPM registry.
34
- `), cyan_1(`--react`), cyan_1(`--no-react`), cyan_1(`--public`), cyan_1(`--private`), cyan_1(`--registry`));
26
+ `;
35
27
  printHelp({
36
28
  kind: 'package',
37
29
  options: additionalOptions,
38
- packageManager: (_args$PackageManag = args['--package-manager']) === null || _args$PackageManag === void 0 ? void 0 : _args$PackageManag.toLowerCase()
30
+ packageManager: args['--package-manager']?.toLowerCase()
39
31
  });
40
32
  return;
41
33
  }
42
-
43
34
  const inWorkspace = fs.existsSync('quilt.workspace.ts');
44
35
  const name = await getName(args);
45
36
  const directory = await getDirectory(args, {
@@ -58,10 +49,8 @@ async function createProject() {
58
49
  });
59
50
  const partOfMonorepo = inWorkspace || createAsMonorepo;
60
51
  const packageDirectory = createAsMonorepo ? path.join(directory, `packages/${toValidPackageName(name.split('/').pop())}`) : directory;
61
-
62
52
  if (fs.existsSync(directory)) {
63
53
  await emptyDirectory(directory);
64
-
65
54
  if (packageDirectory !== directory) {
66
55
  fs.mkdirSync(packageDirectory, {
67
56
  recursive: true
@@ -72,27 +61,28 @@ async function createProject() {
72
61
  recursive: true
73
62
  });
74
63
  }
75
-
76
64
  const rootDirectory = inWorkspace ? process.cwd() : directory;
77
65
  const outputRoot = createOutputTarget(rootDirectory);
78
66
  const packageTemplate = loadTemplate('package');
79
67
  const workspaceTemplate = loadTemplate('workspace');
80
- let quiltProject = await packageTemplate.read('quilt.project.ts'); // If we aren’t already in a workspace, copy the workspace files over, which
81
- // are needed if we are making a monorepo or not.
68
+ let quiltProject = await packageTemplate.read('quilt.project.ts');
82
69
 
70
+ // If we aren’t already in a workspace, copy the workspace files over, which
71
+ // are needed if we are making a monorepo or not.
83
72
  if (!inWorkspace) {
84
73
  await workspaceTemplate.copy(directory, file => {
85
74
  // When this is a single project, we use the project’s Quilt configuration as the base.
86
- if (file === 'quilt.workspace.ts') return createAsMonorepo; // We need to make some adjustments to the root package.json
75
+ if (file === 'quilt.workspace.ts') return createAsMonorepo;
87
76
 
77
+ // We need to make some adjustments to the root package.json
88
78
  return file !== 'package.json';
89
- }); // If we are creating a monorepo, we need to add the root package.json and
90
- // package manager workspace configuration.
79
+ });
91
80
 
81
+ // If we are creating a monorepo, we need to add the root package.json and
82
+ // package manager workspace configuration.
92
83
  if (createAsMonorepo) {
93
84
  const workspacePackageJson = JSON.parse(await workspaceTemplate.read('package.json'));
94
85
  workspacePackageJson.name = toValidPackageName(name);
95
-
96
86
  if (packageManager.type === 'pnpm') {
97
87
  await outputRoot.write('pnpm-workspace.yaml', await format(`
98
88
  packages:
@@ -103,7 +93,6 @@ async function createProject() {
103
93
  } else {
104
94
  workspacePackageJson.workspaces = ['packages/*'];
105
95
  }
106
-
107
96
  await outputRoot.write('package.json', await format(JSON.stringify(workspacePackageJson), {
108
97
  as: 'json-stringify'
109
98
  }));
@@ -111,21 +100,20 @@ async function createProject() {
111
100
  const [projectPackageJson, projectTSConfig, workspacePackageJson] = await Promise.all([packageTemplate.read('package.json').then(content => JSON.parse(content)), packageTemplate.read('tsconfig.json').then(content => JSON.parse(content)), workspaceTemplate.read('package.json').then(content => JSON.parse(content))]);
112
101
  workspacePackageJson.eslintConfig = projectPackageJson.eslintConfig;
113
102
  workspacePackageJson.browserslist = projectPackageJson.browserslist;
114
- const newPackageJson = {}; // We want to put the project’s dependencies in the package.json, respecting
115
- // the preferred ordering (dependencies, peer dependencies, dev dependencies).
103
+ const newPackageJson = {};
116
104
 
105
+ // We want to put the project’s dependencies in the package.json, respecting
106
+ // the preferred ordering (dependencies, peer dependencies, dev dependencies).
117
107
  for (const [key, value] of Object.entries(projectPackageJson)) {
118
108
  if (key !== 'devDependencies') {
119
109
  newPackageJson[key] = value;
120
110
  continue;
121
111
  }
122
-
123
112
  newPackageJson.dependencies = projectPackageJson.dependencies;
124
113
  newPackageJson.peerDependencies = projectPackageJson.peerDependencies;
125
114
  newPackageJson.peerDependenciesMeta = projectPackageJson.peerDependenciesMeta;
126
115
  newPackageJson.devDependencies = mergeDependencies(workspacePackageJson.devDependencies, projectPackageJson.devDependencies);
127
116
  }
128
-
129
117
  adjustPackageJson(newPackageJson, {
130
118
  name: toValidPackageName(name),
131
119
  react: useReact,
@@ -143,26 +131,22 @@ async function createProject() {
143
131
  as: 'json'
144
132
  }));
145
133
  }
146
-
147
134
  if (setupExtras.has('github')) {
148
135
  await loadTemplate('github').copy(directory);
149
136
  }
150
-
151
137
  if (setupExtras.has('vscode')) {
152
138
  await loadTemplate('vscode').copy(directory);
153
139
  }
154
140
  }
155
-
156
141
  await packageTemplate.copy(packageDirectory, file => {
157
142
  // If we are in a monorepo, we can use all the template files as they are
158
143
  if (file === 'tsconfig.json') {
159
144
  return partOfMonorepo;
160
- } // We need to make some adjustments the project’s package.json and Quilt config
161
-
145
+ }
162
146
 
147
+ // We need to make some adjustments the project’s package.json and Quilt config
163
148
  return file !== 'package.json' && file !== 'quilt.project.ts';
164
149
  });
165
-
166
150
  if (partOfMonorepo) {
167
151
  // Write the package’s package.json (the root one was already created)
168
152
  const projectPackageJson = JSON.parse(await packageTemplate.read('package.json'));
@@ -179,64 +163,59 @@ async function createProject() {
179
163
  await outputRoot.write(path.join(packageDirectory, 'quilt.project.ts'), quiltProject);
180
164
  await Promise.all([addToTsConfig(packageDirectory, outputRoot), addToPackageManagerWorkspaces(packageDirectory, outputRoot, packageManager.type)]);
181
165
  }
182
-
183
166
  if (shouldInstall) {
184
- process.stdout.write('\nInstalling dependencies...\n'); // TODO: better loading, handle errors
185
-
167
+ process.stdout.write('\nInstalling dependencies...\n');
168
+ // TODO: better loading, handle errors
186
169
  await packageManager.install();
187
170
  process.stdout.moveCursor(0, -1);
188
171
  process.stdout.clearLine(1);
189
172
  console.log('Installed dependencies.');
190
173
  }
191
-
192
- const packageJsonInstructions = stripIndent(_t2 || (_t2 = _`
174
+ const packageJsonInstructions = stripIndent`
193
175
  Your new package is ready to go! However, before you go too much further,
194
- you should update the following fields in ${0}:
176
+ you should update the following fields in ${cyan_1(relativeDirectoryForDisplay(path.relative(process.cwd(), path.join(packageDirectory, 'package.json'))))}:
195
177
 
196
- - ${0}, where you provide a description of what your package does
197
- - ${0}, where you should include the ${0} of your project’s repo
178
+ - ${bold_1(`"description"`)}, where you provide a description of what your package does
179
+ - ${bold_1(`"repository"`)}, where you should include the ${bold_1(`"url"`)} of your project’s repo
198
180
 
199
- Before you publish your package, you will also want to update the ${0}
181
+ Before you publish your package, you will also want to update the ${bold_1(`"version"`)}
200
182
  field in the package.json file.
201
- `), cyan_1(relativeDirectoryForDisplay(path.relative(process.cwd(), path.join(packageDirectory, 'package.json')))), bold_1(`"description"`), bold_1(`"repository"`), bold_1(`"url"`), bold_1(`"version"`));
183
+ `;
202
184
  console.log();
203
185
  console.log(packageJsonInstructions);
204
186
  const commands = [];
205
-
206
187
  if (!inWorkspace && directory !== process.cwd()) {
207
188
  commands.push(`cd ${cyan_1(relativeDirectoryForDisplay(path.relative(process.cwd(), directory)))} ${dim_1('# Move into your new package’s directory')}`);
208
189
  }
209
-
210
190
  if (!shouldInstall) {
211
191
  commands.push(`${packageManager.commands.install()} ${dim_1('# Install all your dependencies')}`);
212
192
  }
213
-
214
193
  if (!inWorkspace) {
215
194
  // TODO: change this condition to check if git was initialized already
216
195
  commands.push(`git init && git add -A && git commit -m "Initial commit" ${dim_1('# Start your git history (optional)')}`);
217
196
  }
218
-
219
197
  if (commands.length > 0) {
220
- const whatsNext = stripIndent(_t3 || (_t3 = _`
221
- After you update your package.json, there’s ${0} you’ll need to take
198
+ const whatsNext = stripIndent`
199
+ After you update your package.json, there’s ${commands.length > 1 ? 'a few more steps' : 'one more step'} you’ll need to take
222
200
  in order to start building:
223
- `), commands.length > 1 ? 'a few more steps' : 'one more step');
201
+ `;
224
202
  console.log();
225
203
  console.log(whatsNext);
226
204
  console.log();
227
205
  console.log(commands.map(command => ` ${command}`).join('\n'));
228
206
  }
229
-
230
- const followUp = stripIndent(_t4 || (_t4 = _`
207
+ const followUp = stripIndent`
231
208
  Quilt can help you build, test, lint, and type-check your new package. You
232
209
  can learn more about building packages with Quilt by reading the documentation:
233
- ${0}
210
+ ${underline_1(magenta_1('https://github.com/lemonmade/quilt/tree/main/documentation'))}
234
211
 
235
212
  Have fun! 🎉
236
- `), underline_1(magenta_1('https://github.com/lemonmade/quilt/tree/main/documentation')));
213
+ `;
237
214
  console.log();
238
215
  console.log(followUp);
239
- } // Argument handling
216
+ }
217
+
218
+ // Argument handling
240
219
 
241
220
  function getArguments() {
242
221
  const args = parseArguments({
@@ -263,12 +242,10 @@ function getArguments() {
263
242
  });
264
243
  return args;
265
244
  }
266
-
267
245
  async function getName(args) {
268
246
  let {
269
247
  '--name': name
270
248
  } = args;
271
-
272
249
  if (name == null) {
273
250
  name = await prompt({
274
251
  type: 'text',
@@ -276,16 +253,13 @@ async function getName(args) {
276
253
  initial: '@my-team/package'
277
254
  });
278
255
  }
279
-
280
256
  return name;
281
257
  }
282
-
283
258
  async function getDirectory(args, {
284
259
  name,
285
260
  inWorkspace
286
261
  }) {
287
262
  let directory = args['--directory'] ? path.resolve(args['--directory']) : undefined;
288
-
289
263
  if (directory == null) {
290
264
  const basePackageName = toValidPackageName(name.split('/').pop());
291
265
  const defaultDirectory = inWorkspace ? `packages/${basePackageName}` : basePackageName;
@@ -295,7 +269,6 @@ async function getDirectory(args, {
295
269
  initial: defaultDirectory
296
270
  }));
297
271
  }
298
-
299
272
  while (!args['--yes']) {
300
273
  if (fs.existsSync(directory) && !(await isEmpty(directory))) {
301
274
  const relativeDirectory = path.relative(process.cwd(), directory);
@@ -314,13 +287,10 @@ async function getDirectory(args, {
314
287
  break;
315
288
  }
316
289
  }
317
-
318
290
  return directory;
319
291
  }
320
-
321
292
  async function getPublic(args) {
322
293
  let isPublic;
323
-
324
294
  if (args['--public'] || args['--yes']) {
325
295
  isPublic = true;
326
296
  } else if (args['--private']) {
@@ -332,13 +302,10 @@ async function getPublic(args) {
332
302
  initial: true
333
303
  });
334
304
  }
335
-
336
305
  return isPublic;
337
306
  }
338
-
339
307
  async function getReact(args) {
340
308
  let useReact;
341
-
342
309
  if (args['--react'] || args['--yes']) {
343
310
  useReact = true;
344
311
  } else if (args['--no-react']) {
@@ -350,10 +317,8 @@ async function getReact(args) {
350
317
  initial: true
351
318
  });
352
319
  }
353
-
354
320
  return useReact;
355
321
  }
356
-
357
322
  function adjustPackageJson(packageJson, {
358
323
  name,
359
324
  react,
@@ -363,20 +328,17 @@ function adjustPackageJson(packageJson, {
363
328
  packageJson.name = name;
364
329
  const packageParts = name.split('/');
365
330
  const scope = packageParts[0].startsWith('@') ? packageParts[0] : undefined;
366
- const finalRegistry = registry !== null && registry !== void 0 ? registry : 'https://registry.npmjs.org';
367
-
331
+ const finalRegistry = registry ?? 'https://registry.npmjs.org';
368
332
  if (scope) {
369
333
  packageJson.publishConfig[`${scope}/registry`] = finalRegistry;
370
334
  } else if (registry) {
371
335
  packageJson.publishConfig.registry = finalRegistry;
372
336
  }
373
-
374
337
  if (isPublic) {
375
338
  delete packageJson.private;
376
339
  } else {
377
340
  delete packageJson.publishConfig;
378
341
  }
379
-
380
342
  if (!react) {
381
343
  delete packageJson.dependencies['@types/react'];
382
344
  delete packageJson.devDependencies['react'];
@@ -384,7 +346,6 @@ function adjustPackageJson(packageJson, {
384
346
  delete packageJson.peerDependenciesMeta['react'];
385
347
  packageJson.eslintConfig.extends = packageJson.eslintConfig.extends.filter(extend => !extend.includes('react'));
386
348
  }
387
-
388
349
  return packageJson;
389
350
  }
390
351