Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Create Development Kitchen #963

Merged
merged 31 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
edcb038
rename editorial directory to kitchen
Aug 31, 2021
552f931
remove web, ios and android folders from kitchen
Aug 31, 2021
d95cb6f
rename editorial package to source-kitchen-react
Aug 31, 2021
67fdd25
reset source-kitchen-react version to 0.0.1
Aug 31, 2021
66fff46
Update workspace config for kitchen
Aug 31, 2021
9601f3f
remove individual package.json files in kitchen
Aug 31, 2021
c1dfa5b
remove individual tsconfig.json files in kitchen
Aug 31, 2021
ead59ef
Rename starRating to star-rating
Aug 31, 2021
006bf57
update kitchen index.tsx
Aug 31, 2021
dcaf0c9
Update component READMEs to point to source-kitchen-react npm package
Aug 31, 2021
4982713
update kitchen storybook titles
Aug 31, 2021
703dff0
Update the kitchen README
Aug 31, 2021
a68b66e
update scripts for kitchen
Aug 31, 2021
80686d4
add release process for kitchen
Aug 31, 2021
52eb675
add kitchen to autolabeler
Aug 31, 2021
f70d3f5
Move @guardian/types to be dev and peer dep
Sep 2, 2021
a9304bd
bump version of @guardian/types
Sep 2, 2021
43c53c6
Update story titles
Sep 2, 2021
c9f8e8a
Remove kitchen script from package.json
Sep 2, 2021
2c4e56e
Update src/kitchen/README.md
Sep 2, 2021
3be6657
Apply suggestions from code review
Sep 2, 2021
d078e7f
add contributing guidelines for dev kitchen
SiAdcock Sep 2, 2021
484cd8c
set dotcom-platform as codeowners of all current kitchen components
SiAdcock Sep 2, 2021
4b7cdf5
reinstate kitchen workspace scripts
SiAdcock Sep 2, 2021
e6836b3
make package naming consistent
SiAdcock Sep 2, 2021
1868179
explicitly export components and prop types for each component
SiAdcock Sep 2, 2021
d1243af
Update kitchen package name
Sep 10, 2021
02cbc27
Move kitchen to packages/@guardian/source-react-components-developmen…
Sep 10, 2021
acbcc1e
Merge branch 'main' into development-kitchen
Sep 10, 2021
24cf88b
Pass count arg as string in stories
Sep 10, 2021
c3391a0
rename button to editorial button
Sep 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
* @guardian/client-side-infra

/src/kitchen/components/button @guardian/dotcom-platform
/src/kitchen/components/lines @guardian/dotcom-platform
/src/kitchen/components/logo @guardian/dotcom-platform
/src/kitchen/components/quote-icon @guardian/dotcom-platform
/src/kitchen/components/star-rating @guardian/dotcom-platform
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guardian/dotcom-platform does this look okay to you? 🙏

1 change: 1 addition & 0 deletions .github/autolabeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ button: ['src/core/components/button']
checkbox: ['src/core/components/checkbox']
choice card: ['src/core/components/choice-card']
footer: ['src/core/components/footer']
kitchen: ['src/kitchen']
label: ['src/core/components/label']
layout: ['src/core/components/layout']
link: ['src/core/components/link']
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Contribution guidelines

Please read the [Contributing Guidelines](https://www.theguardian.design/2a1e5182b/p/77c9d9-contributing) on the Source website.
Please read the [Contributing Guidelines](docs/08-contributing.md) in the docs
directory.
5 changes: 5 additions & 0 deletions docs/08-contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ $ yarn storybook

## Guidelines

### Creating new components

- New components should be added to the [Development Kitchen](../src/kitchen).
- New components must have a CODEOWNER.

### Using Emotion

- First familiarise yourself with Emotion's excellent documentation (we use [the React flavour](https://emotion.sh/docs/introduction#react))
Expand Down
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"workspaces": [
"src/core/*",
"src/core/components/*",
"src/editorial/web",
"src/editorial/web/components/*"
"src/kitchen"
],
"scripts": {
"build-storybook": "build-storybook -o dist",
Expand All @@ -16,16 +15,23 @@
"clean": "rm -rf dist",
"clean:all": "ts-node ./scripts/clean-all",
"fix": "yarn lint:js --fix",
"kitchen": "yarn workspace @guardian/source-kitchen-react",
jamie-lynch marked this conversation as resolved.
Show resolved Hide resolved
"lint": "yarn lint:js && yarn lint:styles",
"lint:js": "eslint . --ext .ts,.tsx,.js",
"lint:styles": "stylelint src/core/**/styles.ts",
"prepare": "husky install",
"publish:release": "ts-node ./scripts/publish-release",
"publish:release:kitchen": "ts-node ./scripts/publish-release-kitchen",
"release:major:all": "yarn build:all && yarn validate && yarn verbump:major:all && yarn publish:release",
"release:major:kitchen": "yarn kitchen build && yarn validate && yarn kitchen verbump:major && yarn publish:release:kitchen",
"release:minor:all": "yarn build:all && yarn validate && yarn verbump:minor:all && yarn publish:release",
"release:minor:kitchen": "yarn kitchen build && yarn validate && yarn kitchen verbump:minor && yarn publish:release:kitchen",
"release:patch:all": "yarn build:all && yarn validate && yarn verbump:patch:all && yarn publish:release",
"release:patch:kitchen": "yarn kitchen build && yarn validate && yarn kitchen verbump:patch && yarn publish:release:kitchen",
"release:prerelease-bump:all": "yarn validate && yarn verbump:prerelease:all && yarn publish:release",
"release:prerelease-bump:kitchen": "yarn validate && yarn kitchen verbump:prerelease && yarn publish:release:kitchen",
"release:prerelease:all": "yarn validate && yarn publish:release",
"release:prerelease:kitchen": "yarn validate && yarn publish:release:kitchen",
jamie-lynch marked this conversation as resolved.
Show resolved Hide resolved
"storybook": "start-storybook -p 6006",
"tag:beta:all": "ts-node ./scripts/tag-beta-all",
"test": "jest",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const build = (dir: string) => {
});
};

const { foundations, icons, brand, helpers, editorial, coreComponents } = paths;
const { foundations, icons, brand, helpers, kitchen, coreComponents } = paths;

// Build these packages in the specified order
const prioritisedPackages = [
Expand All @@ -22,7 +22,7 @@ const prioritisedPackages = [
`${coreComponents}/user-feedback`,
`${coreComponents}/label`,
`${coreComponents}/button`,
editorial,
kitchen,
];

// Build these packages in parallel
Expand Down
4 changes: 2 additions & 2 deletions scripts/clean-all.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import execa from 'execa';
import { paths, getComponentPaths } from './paths';

const { foundations, icons, brand, helpers, editorial } = paths;
const { foundations, icons, brand, helpers, kitchen } = paths;

const clean = (dir: string) => {
return execa('yarn', ['--cwd', `${dir}`, 'run', 'clean'], {
stdio: 'inherit',
});
};
[foundations, icons, brand, helpers, editorial].forEach((dir) => {
[foundations, icons, brand, helpers, kitchen].forEach((dir) => {
clean(dir);
});

Expand Down
40 changes: 11 additions & 29 deletions scripts/package-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,31 @@ const readdirP = promisify(readdir);
const statP = promisify(stat);

const coreComponents = join(__dirname, '../src/core/components');
const editorialComponents = join(__dirname, '../src/editorial/web/components');

const isDirectory = (path: string) =>
statP(path).then((stats) => stats.isDirectory());

export const getComponentPackageNames = () =>
Promise.all([
readdirP(coreComponents)
.then((componentDirs) =>
Promise.all(
componentDirs.map((componentDirName) =>
isDirectory(
`${coreComponents}/${componentDirName}`,
).then((isDir) => {
readdirP(coreComponents)
.then((componentDirs) =>
Promise.all(
componentDirs.map((componentDirName) =>
isDirectory(`${coreComponents}/${componentDirName}`).then(
(isDir) => {
if (!isDir) return;

return `@guardian/src-${componentDirName}`;
}),
},
),
),
)
.then((paths) => Promise.resolve(paths.filter((path) => !!path))),
readdirP(editorialComponents)
.then((componentDirs) =>
Promise.all(
componentDirs.map((componentDirName) =>
isDirectory(
`${editorialComponents}/${componentDirName}`,
).then((isDir) => {
if (!isDir) return;

return `@guardian/src-ed-${componentDirName}`;
}),
),
),
)
.then((paths) => Promise.resolve(paths.filter((path) => !!path))),
]).then(([corePaths, editorialPaths]) => [...corePaths, ...editorialPaths]);
),
)
.then((paths) => Promise.resolve(paths.filter((path) => !!path)));

export const packageNames = {
foundations: '@guardian/src-foundations',
icons: '@guardian/src-icons',
brand: '@guardian/src-brand',
helpers: '@guardian/src-helpers',
editorial: '@guardian/editorial',
kitchen: '@guardian/source-kitchen-react',
};
43 changes: 12 additions & 31 deletions scripts/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,35 @@ const foundations = join(__dirname, '../src/core/foundations');
const icons = join(__dirname, '../src/core/icons');
const brand = join(__dirname, '../src/core/brand');
const helpers = join(__dirname, '../src/core/helpers');
const editorial = join(__dirname, '../src/editorial/web');
const kitchen = join(__dirname, '../src/kitchen');
const coreComponents = join(__dirname, '../src/core/components');
const editorialComponents = join(__dirname, '../src/editorial/web/components');

const isDirectory = (path: string) =>
statP(path).then((stats) => stats.isDirectory());

export const getComponentPaths = () =>
Promise.all([
readdirP(coreComponents)
.then((componentDirs) =>
Promise.all(
componentDirs.map((componentDirName) =>
isDirectory(
`${coreComponents}/${componentDirName}`,
).then((isDir) => {
readdirP(coreComponents)
.then((componentDirs) =>
Promise.all(
componentDirs.map((componentDirName) =>
isDirectory(`${coreComponents}/${componentDirName}`).then(
(isDir) => {
if (!isDir) return;

return `${coreComponents}/${componentDirName}`;
}),
},
),
),
)
.then((paths) => Promise.resolve(paths.filter((path) => !!path))),
readdirP(editorialComponents)
.then((componentDirs) =>
Promise.all(
componentDirs.map((componentDirName) =>
isDirectory(
`${editorialComponents}/${componentDirName}`,
).then((isDir) => {
if (!isDir) return;

return `${editorialComponents}/${componentDirName}`;
}),
),
),
)
.then((paths) => Promise.resolve(paths.filter((path) => !!path))),
]).then(([corePaths, editorialPaths]) => [...corePaths, ...editorialPaths]);
),
)
.then((paths) => Promise.resolve(paths.filter((path) => !!path)));

export const paths = {
root,
foundations,
icons,
brand,
helpers,
editorial,
kitchen,
coreComponents,
editorialComponents,
};
28 changes: 28 additions & 0 deletions scripts/publish-release-kitchen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import execa from 'execa';
import { paths } from './paths';

const { kitchen } = paths;

console.log('Publishing @guardian/source-kitchen-react');

import(`${kitchen}/package.json`)
.then(({ version }) => {
return execa(
'yarn',
[
'--cwd',
`${kitchen}`,
'run',
'publish:public',
'--new-version',
version,
],
{
stdio: 'inherit',
},
);
})
.catch((err) => {
console.log('***PUBLISH FAILED***\n', err);
process.exit(1);
});
3 changes: 1 addition & 2 deletions scripts/publish-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const publish = (dir: string) => {
);
};

const { foundations, icons, brand, helpers, coreComponents, editorial } = paths;
const { foundations, icons, brand, helpers, coreComponents } = paths;

// Publish these packages in the specified order
const prioritisedPackages = [
Expand All @@ -23,7 +23,6 @@ const prioritisedPackages = [
`${coreComponents}/user-feedback`,
`${coreComponents}/label`,
`${coreComponents}/button`,
editorial,
];

// Publish these packages in parallel
Expand Down
4 changes: 2 additions & 2 deletions scripts/tag-beta-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ const tag = (packageName: string) => {
});
};

const { foundations, icons, brand, helpers, editorial } = packageNames;
const { foundations, icons, brand, helpers } = packageNames;

const packages = getComponentPackageNames().then((ps) =>
ps.concat([foundations, icons, brand, helpers, editorial]),
ps.concat([foundations, icons, brand, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-major-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-minor-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-patch-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-premajor-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-preminor-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-prerelease-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
4 changes: 2 additions & 2 deletions scripts/verbump-src-deps-all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const verbump = (dir: string) => {
});
};

const { root, foundations, icons, brand, helpers, editorial } = paths;
const { root, foundations, icons, brand, helpers } = paths;

const packages = getComponentPaths().then((paths) =>
paths.concat([foundations, icons, brand, root, helpers, editorial]),
paths.concat([foundations, icons, brand, root, helpers]),
);

packages.then((ps) => {
Expand Down
Empty file removed src/editorial/android/.gitkeep
Empty file.
Empty file removed src/editorial/ios/.gitkeep
Empty file.
Loading