@carbon/cli 11.32.0-rc.0 → 11.32.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.
- package/bin/carbon-cli.js +6 -9
- package/package.json +15 -14
- package/src/changelog.js +4 -10
- package/src/cli.js +43 -7
- package/src/commands/bundle/bundlers.js +4 -6
- package/src/commands/bundle/javascript.js +10 -14
- package/src/commands/bundle/typescript.js +12 -16
- package/src/commands/bundle/utils.js +7 -15
- package/src/commands/bundle.js +24 -28
- package/src/commands/changelog.js +23 -27
- package/src/commands/check.js +25 -29
- package/src/commands/ci-check.js +8 -12
- package/src/commands/component.js +11 -15
- package/src/commands/contribute/setup.js +15 -19
- package/src/commands/contribute/tools/getGitHubClient.js +6 -10
- package/src/commands/contribute.js +5 -8
- package/src/commands/inline.js +22 -24
- package/src/commands/publish.js +63 -63
- package/src/commands/release.js +20 -23
- package/src/commands/sync/npm.js +5 -10
- package/src/commands/sync/package.js +4 -9
- package/src/commands/sync/readme.js +13 -18
- package/src/commands/sync/remark/remark-monorepo.js +4 -8
- package/src/commands/sync.js +20 -20
- package/src/compile.js +3 -7
- package/src/component/index.js +7 -11
- package/src/git.js +4 -10
- package/src/logger.js +11 -13
- package/src/workspace.js +9 -14
package/src/commands/sync.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2019,
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
import { workspace } from '../workspace.js';
|
|
9
|
+
import npmTask from './sync/npm.js';
|
|
10
|
+
import packageTask from './sync/package.js';
|
|
11
|
+
import readmeTask from './sync/readme.js';
|
|
11
12
|
|
|
12
13
|
const tasks = {
|
|
13
|
-
npm:
|
|
14
|
-
package:
|
|
15
|
-
readme:
|
|
14
|
+
npm: npmTask,
|
|
15
|
+
package: packageTask,
|
|
16
|
+
readme: readmeTask,
|
|
16
17
|
};
|
|
17
18
|
|
|
18
19
|
async function sync(args, env) {
|
|
@@ -21,19 +22,18 @@ async function sync(args, env) {
|
|
|
21
22
|
|
|
22
23
|
for (const name of tasksToRun) {
|
|
23
24
|
const task = tasks[name];
|
|
24
|
-
await task
|
|
25
|
+
await task(env);
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
29
|
+
export function builder(yargs) {
|
|
30
|
+
yargs.positional('target', {
|
|
31
|
+
describe: 'choose a target to sync',
|
|
32
|
+
choices: ['all', 'npm', 'package', 'readme'],
|
|
33
|
+
default: 'all',
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const command = 'sync [target]';
|
|
38
|
+
export const desc = 'sync files across workspaces';
|
|
39
|
+
export const handler = workspace(sync);
|
package/src/compile.js
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp.
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const sass = require('sass');
|
|
8
|
+
import sass from 'sass';
|
|
11
9
|
|
|
12
10
|
const defaultOptions = {
|
|
13
11
|
includePaths: ['node_modules', '../../node_modules'],
|
|
14
12
|
};
|
|
15
13
|
|
|
16
|
-
function compile(filepaths, options) {
|
|
14
|
+
export default function compile(filepaths, options) {
|
|
17
15
|
return filepaths.map((file) => {
|
|
18
16
|
return sass.renderSync({
|
|
19
17
|
file,
|
|
@@ -22,5 +20,3 @@ function compile(filepaths, options) {
|
|
|
22
20
|
});
|
|
23
21
|
});
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
module.exports = compile;
|
package/src/component/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2019,
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const template = require('lodash.template');
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import fs from 'fs-extra';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
import template from 'lodash.template';
|
|
13
12
|
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
14
|
const TEMPLATES_DIR = path.join(__dirname, 'templates');
|
|
15
15
|
const blocklist = new Set(['.DS_Store']);
|
|
16
16
|
|
|
17
|
-
async function loadTemplates() {
|
|
17
|
+
export async function loadTemplates() {
|
|
18
18
|
const files = await fs.readdir(TEMPLATES_DIR).then((names) => {
|
|
19
19
|
return names
|
|
20
20
|
.filter((name) => {
|
|
@@ -41,7 +41,3 @@ async function loadTemplates() {
|
|
|
41
41
|
|
|
42
42
|
return templates;
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
module.exports = {
|
|
46
|
-
loadTemplates,
|
|
47
|
-
};
|
package/src/git.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2019,
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const execa = require('execa');
|
|
8
|
+
import { execa } from 'execa';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* For certain release types, we want to be certain that our base branch is
|
|
@@ -17,9 +15,9 @@ const execa = require('execa');
|
|
|
17
15
|
*
|
|
18
16
|
* @returns {void}
|
|
19
17
|
*/
|
|
20
|
-
async function fetchLatestFromUpstream() {
|
|
18
|
+
export async function fetchLatestFromUpstream() {
|
|
21
19
|
try {
|
|
22
|
-
// This command will fail
|
|
20
|
+
// This command will fail if no upstream is present, with `catch` we can
|
|
23
21
|
// create the appropriate remote before running the next commands
|
|
24
22
|
await execa('git', ['remote', 'get-url', 'upstream']);
|
|
25
23
|
} catch {
|
|
@@ -32,7 +30,3 @@ async function fetchLatestFromUpstream() {
|
|
|
32
30
|
}
|
|
33
31
|
await execa('git', ['fetch', 'upstream', 'main', '--tags']);
|
|
34
32
|
}
|
|
35
|
-
|
|
36
|
-
module.exports = {
|
|
37
|
-
fetchLatestFromUpstream,
|
|
38
|
-
};
|
package/src/logger.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2019,
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const chalk = require('chalk');
|
|
8
|
+
import chalk from 'chalk';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Create a logger to be used in a handler. This is typically just for
|
|
@@ -15,7 +13,7 @@ const chalk = require('chalk');
|
|
|
15
13
|
* box-drawing ASCII characters.
|
|
16
14
|
* @returns {object}
|
|
17
15
|
*/
|
|
18
|
-
function createLogger(
|
|
16
|
+
export function createLogger(name) {
|
|
19
17
|
const timers = [];
|
|
20
18
|
let indentLevel = 0;
|
|
21
19
|
|
|
@@ -27,7 +25,9 @@ function createLogger(command) {
|
|
|
27
25
|
* @returns {void}
|
|
28
26
|
*/
|
|
29
27
|
function log(boxCharacter, message = '') {
|
|
30
|
-
console.log(
|
|
28
|
+
console.log(
|
|
29
|
+
chalk.yellow(`${name} ▐`) + ' ' + chalk.gray(boxCharacter) + ' ' + message
|
|
30
|
+
);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function getLinePrefix() {
|
|
@@ -64,7 +64,10 @@ function createLogger(command) {
|
|
|
64
64
|
if (message) {
|
|
65
65
|
log(prefix + '┗', message);
|
|
66
66
|
} else {
|
|
67
|
-
log(
|
|
67
|
+
log(
|
|
68
|
+
prefix + '┗',
|
|
69
|
+
chalk.gray('Done in ' + chalk.italic(`${duration}s`))
|
|
70
|
+
);
|
|
68
71
|
}
|
|
69
72
|
},
|
|
70
73
|
newline() {
|
|
@@ -78,7 +81,7 @@ function createLogger(command) {
|
|
|
78
81
|
* Display the banner in the console, typically at the beginning of a handler
|
|
79
82
|
* @returns {void}
|
|
80
83
|
*/
|
|
81
|
-
function displayBanner() {
|
|
84
|
+
export function displayBanner() {
|
|
82
85
|
console.log(`
|
|
83
86
|
_
|
|
84
87
|
| |
|
|
@@ -88,8 +91,3 @@ function displayBanner() {
|
|
|
88
91
|
\\___\\__,_|_| |_.__/ \\___/|_| |_|
|
|
89
92
|
`);
|
|
90
93
|
}
|
|
91
|
-
|
|
92
|
-
module.exports = {
|
|
93
|
-
createLogger,
|
|
94
|
-
displayBanner,
|
|
95
|
-
};
|
package/src/workspace.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright IBM Corp. 2019,
|
|
2
|
+
* Copyright IBM Corp. 2019, 2025
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const path = require('path');
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
import { execa } from 'execa';
|
|
10
|
+
import fs from 'fs-extra';
|
|
11
|
+
import glob from 'fast-glob';
|
|
12
|
+
import path from 'path';
|
|
14
13
|
|
|
14
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
15
|
const { root: ROOT_DIR } = path.parse(__dirname);
|
|
16
16
|
const WORKSPACE_ROOT = getProjectRoot(__dirname);
|
|
17
17
|
const packageJson = fs.readJsonSync(path.join(WORKSPACE_ROOT, 'package.json'));
|
|
@@ -45,7 +45,7 @@ const env = {
|
|
|
45
45
|
packagePaths,
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
function workspace(fn) {
|
|
48
|
+
export function workspace(fn) {
|
|
49
49
|
return (...args) => fn(...args, env);
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -53,7 +53,7 @@ function workspace(fn) {
|
|
|
53
53
|
* Lists the packages for the current project using the `lerna list` command
|
|
54
54
|
* @returns {Array<PackageInfo>}
|
|
55
55
|
*/
|
|
56
|
-
async function getPackages() {
|
|
56
|
+
export async function getPackages() {
|
|
57
57
|
const { stdout: lernaListOutput } = await execa('yarn', [
|
|
58
58
|
'lerna',
|
|
59
59
|
'list',
|
|
@@ -108,8 +108,3 @@ function ancestors(directory) {
|
|
|
108
108
|
|
|
109
109
|
return result;
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
module.exports = {
|
|
113
|
-
workspace,
|
|
114
|
-
getPackages,
|
|
115
|
-
};
|