@dialpad/dialtone-css 9.0.0 → 9.1.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.
@@ -2,16 +2,19 @@
2
2
 
3
3
  import { join, normalize } from 'path';
4
4
  import { fileURLToPath, pathToFileURL } from 'url';
5
- import { hideBin } from 'yargs/helpers';
6
- import yargs from 'yargs';
7
- import {
5
+ import { assertOptionalPeerDeps } from '../dialtone_migration_helper/optional-peer-deps.mjs';
6
+
7
+ await assertOptionalPeerDeps(['yargs']);
8
+ const { hideBin } = await import('yargs/helpers');
9
+ const { default: yargs } = await import('yargs');
10
+ const {
8
11
  error,
9
12
  getAllFileContents,
10
13
  getConfigFileList,
11
14
  inquireForFile,
12
15
  modifyFileContents,
13
16
  readConfigFile,
14
- } from '../dialtone_migration_helper/helpers.mjs';
17
+ } = await import('../dialtone_migration_helper/helpers.mjs');
15
18
  import { runMergeMigration } from './merge-migrate.mjs';
16
19
 
17
20
  const CONFIG_FOLDER = fileURLToPath(new URL('../dialtone_migration_helper/configs', import.meta.url));
@@ -1,10 +1,13 @@
1
- import chalk from 'chalk';
2
- import { globby } from 'globby';
3
- import inquirer from 'inquirer';
4
1
  import path from 'path';
5
2
  import fs from 'fs';
3
+ import { assertOptionalPeerDeps } from './optional-peer-deps.mjs';
6
4
  const { readdir, readFile, writeFile } = fs.promises;
7
5
 
6
+ await assertOptionalPeerDeps(['chalk', 'globby', 'inquirer']);
7
+ const { default: chalk } = await import('chalk');
8
+ const { globby } = await import('globby');
9
+ const { default: inquirer } = await import('inquirer');
10
+
8
11
  // confirm prompt for starting operations, display warning and y/n dialog
9
12
  export const confirmStart = () => {
10
13
  return new Promise((resolve, reject) => {
@@ -1,7 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import chalk from 'chalk';
4
- import {
3
+ import ora from 'ora';
4
+ import { dirname, normalize } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { assertOptionalPeerDeps } from './optional-peer-deps.mjs';
7
+
8
+ await assertOptionalPeerDeps(['chalk', 'yargs']);
9
+ const { default: chalk } = await import('chalk');
10
+ const { hideBin } = await import('yargs/helpers');
11
+ const { default: yargs } = await import('yargs');
12
+ const {
5
13
  confirmStart,
6
14
  doPatternSearch,
7
15
  error,
@@ -10,13 +18,7 @@ import {
10
18
  getAllFileContents,
11
19
  inquireForFile,
12
20
  modifyFileContents,
13
- readConfigFile,
14
- } from './helpers.mjs';
15
- import ora from 'ora';
16
- import { dirname, normalize } from 'path';
17
- import { fileURLToPath } from 'url';
18
- import { hideBin } from 'yargs/helpers';
19
- import yargs from 'yargs';
21
+ } = await import('./helpers.mjs');
20
22
 
21
23
  // eslint-disable-next-line complexity
22
24
  (async () => {
@@ -0,0 +1,26 @@
1
+ // chalk, globby, inquirer and yargs are declared as optional peerDependencies
2
+ // on @dialpad/dialtone-css because they're only needed by the migration CLIs
3
+ // (dialtone-migrate, dialtone-migration-helper, dialtone-merge-migrate), not
4
+ // by consumers who only use the published CSS/tokens. This checks they're
5
+ // actually present before the CLI runs, so a missing one fails with an
6
+ // install instruction instead of a raw ERR_MODULE_NOT_FOUND stack trace.
7
+ export const assertOptionalPeerDeps = async (names) => {
8
+ const missing = [];
9
+ for (const name of names) {
10
+ try {
11
+ await import(name);
12
+ } catch {
13
+ missing.push(name);
14
+ }
15
+ }
16
+
17
+ if (missing.length > 0) {
18
+ console.error(
19
+ `\nThis command requires the following package${missing.length > 1 ? 's' : ''}, which ` +
20
+ `${missing.length > 1 ? 'are' : 'is'} not installed: ${missing.join(', ')}.\n` +
21
+ `Install ${missing.length > 1 ? 'them' : 'it'} with:\n\n` +
22
+ ` npm install -D ${missing.join(' ')}\n`,
23
+ );
24
+ process.exit(1);
25
+ }
26
+ };
@@ -8,6 +8,7 @@
8
8
  // TABLE OF CONTENTS
9
9
  // • BASE STYLE
10
10
  // • VISUAL STYLES
11
+ // • WRAPPING
11
12
  // • ALIGNMENT
12
13
  // • JUSTIFY
13
14
  // • SIZES
@@ -144,6 +145,14 @@
144
145
  --stack-align: center;
145
146
  }
146
147
 
148
+ // ============================================================================
149
+ // $ WRAPPING
150
+ // ----------------------------------------------------------------------------
151
+
152
+ .d-stack--wrap {
153
+ flex-wrap: wrap;
154
+ }
155
+
147
156
  // ============================================================================
148
157
  // $ ALIGNMENT
149
158
  // ----------------------------------------------------------------------------
@@ -3807,6 +3807,9 @@
3807
3807
  --stack-direction: row-reverse;
3808
3808
  --stack-align: center;
3809
3809
  }
3810
+ .d-stack--wrap {
3811
+ flex-wrap: wrap;
3812
+ }
3810
3813
  .d-stack--align-start {
3811
3814
  --stack-align: start;
3812
3815
  }