@dialpad/dialtone-css 9.0.0 → 9.0.1
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/lib/build/js/dialtone_merge_migrate/index.mjs +7 -4
- package/lib/build/js/dialtone_migration_helper/helpers.mjs +6 -3
- package/lib/build/js/dialtone_migration_helper/index.mjs +11 -9
- package/lib/build/js/dialtone_migration_helper/optional-peer-deps.mjs +26 -0
- package/lib/dist/js/dialtone_merge_migrate/index.mjs +7 -4
- package/lib/dist/js/dialtone_migration_helper/helpers.mjs +6 -3
- package/lib/dist/js/dialtone_migration_helper/index.mjs +11 -9
- package/lib/dist/js/dialtone_migration_helper/optional-peer-deps.mjs +26 -0
- package/package.json +16 -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
|
+
};
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dialpad/dialtone-css",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "Dialpad's design system",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Dialpad",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"less": "^4.2.0",
|
|
94
94
|
"oslllo-svg-fixer": "^2.2.0",
|
|
95
95
|
"through2": "^4.0.2",
|
|
96
|
-
"@dialpad/dialtone-tokens": "2.0.
|
|
96
|
+
"@dialpad/dialtone-tokens": "2.0.2",
|
|
97
97
|
"@dialpad/postcss-responsive-variations": "1.3.0"
|
|
98
98
|
},
|
|
99
99
|
"peerDependencies": {
|
|
@@ -102,6 +102,20 @@
|
|
|
102
102
|
"inquirer": "^9.1.5",
|
|
103
103
|
"yargs": "^17.7.2"
|
|
104
104
|
},
|
|
105
|
+
"peerDependenciesMeta": {
|
|
106
|
+
"chalk": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"globby": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"inquirer": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"yargs": {
|
|
116
|
+
"optional": true
|
|
117
|
+
}
|
|
118
|
+
},
|
|
105
119
|
"nx": {
|
|
106
120
|
"includedScripts": [
|
|
107
121
|
"lint"
|