@quilted/create 0.1.19 → 0.1.22

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.
@@ -5,6 +5,12 @@ import 'url';
5
5
  import require$$0$1 from 'readline';
6
6
  import require$$2 from 'events';
7
7
 
8
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
9
+
10
+ function getDefaultExportFromCjs (x) {
11
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
12
+ }
13
+
8
14
  const flagSymbol = Symbol('arg flag');
9
15
 
10
16
  class ArgError extends Error {
@@ -778,88 +784,117 @@ var stripIndent = new TemplateTag(stripIndentTransformer, trimResultTransformer)
778
784
 
779
785
  new TemplateTag(stripIndentTransformer('all'), trimResultTransformer);
780
786
 
787
+ var defineProperty = {exports: {}};
788
+
789
+ (function (module) {
790
+ function _defineProperty(obj, key, value) {
791
+ if (key in obj) {
792
+ Object.defineProperty(obj, key, {
793
+ value: value,
794
+ enumerable: true,
795
+ configurable: true,
796
+ writable: true
797
+ });
798
+ } else {
799
+ obj[key] = value;
800
+ }
801
+
802
+ return obj;
803
+ }
804
+
805
+ module.exports = _defineProperty, module.exports.__esModule = true, module.exports["default"] = module.exports;
806
+ }(defineProperty));
807
+
808
+ var _defineProperty$1 = /*@__PURE__*/getDefaultExportFromCjs(defineProperty.exports);
809
+
781
810
  class AbortError extends Error {
782
811
  static test(error) {
783
812
  return error != null && error.code === 'ABORT_ERR';
784
813
  }
785
814
 
786
- code = 'ABORT_ERR';
787
- name = 'AbortError';
788
-
789
815
  constructor(message = 'The operation was aborted') {
790
816
  super(message);
817
+
818
+ _defineProperty$1(this, "code", 'ABORT_ERR');
819
+
820
+ _defineProperty$1(this, "name", 'AbortError');
791
821
  }
792
822
 
793
823
  }
794
824
 
825
+ let _$1 = t => t,
826
+ _t$1,
827
+ _t2,
828
+ _t3,
829
+ _t4;
795
830
  function printHelp({
796
831
  kind,
797
832
  options: customOptions,
798
833
  packageManager
799
834
  }) {
800
835
  const command = createCommand(packageManager);
801
- const usage = stripIndent`
802
- ${bold_1('Usage:')} ${command} ${kind ? magenta_1(kind) : magenta_1('[kind]')} ${green_1('[name]')} ${cyan_1('[options]')}
803
- `;
836
+ const usage = stripIndent(_t$1 || (_t$1 = _$1`
837
+ ${0} ${0} ${0} ${0} ${0}
838
+ `), bold_1('Usage:'), command, kind ? magenta_1(kind) : magenta_1('[kind]'), green_1('[name]'), cyan_1('[options]'));
804
839
  console.log(usage);
805
- const example = stripIndent`
806
- ${bold_1('Example:')} ${command} ${magenta_1(kind ?? 'app')} ${green_1(`my-${kind ?? 'app'}`)} ${cyan_1('--install')}
807
- `;
840
+ const example = stripIndent(_t2 || (_t2 = _$1`
841
+ ${0} ${0} ${0} ${0} ${0}
842
+ `), bold_1('Example:'), command, magenta_1(kind !== null && kind !== void 0 ? kind : 'app'), green_1(`my-${kind !== null && kind !== void 0 ? kind : 'app'}`), cyan_1('--install'));
808
843
  console.log(dim_1(example));
809
844
 
810
845
  if (!kind) {
811
- const kindSection = stripIndent`
812
- ${bold_1(magenta_1('kind'))} can be one of the following project types:
846
+ const kindSection = stripIndent(_t3 || (_t3 = _$1`
847
+ ${0} can be one of the following project types:
813
848
 
814
- - ${magenta_1('app')}, a web application
815
- - ${magenta_1('package')}, a shared library of code
849
+ - ${0}, a web application
850
+ - ${0}, a shared library of code
816
851
 
817
852
  You’ll be asked a few additional questions based on the kind you choose.
818
- `;
853
+ `), bold_1(magenta_1('kind')), magenta_1('app'), magenta_1('package'));
819
854
  console.log();
820
855
  console.log(kindSection);
821
856
  }
822
857
 
823
- const optionsSection = stripIndent`
824
- ${cyan_1('--name')}
858
+ const optionsSection = stripIndent(_t4 || (_t4 = _$1`
859
+ ${0}
825
860
  The name of the project. When creating a package, you should use the public name you
826
- want for the package, including any scope you want to use (example: ${bold_1('@my-org/my-package')}).
861
+ want for the package, including any scope you want to use (example: ${0}).
827
862
  If you don’t provide a name with this flag, this command will ask you for one later.
828
863
 
829
- ${cyan_1('--directory')}
864
+ ${0}
830
865
  The directory to create the project in. If you don’t provide this flag, Quilt will pick
831
866
  a default directory based on the kind of the project and the name you provided.
832
867
 
833
- ${cyan_1(`--monorepo`)}, ${cyan_1(`--no-monorepo`)}
868
+ ${0}, ${0}
834
869
  If you aren’t already in a monorepo, this flag will create your new project with some
835
870
  additional structure that allows it to be a monorepo — that is, you will be able to add
836
871
  multiple projects to a single repository.
837
872
 
838
- ${cyan_1(`--install`)}, ${cyan_1(`--no-install`)}
873
+ ${0}, ${0}
839
874
  Whether to install dependencies in the newly created project. If you do not provide this
840
875
  flag, Quilt will ask you about it later.
841
876
 
842
- ${cyan_1('--package-manager')}
877
+ ${0}
843
878
  The package manager to use for your new project. This choice will be used to populate
844
- some commands, and will be used to install dependencies if the ${cyan_1('--install')} flag is set.
879
+ some commands, and will be used to install dependencies if the ${0} flag is set.
845
880
 
846
- Must be one of the following: ${bold_1('pnpm')}, ${bold_1('npm')}, or ${bold_1('yarn')}.
881
+ Must be one of the following: ${0}, ${0}, or ${0}.
847
882
 
848
- ${cyan_1(`--extras`)}, ${cyan_1(`--no-extras`)}
883
+ ${0}, ${0}
849
884
  Extra developer tools to configure when creating your new project. This option only
850
885
  applies when creating a brand new project, not when adding a project to an existing
851
886
  workspace. You can include this flag multiple times to add multiple tools. You can
852
887
  enable any of the following tools:
853
888
 
854
- - ${bold_1('github')}, which adds a continuous integration (CI) GitHub Action to your project.
855
- - ${bold_1('vscode')}, which adds some basic VSCode settings to your project.
889
+ - ${0}, which adds a continuous integration (CI) GitHub Action to your project.
890
+ - ${0}, which adds some basic VSCode settings to your project.
856
891
 
857
- ${cyan_1('--yes')}, ${cyan_1('-y')}
892
+ ${0}, ${0}
858
893
  Answers “yes” to any question this command would have asked.
859
894
 
860
- ${cyan_1('--help')}, ${cyan_1('-h')}
895
+ ${0}, ${0}
861
896
  Prints this help documentation.
862
- `;
897
+ `), cyan_1('--name'), bold_1('@my-org/my-package'), cyan_1('--directory'), cyan_1(`--monorepo`), cyan_1(`--no-monorepo`), cyan_1(`--install`), cyan_1(`--no-install`), cyan_1('--package-manager'), cyan_1('--install'), bold_1('pnpm'), bold_1('npm'), bold_1('yarn'), cyan_1(`--extras`), cyan_1(`--no-extras`), bold_1('github'), bold_1('vscode'), cyan_1('--yes'), cyan_1('-y'), cyan_1('--help'), cyan_1('-h'));
863
898
  console.log();
864
899
  console.log(`${bold_1(cyan_1('options'))} can include any of these flags:`);
865
900
 
@@ -877,8 +912,10 @@ function printOptionsSection(section) {
877
912
  }
878
913
 
879
914
  function createCommand(explicitPackageManager) {
915
+ var _process$env$npm_conf;
916
+
880
917
  let packageManager;
881
- const npmUserAgent = process.env['npm_config_user_agent'] ?? 'npm';
918
+ const npmUserAgent = (_process$env$npm_conf = process.env['npm_config_user_agent']) !== null && _process$env$npm_conf !== void 0 ? _process$env$npm_conf : 'npm';
882
919
 
883
920
  if (npmUserAgent.includes('pnpm') || explicitPackageManager === 'pnpm') {
884
921
  packageManager = 'pnpm';
@@ -6628,7 +6665,9 @@ async function getPackageManager(argv) {
6628
6665
  const explicitPackageManager = argv['--package-manager'].toLocaleLowerCase();
6629
6666
  packageManager = VALID_PACKAGE_MANAGERS.has(explicitPackageManager) ? explicitPackageManager : 'npm';
6630
6667
  } else {
6631
- const npmUserAgent = process.env['npm_config_user_agent'] ?? 'npm';
6668
+ var _process$env$npm_conf;
6669
+
6670
+ const npmUserAgent = (_process$env$npm_conf = process.env['npm_config_user_agent']) !== null && _process$env$npm_conf !== void 0 ? _process$env$npm_conf : 'npm';
6632
6671
 
6633
6672
  if (npmUserAgent.includes('pnpm') || fs.existsSync('pnpm-lock.yaml')) {
6634
6673
  packageManager = 'pnpm';
@@ -6667,7 +6706,8 @@ async function getExtrasToSetup(argv, {
6667
6706
  return extrasToSetup;
6668
6707
  }
6669
6708
 
6670
- /* eslint no-console: off */
6709
+ let _ = t => t,
6710
+ _t;
6671
6711
  const VALID_PROJECT_KINDS = new Set(['app', 'package']);
6672
6712
  run().catch(error => {
6673
6713
  if (AbortError.test(error)) return;
@@ -6676,6 +6716,8 @@ run().catch(error => {
6676
6716
  });
6677
6717
 
6678
6718
  async function run() {
6719
+ var _permissiveArgs$_$;
6720
+
6679
6721
  const permissiveArgs = arg_1({
6680
6722
  '--help': Boolean,
6681
6723
  '-h': '--help',
@@ -6683,7 +6725,7 @@ async function run() {
6683
6725
  }, {
6684
6726
  permissive: true
6685
6727
  });
6686
- const firstArgument = permissiveArgs._[0]?.toLowerCase();
6728
+ const firstArgument = (_permissiveArgs$_$ = permissiveArgs._[0]) === null || _permissiveArgs$_$ === void 0 ? void 0 : _permissiveArgs$_$.toLowerCase();
6687
6729
 
6688
6730
  if (firstArgument != null && !firstArgument.startsWith('-') && !VALID_PROJECT_KINDS.has(firstArgument)) {
6689
6731
  // TODO: show help with error message
@@ -6692,15 +6734,17 @@ async function run() {
6692
6734
  }
6693
6735
 
6694
6736
  let kind = firstArgument == null || !VALID_PROJECT_KINDS.has(firstArgument) ? undefined : firstArgument;
6695
- const header = stripIndent`
6696
- 🧵 ${bold_1('quilt create')}
6697
- `;
6737
+ const header = stripIndent(_t || (_t = _`
6738
+ 🧵 ${0}
6739
+ `), bold_1('quilt create'));
6698
6740
  console.log(header);
6699
6741
  console.log();
6700
6742
 
6701
6743
  if (permissiveArgs['--help'] && !kind) {
6744
+ var _permissiveArgs$Pac;
6745
+
6702
6746
  printHelp({
6703
- packageManager: permissiveArgs['--package-manager']?.toLowerCase()
6747
+ packageManager: (_permissiveArgs$Pac = permissiveArgs['--package-manager']) === null || _permissiveArgs$Pac === void 0 ? void 0 : _permissiveArgs$Pac.toLowerCase()
6704
6748
  });
6705
6749
  return;
6706
6750
  }
@@ -6732,12 +6776,12 @@ async function run() {
6732
6776
  case 'package':
6733
6777
  {
6734
6778
  const {
6735
- createPackage
6779
+ createProject
6736
6780
  } = await import('./package.mjs');
6737
- await createPackage();
6781
+ await createProject();
6738
6782
  break;
6739
6783
  }
6740
6784
  }
6741
6785
  }
6742
6786
 
6743
- export { getShouldInstall as a, bold_1 as b, cyan_1 as c, getPackageManager as d, getExtrasToSetup as e, dim_1 as f, getCreateAsMonorepo as g, arg_1 as h, prompt as i, magenta_1 as m, printHelp as p, stripIndent as s, underline_1 as u };
6787
+ export { getShouldInstall as a, bold_1 as b, cyan_1 as c, getPackageManager as d, getExtrasToSetup as e, dim_1 as f, getCreateAsMonorepo as g, arg_1 as h, prompt as i, getDefaultExportFromCjs as j, commonjsGlobal as k, magenta_1 as m, printHelp as p, stripIndent as s, underline_1 as u };
@@ -8,7 +8,9 @@ function loadTemplate(name) {
8
8
  let templateRootPromise;
9
9
  return {
10
10
  async copy(to, handleFile) {
11
- templateRootPromise ?? (templateRootPromise = templateDirectory(name));
11
+ var _templateRootPromise;
12
+
13
+ (_templateRootPromise = templateRootPromise) !== null && _templateRootPromise !== void 0 ? _templateRootPromise : templateRootPromise = templateDirectory(name);
12
14
  const templateRoot = await templateRootPromise;
13
15
  const targetRoot = path.resolve(to);
14
16
  const files = fs.readdirSync(templateRoot).filter(file => !path.basename(file).startsWith('.'));
@@ -26,7 +28,9 @@ function loadTemplate(name) {
26
28
  },
27
29
 
28
30
  async read(file) {
29
- templateRootPromise ?? (templateRootPromise = templateDirectory(name));
31
+ var _templateRootPromise2;
32
+
33
+ (_templateRootPromise2 = templateRootPromise) !== null && _templateRootPromise2 !== void 0 ? _templateRootPromise2 : templateRootPromise = templateDirectory(name);
30
34
  const templateRoot = await templateRootPromise;
31
35
  return fs.readFileSync(path.join(templateRoot, file), {
32
36
  encoding: 'utf8'
@@ -141,8 +145,10 @@ async function format(content, {
141
145
 
142
146
  const ENDS_WITH_TSCONFIG = /[/]?tsconfig[.a-z0-9]*[.]json/i;
143
147
  async function addToTsConfig(directory, output) {
148
+ var _tsconfig$references;
149
+
144
150
  const tsconfig = JSON.parse(await output.read('tsconfig.json'));
145
- tsconfig.references ?? (tsconfig.references = []);
151
+ (_tsconfig$references = tsconfig.references) !== null && _tsconfig$references !== void 0 ? _tsconfig$references : tsconfig.references = [];
146
152
  const relativePath = relative(output.root, directory);
147
153
  const relativeForDisplay = relativeDirectoryForDisplay(relativePath);
148
154
 
@@ -221,18 +227,22 @@ async function addToTsConfig(directory, output) {
221
227
 
222
228
  async function addToPackageManagerWorkspaces(directory, output, packageManager) {
223
229
  if (packageManager === 'pnpm') {
230
+ var _workspaceYaml$packag;
231
+
224
232
  const {
225
233
  parse,
226
234
  stringify
227
235
  } = await import('./index3.mjs').then(function (n) { return n.i; });
228
236
  const workspaceYaml = parse(await output.read('pnpm-workspace.yaml'));
229
- workspaceYaml.packages = await addToWorkspaces(relative(output.root, directory), workspaceYaml.packages ?? []);
237
+ workspaceYaml.packages = await addToWorkspaces(relative(output.root, directory), (_workspaceYaml$packag = workspaceYaml.packages) !== null && _workspaceYaml$packag !== void 0 ? _workspaceYaml$packag : []);
230
238
  await output.write('pnpm-workspace.yaml', await format(stringify(workspaceYaml), {
231
239
  as: 'yaml'
232
240
  }));
233
241
  } else {
242
+ var _packageJson$workspac;
243
+
234
244
  const packageJson = JSON.parse(await output.read('package.json'));
235
- packageJson.workspaces = await addToWorkspaces(relative(output.root, directory), packageJson.workspaces ?? []);
245
+ packageJson.workspaces = await addToWorkspaces(relative(output.root, directory), (_packageJson$workspac = packageJson.workspaces) !== null && _packageJson$workspac !== void 0 ? _packageJson$workspac : []);
236
246
  await output.write('package.json', await format(JSON.stringify(packageJson), {
237
247
  as: 'json-stringify'
238
248
  }));
@@ -8,27 +8,34 @@ import 'url';
8
8
  import 'readline';
9
9
  import 'events';
10
10
 
11
- async function createPackage() {
11
+ let _ = t => t,
12
+ _t,
13
+ _t2,
14
+ _t3,
15
+ _t4;
16
+ async function createProject() {
12
17
  const argv = getArgv();
13
18
 
14
19
  if (argv['--help']) {
15
- const additionalOptions = stripIndent`
16
- ${cyan_1(`--react`)}, ${cyan_1(`--no-react`)}
20
+ var _argv$PackageManag;
21
+
22
+ const additionalOptions = stripIndent(_t || (_t = _`
23
+ ${0}, ${0}
17
24
  Whether this package will use React. If you don’t provide this option, the command
18
25
  will ask you about it later.
19
26
 
20
- ${cyan_1(`--public`)}, ${cyan_1(`--private`)}
27
+ ${0}, ${0}
21
28
  Whether this package will be published for other projects to install. If you do not
22
29
  provide this option, the command will ask you about it later.
23
30
 
24
- ${cyan_1(`--registry`)}
31
+ ${0}
25
32
  The package registry to publish this package to. This option only applies if you create
26
33
  a public package. If you do not provide this option, it will use the default NPM registry.
27
- `;
34
+ `), cyan_1(`--react`), cyan_1(`--no-react`), cyan_1(`--public`), cyan_1(`--private`), cyan_1(`--registry`));
28
35
  printHelp({
29
36
  kind: 'package',
30
37
  options: additionalOptions,
31
- packageManager: argv['--package-manager']?.toLowerCase()
38
+ packageManager: (_argv$PackageManag = argv['--package-manager']) === null || _argv$PackageManag === void 0 ? void 0 : _argv$PackageManag.toLowerCase()
32
39
  });
33
40
  return;
34
41
  }
@@ -189,16 +196,16 @@ async function createPackage() {
189
196
  console.log('Installed dependencies.');
190
197
  }
191
198
 
192
- const packageJsonInstructions = stripIndent`
199
+ const packageJsonInstructions = stripIndent(_t2 || (_t2 = _`
193
200
  Your new package is ready to go! However, before you go too much further,
194
- you should update the following fields in ${cyan_1(relativeDirectoryForDisplay(path.relative(process.cwd(), path.join(packageDirectory, 'package.json'))))}:
201
+ you should update the following fields in ${0}:
195
202
 
196
- - ${bold_1(`"description"`)}, where you provide a description of what your package does
197
- - ${bold_1(`"repository"`)}, where you should include the ${bold_1(`"url"`)} of your project’s repo
203
+ - ${0}, where you provide a description of what your package does
204
+ - ${0}, where you should include the ${0} of your project’s repo
198
205
 
199
- Before you publish your package, you will also want to update the ${bold_1(`"version"`)}
206
+ Before you publish your package, you will also want to update the ${0}
200
207
  field in the package.json file.
201
- `;
208
+ `), cyan_1(relativeDirectoryForDisplay(path.relative(process.cwd(), path.join(packageDirectory, 'package.json')))), bold_1(`"description"`), bold_1(`"repository"`), bold_1(`"url"`), bold_1(`"version"`));
202
209
  console.log();
203
210
  console.log(packageJsonInstructions);
204
211
  const commands = [];
@@ -217,23 +224,23 @@ async function createPackage() {
217
224
  }
218
225
 
219
226
  if (commands.length > 0) {
220
- const whatsNext = stripIndent`
221
- After you update your package.json, there’s ${commands.length > 1 ? 'a few more steps' : 'one more step'} you’ll need to take
227
+ const whatsNext = stripIndent(_t3 || (_t3 = _`
228
+ After you update your package.json, there’s ${0} you’ll need to take
222
229
  in order to start building:
223
- `;
230
+ `), commands.length > 1 ? 'a few more steps' : 'one more step');
224
231
  console.log();
225
232
  console.log(whatsNext);
226
233
  console.log();
227
234
  console.log(commands.map(command => ` ${command}`).join('\n'));
228
235
  }
229
236
 
230
- const followUp = stripIndent`
237
+ const followUp = stripIndent(_t4 || (_t4 = _`
231
238
  Quilt can help you build, test, lint, and type-check your new package. You
232
239
  can learn more about building packages with Quilt by reading the documentation:
233
- ${underline_1(magenta_1('https://github.com/lemonmade/quilt/tree/main/documentation'))}
240
+ ${0}
234
241
 
235
242
  Have fun! 🎉
236
- `;
243
+ `), underline_1(magenta_1('https://github.com/lemonmade/quilt/tree/main/documentation')));
237
244
  console.log();
238
245
  console.log(followUp);
239
246
  } // Argument handling
@@ -363,7 +370,7 @@ function adjustPackageJson(packageJson, {
363
370
  packageJson.name = name;
364
371
  const packageParts = name.split('/');
365
372
  const scope = packageParts[0].startsWith('@') ? packageParts[0] : undefined;
366
- const finalRegistry = registry ?? 'https://registry.npmjs.org';
373
+ const finalRegistry = registry !== null && registry !== void 0 ? registry : 'https://registry.npmjs.org';
367
374
 
368
375
  if (scope) {
369
376
  packageJson.publishConfig[`${scope}/registry`] = finalRegistry;
@@ -399,4 +406,4 @@ function sortKeys(object) {
399
406
  return newObject;
400
407
  }
401
408
 
402
- export { createPackage };
409
+ export { createProject };
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers.mjs';
1
+ import { j as getDefaultExportFromCjs, k as commonjsGlobal } from './index.mjs';
2
2
 
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './_commonjsHelpers.mjs';
1
+ import { j as getDefaultExportFromCjs } from './index.mjs';
2
2
 
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs, c as commonjsGlobal } from './_commonjsHelpers.mjs';
1
+ import { j as getDefaultExportFromCjs, k as commonjsGlobal } from './index.mjs';
2
2
 
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {