@carbon/cli 11.34.0 → 11.35.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/README.md +0 -1
- package/package.json +2 -2
- package/src/cli.js +0 -2
- package/src/commands/sync/npm.js +0 -38
- package/src/commands/sync/package.js +0 -118
- package/src/commands/sync/readme.js +0 -62
- package/src/commands/sync/remark/remark-monorepo.js +0 -421
- package/src/commands/sync.js +0 -39
package/README.md
CHANGED
|
@@ -39,7 +39,6 @@ Commands:
|
|
|
39
39
|
cli publish <tag> publish packages that have different versions from
|
|
40
40
|
the package registry
|
|
41
41
|
cli release [bump] run the release step for the given version bump
|
|
42
|
-
cli sync [target] sync files across workspaces
|
|
43
42
|
|
|
44
43
|
Options:
|
|
45
44
|
--help Show help [boolean]
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/cli",
|
|
3
3
|
"description": "Task automation for working with the Carbon Design System",
|
|
4
|
-
"version": "11.
|
|
4
|
+
"version": "11.35.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"typescript-config-carbon": "^0.7.0",
|
|
58
58
|
"yargs": "^17.7.2"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "8f9dd77c8055a1a1ce36af55298c19c9f8966ab9"
|
|
61
61
|
}
|
package/src/cli.js
CHANGED
|
@@ -19,7 +19,6 @@ import * as contribute from './commands/contribute.js';
|
|
|
19
19
|
import * as inline from './commands/inline.js';
|
|
20
20
|
import * as publish from './commands/publish.js';
|
|
21
21
|
import * as release from './commands/release.js';
|
|
22
|
-
import * as sync from './commands/sync.js';
|
|
23
22
|
|
|
24
23
|
const require = createRequire(import.meta.url);
|
|
25
24
|
|
|
@@ -53,7 +52,6 @@ export async function main({ argv }) {
|
|
|
53
52
|
.command(createCommand(inline))
|
|
54
53
|
.command(createCommand(publish))
|
|
55
54
|
.command(createCommand(release))
|
|
56
|
-
.command(createCommand(sync))
|
|
57
55
|
.strict()
|
|
58
56
|
.fail((message, error, yargs) => {
|
|
59
57
|
if (error) {
|
package/src/commands/sync/npm.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2019, 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs-extra';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
|
|
11
|
-
const defaultIgnorePatterns = [
|
|
12
|
-
'**/__mocks__/**',
|
|
13
|
-
'**/__tests__/**',
|
|
14
|
-
'**/examples/**',
|
|
15
|
-
'**/tasks/**',
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export default async function run({ packagePaths }) {
|
|
19
|
-
return Promise.all(
|
|
20
|
-
packagePaths.map(async ({ packagePath }) => {
|
|
21
|
-
const ignorePath = path.join(packagePath, '.npmignore');
|
|
22
|
-
const ignorePatterns = defaultIgnorePatterns.slice();
|
|
23
|
-
|
|
24
|
-
if (await fs.pathExists(ignorePath)) {
|
|
25
|
-
const ignoreFile = await fs.readFile(ignorePath, 'utf8');
|
|
26
|
-
const localIgnorePatterns = ignoreFile.split('\n').filter((pattern) => {
|
|
27
|
-
return ignorePatterns.indexOf(pattern) === -1;
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
ignorePatterns.push(...localIgnorePatterns);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
await fs.writeFile(ignorePath, ignorePatterns.join('\n'));
|
|
34
|
-
})
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const name = 'npm';
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2019, 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs-extra';
|
|
9
|
-
|
|
10
|
-
// This is our default set of keywords to include in each `package.json` packageJson
|
|
11
|
-
const DEFAULT_KEYWORDS = [
|
|
12
|
-
'ibm',
|
|
13
|
-
'carbon',
|
|
14
|
-
'carbon-design-system',
|
|
15
|
-
'components',
|
|
16
|
-
'react',
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
// We're going to use this in our `sortFields` method. The idea is that we want
|
|
20
|
-
// our `package.json` files to be ordered in the order given in this array. To
|
|
21
|
-
// accomplish this, we create an object where we can reference the value
|
|
22
|
-
// assigned to a field when sorting. By default, highest priority fields start
|
|
23
|
-
// with 1 and go up. Unknown fields are all given the same priority, which is
|
|
24
|
-
// just the length of the array + 1. When we use `sortFields` we are checking
|
|
25
|
-
// for the value from `packageJsonFields` and comparing it with the other value.
|
|
26
|
-
const packageJsonFields = [
|
|
27
|
-
'name',
|
|
28
|
-
'private',
|
|
29
|
-
'description',
|
|
30
|
-
'version',
|
|
31
|
-
'license',
|
|
32
|
-
'bin',
|
|
33
|
-
'main',
|
|
34
|
-
'module',
|
|
35
|
-
'type',
|
|
36
|
-
'exports',
|
|
37
|
-
'repository',
|
|
38
|
-
'sideEffects',
|
|
39
|
-
'bugs',
|
|
40
|
-
'homepage',
|
|
41
|
-
'engines',
|
|
42
|
-
'files',
|
|
43
|
-
'keywords',
|
|
44
|
-
'publishConfig',
|
|
45
|
-
'scripts',
|
|
46
|
-
'resolutions',
|
|
47
|
-
'peerDependencies',
|
|
48
|
-
'dependencies',
|
|
49
|
-
'devDependencies',
|
|
50
|
-
'sideEffects',
|
|
51
|
-
'eyeglass',
|
|
52
|
-
'eslintConfig',
|
|
53
|
-
'prettier',
|
|
54
|
-
'babel',
|
|
55
|
-
'jest',
|
|
56
|
-
].reduce(
|
|
57
|
-
(acc, key, index) => ({
|
|
58
|
-
...acc,
|
|
59
|
-
[key]: index + 1,
|
|
60
|
-
}),
|
|
61
|
-
{}
|
|
62
|
-
);
|
|
63
|
-
const UNKNOWN_FIELD = Object.keys(packageJsonFields).length + 1;
|
|
64
|
-
function sortFields(a, b) {
|
|
65
|
-
const aValue = packageJsonFields[a] || UNKNOWN_FIELD;
|
|
66
|
-
const bValue = packageJsonFields[b] || UNKNOWN_FIELD;
|
|
67
|
-
return aValue - bValue;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default async function run({ packagePaths }) {
|
|
71
|
-
return Promise.all(
|
|
72
|
-
packagePaths.map(
|
|
73
|
-
async ({ packageJsonPath, packageJson, packageFolder }) => {
|
|
74
|
-
packageJson.repository = {
|
|
75
|
-
type: 'git',
|
|
76
|
-
url: 'https://github.com/carbon-design-system/carbon.git',
|
|
77
|
-
directory: packageFolder,
|
|
78
|
-
};
|
|
79
|
-
packageJson.bugs =
|
|
80
|
-
'https://github.com/carbon-design-system/carbon/issues';
|
|
81
|
-
packageJson.license = 'Apache-2.0';
|
|
82
|
-
|
|
83
|
-
if (!packageJson.private) {
|
|
84
|
-
packageJson.publishConfig = {
|
|
85
|
-
access: 'public',
|
|
86
|
-
provenance: 'true',
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (Array.isArray(packageJson.keywords)) {
|
|
91
|
-
const keywordsToAdd = DEFAULT_KEYWORDS.filter((keyword) => {
|
|
92
|
-
return packageJson.keywords.indexOf(keyword) === -1;
|
|
93
|
-
});
|
|
94
|
-
if (keywordsToAdd.length > 0) {
|
|
95
|
-
packageJson.keywords = [...packageJson.keywords, ...keywordsToAdd];
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
packageJson.keywords = DEFAULT_KEYWORDS;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Construct our new packageJson packageJson with sorted fields
|
|
102
|
-
const file = Object.keys(packageJson)
|
|
103
|
-
.sort(sortFields)
|
|
104
|
-
.reduce(
|
|
105
|
-
(acc, key) => ({
|
|
106
|
-
...acc,
|
|
107
|
-
[key]: packageJson[key],
|
|
108
|
-
}),
|
|
109
|
-
{}
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
await fs.writeJson(packageJsonPath, file, { spaces: 2 });
|
|
113
|
-
}
|
|
114
|
-
)
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export const name = 'package';
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2019, 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs-extra';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
import prettier from 'prettier';
|
|
11
|
-
import prettierConfig from 'prettier-config-carbon';
|
|
12
|
-
import { remark } from 'remark';
|
|
13
|
-
import monorepo from './remark/remark-monorepo.js';
|
|
14
|
-
|
|
15
|
-
const packageDenyList = new Set([
|
|
16
|
-
'carbon-components',
|
|
17
|
-
'carbon-components-react',
|
|
18
|
-
'@carbon/react',
|
|
19
|
-
'@carbon/styles',
|
|
20
|
-
]);
|
|
21
|
-
|
|
22
|
-
export default async function run({ root, packagePaths }) {
|
|
23
|
-
const remarkInstance = remark().use(monorepo, {
|
|
24
|
-
root: root.directory,
|
|
25
|
-
});
|
|
26
|
-
const prettierOptions = {
|
|
27
|
-
...prettierConfig,
|
|
28
|
-
parser: 'markdown',
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return Promise.all(
|
|
32
|
-
packagePaths
|
|
33
|
-
.filter((pkg) => !packageDenyList.has(pkg.packageJson.name))
|
|
34
|
-
.map(async ({ packagePath }) => {
|
|
35
|
-
const README_PATH = path.join(packagePath, 'README.md');
|
|
36
|
-
if (!(await fs.pathExists(README_PATH))) {
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const readme = await fs.readFile(README_PATH, 'utf8');
|
|
41
|
-
const file = await process(remarkInstance, packagePath, readme);
|
|
42
|
-
await fs.writeFile(
|
|
43
|
-
README_PATH,
|
|
44
|
-
prettier.format(String(file), prettierOptions)
|
|
45
|
-
);
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function process(remarkInstance, cwd, contents) {
|
|
51
|
-
return new Promise((resolve, reject) => {
|
|
52
|
-
remarkInstance.process({ cwd, contents }, (error, file) => {
|
|
53
|
-
if (error) {
|
|
54
|
-
reject(error);
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
resolve(file);
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const name = 'readme';
|
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2019, 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import fs from 'fs-extra';
|
|
9
|
-
import path from 'path';
|
|
10
|
-
|
|
11
|
-
export default function monorepo() {
|
|
12
|
-
async function transformer(tree, file) {
|
|
13
|
-
const { cwd } = file;
|
|
14
|
-
const localPackageJsonPath = path.join(cwd, 'package.json');
|
|
15
|
-
const localPackageJson = await fs.readJson(localPackageJsonPath);
|
|
16
|
-
const { name, description } = localPackageJson;
|
|
17
|
-
|
|
18
|
-
if (!name) {
|
|
19
|
-
return new Error(
|
|
20
|
-
`Expected a name to be defined for the package at: ${cwd}`
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
if (!description) {
|
|
24
|
-
return new Error(
|
|
25
|
-
`Expected a description to be defined for the package at: ${cwd}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// Grab all sections under `## Usage` as these are custom for each project
|
|
30
|
-
const usage = [];
|
|
31
|
-
let usageHeadingFound = false;
|
|
32
|
-
|
|
33
|
-
for (const child of tree.children) {
|
|
34
|
-
if (usageHeadingFound) {
|
|
35
|
-
if (child.type === 'heading' && child.depth <= 2) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
usage.push(child);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (
|
|
42
|
-
child.type === 'heading' &&
|
|
43
|
-
child.depth === 2 &&
|
|
44
|
-
child.children[0].value === 'Usage'
|
|
45
|
-
) {
|
|
46
|
-
usageHeadingFound = true;
|
|
47
|
-
usage.push(child);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// [x] Title
|
|
52
|
-
// [x] Getting Started
|
|
53
|
-
// [x] Usage
|
|
54
|
-
// [x] Examples
|
|
55
|
-
// [ ] Contributors
|
|
56
|
-
// [x] Contributing
|
|
57
|
-
// [x] License
|
|
58
|
-
// eslint-disable-next-line require-atomic-updates
|
|
59
|
-
tree.children = [
|
|
60
|
-
...createTitle(localPackageJson.name, localPackageJson.description),
|
|
61
|
-
...createGettingStarted(localPackageJson.name),
|
|
62
|
-
...usage,
|
|
63
|
-
...(await createAPIDoc(localPackageJson.name, path.join(cwd, 'docs'))),
|
|
64
|
-
...(await createExamples(
|
|
65
|
-
localPackageJson.name,
|
|
66
|
-
path.join(cwd, 'examples')
|
|
67
|
-
)),
|
|
68
|
-
...createContributing(),
|
|
69
|
-
...createLicense(),
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return transformer;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function createTitle(name, description) {
|
|
77
|
-
return [
|
|
78
|
-
{
|
|
79
|
-
type: 'heading',
|
|
80
|
-
depth: 1,
|
|
81
|
-
children: [
|
|
82
|
-
{
|
|
83
|
-
type: 'text',
|
|
84
|
-
value: name,
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
type: 'blockquote',
|
|
90
|
-
children: [
|
|
91
|
-
{
|
|
92
|
-
type: 'paragraph',
|
|
93
|
-
children: [
|
|
94
|
-
{
|
|
95
|
-
type: 'text',
|
|
96
|
-
value: description,
|
|
97
|
-
},
|
|
98
|
-
],
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function createGettingStarted(name) {
|
|
106
|
-
return [
|
|
107
|
-
{
|
|
108
|
-
type: 'heading',
|
|
109
|
-
depth: 2,
|
|
110
|
-
children: [
|
|
111
|
-
{
|
|
112
|
-
type: 'text',
|
|
113
|
-
value: 'Getting started',
|
|
114
|
-
},
|
|
115
|
-
],
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: 'paragraph',
|
|
119
|
-
children: [
|
|
120
|
-
{
|
|
121
|
-
type: 'text',
|
|
122
|
-
value: 'To install ',
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
type: 'inlineCode',
|
|
126
|
-
value: name,
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
type: 'text',
|
|
130
|
-
value:
|
|
131
|
-
' in your project, you will need to run the following command using ',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
type: 'link',
|
|
135
|
-
title: null,
|
|
136
|
-
url: 'https://www.npmjs.com/',
|
|
137
|
-
children: [
|
|
138
|
-
{
|
|
139
|
-
type: 'text',
|
|
140
|
-
value: 'npm',
|
|
141
|
-
},
|
|
142
|
-
],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
type: 'text',
|
|
146
|
-
value: ':',
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
type: 'code',
|
|
152
|
-
lang: 'bash',
|
|
153
|
-
value: `npm install -S ${name}`,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
type: 'paragraph',
|
|
157
|
-
children: [
|
|
158
|
-
{
|
|
159
|
-
type: 'text',
|
|
160
|
-
value: 'If you prefer ',
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
type: 'link',
|
|
164
|
-
title: null,
|
|
165
|
-
url: 'https://yarnpkg.com/en/',
|
|
166
|
-
children: [
|
|
167
|
-
{
|
|
168
|
-
type: 'text',
|
|
169
|
-
value: 'Yarn',
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
type: 'text',
|
|
175
|
-
value: ', use the following command\ninstead:',
|
|
176
|
-
},
|
|
177
|
-
],
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
type: 'code',
|
|
181
|
-
lang: 'bash',
|
|
182
|
-
meta: null,
|
|
183
|
-
value: `yarn add ${name}`,
|
|
184
|
-
},
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
async function createAPIDoc(name, docsDir) {
|
|
189
|
-
// No docs to list
|
|
190
|
-
if (!(await fs.pathExists(docsDir))) {
|
|
191
|
-
return [];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const docs = (await fs.readdir(docsDir)).filter((name) => {
|
|
195
|
-
// Ignore dotfiles and json files
|
|
196
|
-
return !(name[0] === '.' || name === 'sass.json');
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
if (docs.length === 0) {
|
|
200
|
-
return [];
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return [
|
|
204
|
-
{
|
|
205
|
-
type: 'heading',
|
|
206
|
-
depth: 2,
|
|
207
|
-
children: [
|
|
208
|
-
{
|
|
209
|
-
type: 'text',
|
|
210
|
-
value: '📖 API Documentation',
|
|
211
|
-
},
|
|
212
|
-
],
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
type: 'paragraph',
|
|
216
|
-
children: [
|
|
217
|
-
{
|
|
218
|
-
type: 'text',
|
|
219
|
-
value: "If you're looking for ",
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
type: 'inlineCode',
|
|
223
|
-
value: name,
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
type: 'text',
|
|
227
|
-
value: ' API documentation, check out:',
|
|
228
|
-
},
|
|
229
|
-
],
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
type: 'list',
|
|
233
|
-
ordered: false,
|
|
234
|
-
spread: false,
|
|
235
|
-
children: docs.map((doc) => ({
|
|
236
|
-
type: 'listItem',
|
|
237
|
-
spread: false,
|
|
238
|
-
checked: null,
|
|
239
|
-
children: [
|
|
240
|
-
{
|
|
241
|
-
type: 'paragraph',
|
|
242
|
-
children: [
|
|
243
|
-
{
|
|
244
|
-
type: 'link',
|
|
245
|
-
title: null,
|
|
246
|
-
url: `./docs/${doc}`,
|
|
247
|
-
children: [
|
|
248
|
-
{
|
|
249
|
-
type: 'text',
|
|
250
|
-
value: `${
|
|
251
|
-
doc[0].toUpperCase() +
|
|
252
|
-
doc.slice(1).replace(/\.[^/.]+$/, '')
|
|
253
|
-
}`,
|
|
254
|
-
},
|
|
255
|
-
],
|
|
256
|
-
},
|
|
257
|
-
],
|
|
258
|
-
},
|
|
259
|
-
],
|
|
260
|
-
})),
|
|
261
|
-
},
|
|
262
|
-
];
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
async function createExamples(name, examplesDir) {
|
|
266
|
-
// No examples to list
|
|
267
|
-
if (!(await fs.pathExists(examplesDir))) {
|
|
268
|
-
return [];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
const examples = (await fs.readdir(examplesDir)).filter((name) => {
|
|
272
|
-
// Ignore dotfiles and special cases `codesandbox` and `storybook`
|
|
273
|
-
return !(
|
|
274
|
-
name[0] === '.' ||
|
|
275
|
-
name === 'codesandbox' ||
|
|
276
|
-
name === 'storybook' ||
|
|
277
|
-
name === 'preview'
|
|
278
|
-
);
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
if (examples.length === 0) {
|
|
282
|
-
return [];
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
return [
|
|
286
|
-
{
|
|
287
|
-
type: 'heading',
|
|
288
|
-
depth: 2,
|
|
289
|
-
children: [
|
|
290
|
-
{
|
|
291
|
-
type: 'text',
|
|
292
|
-
value: '📚 Examples',
|
|
293
|
-
},
|
|
294
|
-
],
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
type: 'paragraph',
|
|
298
|
-
children: [
|
|
299
|
-
{
|
|
300
|
-
type: 'text',
|
|
301
|
-
value: "If you're looking for more examples on how to use ",
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
type: 'inlineCode',
|
|
305
|
-
value: name,
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
type: 'text',
|
|
309
|
-
value: ', we have some examples that you can check out:',
|
|
310
|
-
},
|
|
311
|
-
],
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
type: 'list',
|
|
315
|
-
ordered: false,
|
|
316
|
-
spread: false,
|
|
317
|
-
children: examples.map((example) => ({
|
|
318
|
-
type: 'listItem',
|
|
319
|
-
spread: false,
|
|
320
|
-
checked: null,
|
|
321
|
-
children: [
|
|
322
|
-
{
|
|
323
|
-
type: 'paragraph',
|
|
324
|
-
children: [
|
|
325
|
-
{
|
|
326
|
-
type: 'link',
|
|
327
|
-
title: null,
|
|
328
|
-
url: `./examples/${example}`,
|
|
329
|
-
children: [
|
|
330
|
-
{
|
|
331
|
-
type: 'text',
|
|
332
|
-
value: example,
|
|
333
|
-
},
|
|
334
|
-
],
|
|
335
|
-
},
|
|
336
|
-
],
|
|
337
|
-
},
|
|
338
|
-
],
|
|
339
|
-
})),
|
|
340
|
-
},
|
|
341
|
-
];
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function createContributing() {
|
|
345
|
-
return [
|
|
346
|
-
{
|
|
347
|
-
type: 'heading',
|
|
348
|
-
depth: 2,
|
|
349
|
-
children: [
|
|
350
|
-
{
|
|
351
|
-
type: 'text',
|
|
352
|
-
value: '🙌 Contributing',
|
|
353
|
-
},
|
|
354
|
-
],
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
type: 'paragraph',
|
|
358
|
-
children: [
|
|
359
|
-
{
|
|
360
|
-
type: 'text',
|
|
361
|
-
value:
|
|
362
|
-
"We're always looking for contributors to help us fix bugs, build new features, or help us improve the project documentation. If you're interested, definitely check out our ",
|
|
363
|
-
},
|
|
364
|
-
{
|
|
365
|
-
type: 'link',
|
|
366
|
-
title: null,
|
|
367
|
-
url: '/.github/CONTRIBUTING.md',
|
|
368
|
-
children: [
|
|
369
|
-
{
|
|
370
|
-
type: 'text',
|
|
371
|
-
value: 'Contributing Guide',
|
|
372
|
-
},
|
|
373
|
-
],
|
|
374
|
-
},
|
|
375
|
-
{
|
|
376
|
-
type: 'text',
|
|
377
|
-
value: '! 👀',
|
|
378
|
-
},
|
|
379
|
-
],
|
|
380
|
-
},
|
|
381
|
-
];
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
function createLicense() {
|
|
385
|
-
return [
|
|
386
|
-
{
|
|
387
|
-
type: 'heading',
|
|
388
|
-
depth: 2,
|
|
389
|
-
children: [
|
|
390
|
-
{
|
|
391
|
-
type: 'text',
|
|
392
|
-
value: '📝 License',
|
|
393
|
-
},
|
|
394
|
-
],
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
type: 'paragraph',
|
|
398
|
-
children: [
|
|
399
|
-
{
|
|
400
|
-
type: 'text',
|
|
401
|
-
value: 'Licensed under the ',
|
|
402
|
-
},
|
|
403
|
-
{
|
|
404
|
-
type: 'link',
|
|
405
|
-
title: null,
|
|
406
|
-
url: '/LICENSE',
|
|
407
|
-
children: [
|
|
408
|
-
{
|
|
409
|
-
type: 'text',
|
|
410
|
-
value: 'Apache 2.0 License',
|
|
411
|
-
},
|
|
412
|
-
],
|
|
413
|
-
},
|
|
414
|
-
{
|
|
415
|
-
type: 'text',
|
|
416
|
-
value: '.',
|
|
417
|
-
},
|
|
418
|
-
],
|
|
419
|
-
},
|
|
420
|
-
];
|
|
421
|
-
}
|
package/src/commands/sync.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright IBM Corp. 2019, 2025
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
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';
|
|
12
|
-
|
|
13
|
-
const tasks = {
|
|
14
|
-
npm: npmTask,
|
|
15
|
-
package: packageTask,
|
|
16
|
-
readme: readmeTask,
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
async function sync(args, env) {
|
|
20
|
-
const { target } = args;
|
|
21
|
-
const tasksToRun = target === 'all' ? Object.keys(tasks) : [target];
|
|
22
|
-
|
|
23
|
-
for (const name of tasksToRun) {
|
|
24
|
-
const task = tasks[name];
|
|
25
|
-
await task(env);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
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);
|