Skip to content

Commit c606137

Browse files
committed
chore: fix constraints for 2nd gen
1 parent 150b5f2 commit c606137

File tree

3 files changed

+61
-27
lines changed

3 files changed

+61
-27
lines changed

2nd-gen/packages/core/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@
6161
"design-system",
6262
"spectrum",
6363
"adobe",
64+
"adobe-spectrum",
6465
"web components",
65-
"base-classes",
66-
"abstract"
67-
]
66+
"web-components",
67+
"lit-element",
68+
"lit-html",
69+
"component",
70+
"css"
71+
],
72+
"publishConfig": {
73+
"access": "public"
74+
},
75+
"module": "./dist/index.js"
6876
}

2nd-gen/packages/swc/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,17 @@
8585
"design-system",
8686
"spectrum",
8787
"adobe",
88+
"adobe-spectrum",
8889
"web components",
89-
"lit",
90-
"components"
90+
"web-components",
91+
"lit-element",
92+
"lit-html",
93+
"component",
94+
"css"
9195
],
92-
"customElements": ".storybook/custom-elements.json"
96+
"customElements": ".storybook/custom-elements.json",
97+
"publishConfig": {
98+
"access": "public"
99+
},
100+
"module": "./dist/index.js"
93101
}

yarn.config.cjs

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,13 @@ module.exports = defineConfig({
2727
* Fetch a list of all the component workspaces using a glob pattern
2828
* @type {string[]} components
2929
*/
30-
const components = fg.sync('{packages,tools}/*', {
31-
cwd: __dirname,
32-
onlyDirectories: true,
33-
});
30+
const components = fg.sync(
31+
'{1st-gen/{packages,tools},2nd-gen/packages}/*',
32+
{
33+
cwd: __dirname,
34+
onlyDirectories: true,
35+
}
36+
);
3437

3538
/**
3639
* This function checks the workspace for any local package references
@@ -101,9 +104,14 @@ module.exports = defineConfig({
101104
* to simplify into a readable set of operations
102105
* @param {Workspace} workspace
103106
* @param {string} folderName
107+
* @param {boolean} is2ndGen
104108
* @returns {void}
105109
*/
106-
function validateComponentPackageJson(workspace, folderName) {
110+
function validateComponentPackageJson(
111+
workspace,
112+
folderName,
113+
is2ndGen = false
114+
) {
107115
// Only update the homepage if it does not already exist
108116
if (!workspace.manifest.homepage) {
109117
workspace.set(
@@ -112,24 +120,32 @@ module.exports = defineConfig({
112120
);
113121
}
114122

115-
workspace.set('publishConfig.access', 'public');
116123
workspace.set('type', 'module');
124+
workspace.set('publishConfig.access', 'public');
117125
workspace.set('keywords', keywords(['component', 'css']));
118126

119-
// A subset of components have a different entry point than the default
120-
if (
121-
[
122-
'clear-button',
123-
'close-button',
124-
'modal',
125-
'opacity-checkerboard',
126-
].includes(folderName)
127-
) {
128-
workspace.set('main', `./src/${folderName}.css.js`);
129-
workspace.set('module', `./src/${folderName}.css.js`);
127+
// 2nd-gen packages use different entry points
128+
if (is2ndGen) {
129+
// 2nd-gen uses dist folder for builds
130+
workspace.set('main', './dist/index.js');
131+
workspace.set('module', './dist/index.js');
130132
} else {
131-
workspace.set('main', './src/index.js');
132-
workspace.set('module', './src/index.js');
133+
// 1st-gen packages use src folder
134+
// A subset of components have a different entry point than the default
135+
if (
136+
[
137+
'clear-button',
138+
'close-button',
139+
'modal',
140+
'opacity-checkerboard',
141+
].includes(folderName)
142+
) {
143+
workspace.set('main', `./src/${folderName}.css.js`);
144+
workspace.set('module', `./src/${folderName}.css.js`);
145+
} else {
146+
workspace.set('main', './src/index.js');
147+
workspace.set('module', './src/index.js');
148+
}
133149
}
134150
}
135151

@@ -245,8 +261,10 @@ module.exports = defineConfig({
245261
* Process the components workspaces with component-specific configuration
246262
*/
247263
if (isComponent) {
248-
const folderName = workspace.cwd?.split('/')?.[1];
249-
validateComponentPackageJson(workspace, folderName);
264+
// Get the last part of the path (e.g., 'button' from '1st-gen/packages/button')
265+
const folderName = workspace.cwd?.split('/').pop();
266+
const is2ndGen = workspace.cwd.startsWith('2nd-gen/');
267+
validateComponentPackageJson(workspace, folderName, is2ndGen);
250268
validateLocalPackages(workspace);
251269
} else {
252270
/**

0 commit comments

Comments
 (0)