@dialpad/dialtone 10.0.2 → 10.0.3
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.
- package/dist/js/dialtone_merge_migrate/index.mjs +7 -4
- package/dist/js/dialtone_migration_helper/helpers.mjs +6 -3
- package/dist/js/dialtone_migration_helper/index.mjs +11 -9
- package/dist/js/dialtone_migration_helper/optional-peer-deps.mjs +26 -0
- package/dist/tokens/doc.json +1 -1
- package/package.json +2 -2
|
@@ -2,16 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
import { join, normalize } from 'path';
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
}
|
|
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
|
|
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
|
-
|
|
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
|
+
};
|
package/dist/tokens/doc.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialpad/dialtone",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.3",
|
|
4
4
|
"description": "Dialpad's Dialtone design system monorepo",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
"vue-tsc": "3.2.6",
|
|
100
100
|
"yargs": "^17.7.2",
|
|
101
101
|
"@dialpad/dialtone-emojis": "1.3.0",
|
|
102
|
-
"@dialpad/dialtone-icons": "5.0.0",
|
|
103
102
|
"@dialpad/dialtone-mcp-server": "1.5.0",
|
|
103
|
+
"@dialpad/dialtone-icons": "5.0.0",
|
|
104
104
|
"@dialpad/dialtone-tokens": "2.0.2"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|