@teambit/aspect 1.0.107 → 1.0.108
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/aspect.aspect.ts +7 -0
- package/aspect.cmd.ts +255 -0
- package/aspect.env.ts +163 -0
- package/aspect.main.runtime.ts +299 -0
- package/aspect.templates.ts +24 -0
- package/core-exporter.task.ts +82 -0
- package/dist/aspect.cmd.d.ts +5 -5
- package/dist/aspect.cmd.js +2 -2
- package/dist/aspect.cmd.js.map +1 -1
- package/dist/aspect.composition.d.ts +2 -2
- package/dist/aspect.main.runtime.d.ts +1 -1
- package/dist/aspect.main.runtime.js +1 -2
- package/dist/aspect.main.runtime.js.map +1 -1
- package/dist/aspect.ui.runtime.d.ts +1 -1
- package/dist/eslint/eslintrc.d.ts +2 -2
- package/dist/prettier/prettier.config.d.ts +3 -3
- package/dist/{preview-1703590665075.js → preview-1703647408454.js} +2 -2
- package/index.ts +3 -0
- package/package.json +35 -41
- package/tsconfig.json +16 -21
- package/types/asset.d.ts +15 -3
- package/artifacts/env-template/public/186.25debdaad2dd48b317e3.js +0 -255
- package/artifacts/env-template/public/244.23981efc3a92f81df93b.js +0 -34
- package/artifacts/env-template/public/29.5411dfd2b6110e3c5e4c.js +0 -709
- package/artifacts/env-template/public/assets-manifest.json +0 -56
- package/artifacts/env-template/public/compositions.44bcfbb7019049e79def.js +0 -8
- package/artifacts/env-template/public/compositions.html +0 -2
- package/artifacts/env-template/public/overview.2b0d4ebb5229aaf77a0d.js +0 -5
- package/artifacts/env-template/public/overview.html +0 -2
- package/artifacts/env-template/public/peers.6303cd076137e8087823.js +0 -1
- package/artifacts/env-template/public/preview-root.f0216e0fe57c1003a87b.js +0 -1
- package/artifacts/env-template/public/static/css/29.dd569806.css +0 -1
- package/artifacts/env-template/public/static/css/compositions.e163efe5.css +0 -1
- package/artifacts/env-template/public/static/css/preview-root.120a1d04.css +0 -1
- /package/{compositions-1703590665075.js → compositions-1703647408454.js} +0 -0
- /package/{overview-1703590665075.js → overview-1703647408454.js} +0 -0
package/aspect.aspect.ts
ADDED
package/aspect.cmd.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
// eslint-disable-next-line max-classes-per-file
|
|
2
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
|
3
|
+
import { CLITable } from '@teambit/cli-table';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
import { ExtensionDataList } from '@teambit/legacy/dist/consumer/config';
|
|
6
|
+
import { COMPONENT_PATTERN_HELP } from '@teambit/legacy/dist/constants';
|
|
7
|
+
import { AspectMain } from './aspect.main.runtime';
|
|
8
|
+
|
|
9
|
+
export class ListAspectCmd implements Command {
|
|
10
|
+
name = 'list [pattern]';
|
|
11
|
+
description = 'list all aspects configured on component(s)';
|
|
12
|
+
arguments = [
|
|
13
|
+
{
|
|
14
|
+
name: 'pattern',
|
|
15
|
+
description: COMPONENT_PATTERN_HELP,
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
options = [['d', 'debug', 'show the origins where the aspects were taken from']] as CommandOptions;
|
|
19
|
+
group = 'development';
|
|
20
|
+
|
|
21
|
+
constructor(private aspect: AspectMain) {}
|
|
22
|
+
|
|
23
|
+
async report([name]: [string], { debug }: { debug: boolean }) {
|
|
24
|
+
const listAspectsResults = await this.aspect.listAspectsOfComponent(name);
|
|
25
|
+
const rows = Object.keys(listAspectsResults).map((componentId) => {
|
|
26
|
+
const longestAspectName = Math.max(...listAspectsResults[componentId].map((_) => _.aspectName.length));
|
|
27
|
+
const aspects = listAspectsResults[componentId]
|
|
28
|
+
.map((aspectSource) => {
|
|
29
|
+
const origin = debug ? ` (origin: ${aspectSource.source})` : '';
|
|
30
|
+
const aspectName = aspectSource.aspectName.padEnd(longestAspectName);
|
|
31
|
+
return `${aspectName} (level: ${aspectSource.level})${origin}`;
|
|
32
|
+
})
|
|
33
|
+
.join('\n');
|
|
34
|
+
|
|
35
|
+
return [componentId, aspects];
|
|
36
|
+
});
|
|
37
|
+
const table = new CLITable([], rows);
|
|
38
|
+
return table.render();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type SetAspectOptions = { merge?: boolean };
|
|
43
|
+
|
|
44
|
+
export class SetAspectCmd implements Command {
|
|
45
|
+
name = 'set <pattern> <aspect-id> [config]';
|
|
46
|
+
description = 'set components with an aspect to extend their development tools, metadata and (possibly) artifacts';
|
|
47
|
+
arguments = [
|
|
48
|
+
{
|
|
49
|
+
name: 'pattern',
|
|
50
|
+
description: `the components to extend. ${COMPONENT_PATTERN_HELP}`,
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'aspect-id',
|
|
54
|
+
description: "the aspect's component id",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'config',
|
|
58
|
+
description: `the aspect config. enter the config as a stringified JSON (e.g. '{"foo":"bar"}' ). when no config is provided, an aspect is set with an empty config ({}).`,
|
|
59
|
+
},
|
|
60
|
+
];
|
|
61
|
+
options = [
|
|
62
|
+
['m', 'merge', 'merge with an existing config if exits. (by default, it replaces overlapping existing configs)'],
|
|
63
|
+
] as CommandOptions;
|
|
64
|
+
group = 'development';
|
|
65
|
+
|
|
66
|
+
constructor(private aspect: AspectMain) {}
|
|
67
|
+
|
|
68
|
+
async report([pattern, aspectId, config]: [string, string, string], options: SetAspectOptions) {
|
|
69
|
+
const configParsed = config ? JSON.parse(config) : {};
|
|
70
|
+
const results = await this.aspect.setAspectsToComponents(pattern, aspectId, configParsed, options);
|
|
71
|
+
if (!results.length)
|
|
72
|
+
return chalk.yellow(`unable to find any matching components for ${chalk.bold(pattern)} pattern`);
|
|
73
|
+
return chalk.green(`the following component(s) have been successfully updated:\n${results.join('\n')}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export class UpdateAspectCmd implements Command {
|
|
78
|
+
name = 'update <aspect-id> [pattern]';
|
|
79
|
+
description = 'update a version of an aspect for all or specified components';
|
|
80
|
+
arguments = [
|
|
81
|
+
{
|
|
82
|
+
name: 'aspect-id',
|
|
83
|
+
description:
|
|
84
|
+
"the aspect's component id. optionally, add a version (id@version), otherwise will use the latest version from the remote",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'pattern',
|
|
88
|
+
description: `the components to update (defaults to all components). ${COMPONENT_PATTERN_HELP}`,
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
examples = [
|
|
92
|
+
{
|
|
93
|
+
cmd: "bit aspect update scope.org/aspect '**/ui/**'",
|
|
94
|
+
description: 'update all components with the "ui" namespace that use scope.org/aspect, to use its latest version',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
cmd: 'bit aspect update scope.org/aspect@2.0.0',
|
|
98
|
+
description:
|
|
99
|
+
'update version of scope.org/aspect to version 2.0.0 for all components configured with that aspect.',
|
|
100
|
+
},
|
|
101
|
+
];
|
|
102
|
+
options = [];
|
|
103
|
+
group = 'development';
|
|
104
|
+
|
|
105
|
+
constructor(private aspect: AspectMain) {}
|
|
106
|
+
|
|
107
|
+
async report([aspectId, pattern]: [string, string]) {
|
|
108
|
+
const { updated, alreadyUpToDate } = await this.aspect.updateAspectsToComponents(aspectId, pattern);
|
|
109
|
+
if (updated.length) {
|
|
110
|
+
return chalk.green(`the following component(s) have been successfully updated:\n${updated.join('\n')}`);
|
|
111
|
+
}
|
|
112
|
+
if (alreadyUpToDate.length) {
|
|
113
|
+
return chalk.green(
|
|
114
|
+
`all ${alreadyUpToDate.length} component(s) that use this aspect are already up to date. nothing to update`
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
return chalk.yellow(`unable to find any components in this workspace that use ${chalk.bold(aspectId)}`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export class UnsetAspectCmd implements Command {
|
|
122
|
+
name = 'unset <pattern> <aspect-id>';
|
|
123
|
+
description = `unset an aspect from component(s).`;
|
|
124
|
+
arguments = [
|
|
125
|
+
{
|
|
126
|
+
name: 'pattern',
|
|
127
|
+
description: `the components to target. ${COMPONENT_PATTERN_HELP}`,
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: 'aspect-id',
|
|
131
|
+
description: "the aspect's component id",
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
options = [];
|
|
135
|
+
group = 'development';
|
|
136
|
+
|
|
137
|
+
constructor(private aspect: AspectMain) {}
|
|
138
|
+
|
|
139
|
+
async report([pattern, aspectId]: [string, string]) {
|
|
140
|
+
const results = await this.aspect.unsetAspectsFromComponents(pattern, aspectId);
|
|
141
|
+
if (!results.length)
|
|
142
|
+
return chalk.yellow(`unable to find any matching components for ${chalk.bold(pattern)} pattern`);
|
|
143
|
+
return chalk.green(`the following component(s) have been successfully updated:\n${results.join('\n')}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export class GetAspectCmd implements Command {
|
|
148
|
+
name = 'get <component-name>';
|
|
149
|
+
description = 'list the aspects set on a component, as well as their configs and data';
|
|
150
|
+
arguments = [
|
|
151
|
+
{
|
|
152
|
+
name: 'component-name',
|
|
153
|
+
description: 'the component name or component id to fetch aspects for',
|
|
154
|
+
},
|
|
155
|
+
];
|
|
156
|
+
options = [
|
|
157
|
+
['d', 'debug', 'show the origins where the aspects were taken from'],
|
|
158
|
+
['j', 'json', 'format as json'],
|
|
159
|
+
] as CommandOptions;
|
|
160
|
+
group = 'development';
|
|
161
|
+
|
|
162
|
+
constructor(private aspect: AspectMain) {}
|
|
163
|
+
|
|
164
|
+
async report([componentName]: [string], { debug }: { debug: boolean }) {
|
|
165
|
+
const extensionsDetailsToString = (extensions: ExtensionDataList) =>
|
|
166
|
+
extensions
|
|
167
|
+
.map((e) => {
|
|
168
|
+
const { name, data, config, extensionId } = e.toComponentObject();
|
|
169
|
+
return `${chalk.bold('name:')} ${name || extensionId?.toString()}
|
|
170
|
+
${chalk.bold('config:')} ${JSON.stringify(config, undefined, 2)}
|
|
171
|
+
${chalk.bold('data:')} ${JSON.stringify(data, undefined, 2)}
|
|
172
|
+
`;
|
|
173
|
+
})
|
|
174
|
+
.join('\n');
|
|
175
|
+
|
|
176
|
+
if (debug) {
|
|
177
|
+
const {
|
|
178
|
+
aspects,
|
|
179
|
+
extensions: mergedExtensions,
|
|
180
|
+
beforeMerge,
|
|
181
|
+
} = await this.aspect.getAspectsOfComponentForDebugging(componentName);
|
|
182
|
+
const beforeMergeOutput = beforeMerge
|
|
183
|
+
.map(({ origin, extensions, extraData }) => {
|
|
184
|
+
const title = chalk.green.bold(`Origin: ${origin}`);
|
|
185
|
+
const details = extensionsDetailsToString(extensions);
|
|
186
|
+
const moreData = extraData ? `\n${chalk.bold('Extra Data:')} ${JSON.stringify(extraData, undefined, 2)}` : '';
|
|
187
|
+
return `${title}\n${details}${moreData}`;
|
|
188
|
+
})
|
|
189
|
+
.join('\n\n');
|
|
190
|
+
|
|
191
|
+
const afterMergeTitle = chalk.green.bold('After merging the origins above');
|
|
192
|
+
const afterMergeOutput = `${afterMergeTitle}\n${extensionsDetailsToString(mergedExtensions)}`;
|
|
193
|
+
|
|
194
|
+
const afterFinalMergeTitle = chalk.green.bold('Final - After merging the origins above and the loaded data');
|
|
195
|
+
const afterFinalMergeOutput = `${afterFinalMergeTitle}\n${extensionsDetailsToString(aspects.toLegacy())}`;
|
|
196
|
+
|
|
197
|
+
return `${beforeMergeOutput}\n\n${afterMergeOutput}\n\n\n${afterFinalMergeOutput}`;
|
|
198
|
+
}
|
|
199
|
+
const aspects = await this.aspect.getAspectsOfComponent(componentName);
|
|
200
|
+
const extensionDataList = aspects.toLegacy();
|
|
201
|
+
return extensionsDetailsToString(extensionDataList);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async json([componentName]: [string], { debug }: { debug: boolean }) {
|
|
205
|
+
const extensionsDetailsToObject = (extensions: ExtensionDataList) =>
|
|
206
|
+
extensions.reduce((acc, current) => {
|
|
207
|
+
const { name, data, config, extensionId } = current.toComponentObject();
|
|
208
|
+
const aspectName = name || extensionId?.toString() || '<no-name>';
|
|
209
|
+
acc[aspectName] = {
|
|
210
|
+
name: aspectName,
|
|
211
|
+
config,
|
|
212
|
+
data,
|
|
213
|
+
};
|
|
214
|
+
return acc;
|
|
215
|
+
}, {});
|
|
216
|
+
|
|
217
|
+
if (debug) {
|
|
218
|
+
const {
|
|
219
|
+
aspects,
|
|
220
|
+
extensions: mergedExtensions,
|
|
221
|
+
beforeMerge,
|
|
222
|
+
} = await this.aspect.getAspectsOfComponentForDebugging(componentName);
|
|
223
|
+
const jsonObj: Record<string, any> = {};
|
|
224
|
+
beforeMerge.forEach(({ origin, extensions, extraData }) => {
|
|
225
|
+
jsonObj[origin] = {
|
|
226
|
+
extensions: extensionsDetailsToObject(extensions),
|
|
227
|
+
extraData,
|
|
228
|
+
};
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
jsonObj.AfterMerge = { extensions: extensionsDetailsToObject(mergedExtensions) };
|
|
232
|
+
jsonObj.FinalAfterMergeIncludeLoad = { extensions: extensionsDetailsToObject(aspects.toLegacy()) };
|
|
233
|
+
return jsonObj;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
const aspects = await this.aspect.getAspectsOfComponent(componentName);
|
|
237
|
+
|
|
238
|
+
return extensionsDetailsToObject(aspects.toLegacy());
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export class AspectCmd implements Command {
|
|
243
|
+
name = 'aspect <sub-command>';
|
|
244
|
+
alias = '';
|
|
245
|
+
description = 'manage aspects';
|
|
246
|
+
options = [];
|
|
247
|
+
group = 'development';
|
|
248
|
+
commands: Command[] = [];
|
|
249
|
+
|
|
250
|
+
async report([unrecognizedSubcommand]: [string]) {
|
|
251
|
+
return chalk.red(
|
|
252
|
+
`"${unrecognizedSubcommand}" is not a subcommand of "aspect", please run "bit aspect --help" to list the subcommands`
|
|
253
|
+
);
|
|
254
|
+
}
|
|
255
|
+
}
|
package/aspect.env.ts
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { Compiler } from '@teambit/compiler';
|
|
2
|
+
import type { DependenciesEnv, PackageEnv, GetNpmIgnoreContext, PreviewEnv } from '@teambit/envs';
|
|
3
|
+
import { merge } from 'lodash';
|
|
4
|
+
import { PackageJsonProps } from '@teambit/pkg';
|
|
5
|
+
import { TsConfigSourceFile } from 'typescript';
|
|
6
|
+
import { ReactEnv } from '@teambit/react';
|
|
7
|
+
import { CAPSULE_ARTIFACTS_DIR } from '@teambit/builder';
|
|
8
|
+
import type { AspectLoaderMain } from '@teambit/aspect-loader';
|
|
9
|
+
import { Bundler, BundlerContext } from '@teambit/bundler';
|
|
10
|
+
import { WebpackConfigTransformer } from '@teambit/webpack';
|
|
11
|
+
import { Tester } from '@teambit/tester';
|
|
12
|
+
import { COMPONENT_PREVIEW_STRATEGY_NAME, PreviewStrategyName } from '@teambit/preview';
|
|
13
|
+
import { BUNDLE_UI_DIR } from '@teambit/ui';
|
|
14
|
+
import { ConfigWriterEntry } from '@teambit/workspace-config-files';
|
|
15
|
+
import { PrettierConfigWriter } from '@teambit/defender.prettier-formatter';
|
|
16
|
+
import { TypescriptConfigWriter } from '@teambit/typescript.typescript-compiler';
|
|
17
|
+
import { EslintConfigWriter } from '@teambit/defender.eslint-linter';
|
|
18
|
+
import { Logger } from '@teambit/logger';
|
|
19
|
+
|
|
20
|
+
const tsconfig = require('./typescript/tsconfig.json');
|
|
21
|
+
|
|
22
|
+
export const AspectEnvType = 'aspect';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* a component environment built for Aspects .
|
|
26
|
+
*/
|
|
27
|
+
export class AspectEnv implements DependenciesEnv, PackageEnv, PreviewEnv {
|
|
28
|
+
constructor(private reactEnv: ReactEnv, private aspectLoader: AspectLoaderMain, private logger: Logger) {}
|
|
29
|
+
|
|
30
|
+
icon = 'https://static.bit.dev/extensions-icons/default.svg';
|
|
31
|
+
|
|
32
|
+
async __getDescriptor() {
|
|
33
|
+
return {
|
|
34
|
+
type: AspectEnvType,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
getTsConfig(tsConfig: TsConfigSourceFile) {
|
|
39
|
+
const targetConf = merge(tsconfig, tsConfig);
|
|
40
|
+
return targetConf;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// TODO: should probably use the transformer from the main runtime?
|
|
44
|
+
// TODO: this doesn't seems to work as expected, the getTsConfig is not a transformer and the react env API expect a transformers array not an object
|
|
45
|
+
createTsCompiler(tsConfig: TsConfigSourceFile): Compiler {
|
|
46
|
+
return this.reactEnv.getTsCjsCompiler(this.getTsConfig(tsConfig));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* returns a component tester.
|
|
51
|
+
*/
|
|
52
|
+
getTester(jestConfigPath: string, jestModulePath?: string): Tester {
|
|
53
|
+
const config = jestConfigPath || require.resolve('./jest/jest.config');
|
|
54
|
+
return this.reactEnv.getCjsJestTester(config, jestModulePath);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async getTemplateBundler(context: BundlerContext, transformers: WebpackConfigTransformer[] = []): Promise<Bundler> {
|
|
58
|
+
return this.createTemplateWebpackBundler(context, transformers);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async createTemplateWebpackBundler(
|
|
62
|
+
context: BundlerContext,
|
|
63
|
+
transformers: WebpackConfigTransformer[] = []
|
|
64
|
+
): Promise<Bundler> {
|
|
65
|
+
return this.reactEnv.createTemplateWebpackBundler(context, transformers);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
getPackageJsonProps(): PackageJsonProps {
|
|
69
|
+
return {
|
|
70
|
+
...this.reactEnv.getCjsPackageJsonProps(),
|
|
71
|
+
exports: {
|
|
72
|
+
node: {
|
|
73
|
+
require: './dist/{main}.js',
|
|
74
|
+
import: './dist/esm.mjs',
|
|
75
|
+
},
|
|
76
|
+
default: './dist/{main}.js',
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getNpmIgnore(context?: GetNpmIgnoreContext) {
|
|
82
|
+
// ignores only .ts files in the root directory, so d.ts files inside dists are unaffected.
|
|
83
|
+
// without this change, the package has "index.ts" file in the root, causing typescript to parse it instead of the
|
|
84
|
+
// d.ts files. (changing the "types" prop in the package.json file doesn't help).
|
|
85
|
+
|
|
86
|
+
// Ignores all the contents inside the artifacts directory.
|
|
87
|
+
// Asterisk (*) is needed in order to ignore all other contents of the artifacts directory,
|
|
88
|
+
// especially when specific folders are excluded from the ignore e.g. in combination with `!artifacts/ui-bundle`.
|
|
89
|
+
const patterns = ['/*.ts', `${CAPSULE_ARTIFACTS_DIR}/*`];
|
|
90
|
+
|
|
91
|
+
// In order to load the env preview template from core aspects we need it to be in the package of the core envs
|
|
92
|
+
// This is because we don't have the core envs in the local scope so we load it from the package itself in the bvm installation
|
|
93
|
+
// as this will be excluded from the package tar by default (as it's under the CAPSULE_ARTIFACTS_DIR)
|
|
94
|
+
// we want to make sure to add it for the core envs
|
|
95
|
+
if (context && this.aspectLoader.isCoreEnv(context.component.id.toStringWithoutVersion())) {
|
|
96
|
+
patterns.push(`!${CAPSULE_ARTIFACTS_DIR}/env-template`);
|
|
97
|
+
}
|
|
98
|
+
if (context && this.aspectLoader.isCoreAspect(context.component.id.toStringWithoutVersion())) {
|
|
99
|
+
patterns.push(`!${CAPSULE_ARTIFACTS_DIR}/${BUNDLE_UI_DIR}`);
|
|
100
|
+
}
|
|
101
|
+
return patterns;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
getPreviewConfig() {
|
|
105
|
+
return {
|
|
106
|
+
strategyName: COMPONENT_PREVIEW_STRATEGY_NAME as PreviewStrategyName,
|
|
107
|
+
splitComponentBundle: false,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async getDependencies() {
|
|
112
|
+
return {
|
|
113
|
+
dependencies: {
|
|
114
|
+
react: '-',
|
|
115
|
+
'react-dom': '-',
|
|
116
|
+
'core-js': '^3.0.0',
|
|
117
|
+
// For aspects the babel runtime should be a runtime dep not only dev as they are compiled by babel
|
|
118
|
+
'@babel/runtime': '7.20.0',
|
|
119
|
+
},
|
|
120
|
+
// TODO: add this only if using ts
|
|
121
|
+
devDependencies: {
|
|
122
|
+
react: '-',
|
|
123
|
+
'react-dom': '-',
|
|
124
|
+
'@types/mocha': '-',
|
|
125
|
+
'@types/node': '12.20.4',
|
|
126
|
+
'@types/react': '^17.0.8',
|
|
127
|
+
'@types/react-dom': '^17.0.5',
|
|
128
|
+
'@types/jest': '^26.0.0',
|
|
129
|
+
'@types/testing-library__jest-dom': '5.9.5',
|
|
130
|
+
},
|
|
131
|
+
peerDependencies: {
|
|
132
|
+
// TODO: check if we really need react for aspects (maybe for ink support)
|
|
133
|
+
react: '^16.8.0 || ^17.0.0',
|
|
134
|
+
'react-dom': '^16.8.0 || ^17.0.0',
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
workspaceConfig(): ConfigWriterEntry[] {
|
|
140
|
+
return [
|
|
141
|
+
TypescriptConfigWriter.create(
|
|
142
|
+
{
|
|
143
|
+
tsconfig: require.resolve('./typescript/tsconfig.json'),
|
|
144
|
+
// types: resolveTypes(__dirname, ["./types"]),
|
|
145
|
+
},
|
|
146
|
+
this.logger
|
|
147
|
+
),
|
|
148
|
+
EslintConfigWriter.create(
|
|
149
|
+
{
|
|
150
|
+
configPath: require.resolve('./eslint/eslintrc.js'),
|
|
151
|
+
tsconfig: require.resolve('./typescript/tsconfig.json'),
|
|
152
|
+
},
|
|
153
|
+
this.logger
|
|
154
|
+
),
|
|
155
|
+
PrettierConfigWriter.create(
|
|
156
|
+
{
|
|
157
|
+
configPath: require.resolve('./prettier/prettier.config.js'),
|
|
158
|
+
},
|
|
159
|
+
this.logger
|
|
160
|
+
),
|
|
161
|
+
];
|
|
162
|
+
}
|
|
163
|
+
}
|