mirror of
https://github.com/primer/css.git
synced 2024-12-23 06:01:54 +03:00
Removing storybook
This commit is contained in:
parent
01a05b3f19
commit
a4ce7a6980
1
.github/workflows/release_canary.yml
vendored
1
.github/workflows/release_canary.yml
vendored
@ -10,7 +10,6 @@ on:
|
||||
paths-ignore:
|
||||
- '.changeset/**'
|
||||
- '.github/**'
|
||||
- '.storybook/**'
|
||||
- 'docs/**'
|
||||
- 'lib/**'
|
||||
- '__tests__/**'
|
||||
|
@ -1,7 +1,6 @@
|
||||
__tests__/
|
||||
.changeset/
|
||||
.github/
|
||||
.storybook/
|
||||
docs/
|
||||
script/
|
||||
# we ignore this because everything in src/ is copied out in script/prepublish
|
||||
|
@ -1,13 +0,0 @@
|
||||
{
|
||||
"extends": [
|
||||
"plugin:react/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-namespace": 0
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
}
|
||||
}
|
@ -1 +0,0 @@
|
||||
import '@storybook/addon-viewport/register'
|
@ -1,46 +0,0 @@
|
||||
import React from 'react'
|
||||
import {configure, addParameters, addDecorator} from '@storybook/react'
|
||||
import {name, homepage, version} from '../package.json'
|
||||
import {INITIAL_VIEWPORTS} from '@storybook/addon-viewport'
|
||||
|
||||
// this enables HMR for the SCSS source files
|
||||
import '../src/index.scss'
|
||||
|
||||
// wrap every view in 4x padding
|
||||
addDecorator(story => <div className="p-4">{story()}</div>)
|
||||
|
||||
addParameters({
|
||||
options: {
|
||||
brandTitle: `${name}@${version}`,
|
||||
brandUrl: homepage,
|
||||
showAddonsPanel: false
|
||||
},
|
||||
viewport: {
|
||||
viewports: {
|
||||
sm: {
|
||||
name: 'Small ($width-sm)',
|
||||
styles: {width: '544px', height: 'auto'}
|
||||
},
|
||||
md: {
|
||||
name: 'Medium ($width-md)',
|
||||
styles: {width: '768px', height: 'auto'}
|
||||
},
|
||||
lg: {
|
||||
name: 'Large ($width-lg)',
|
||||
styles: {width: '1012px', height: 'auto'}
|
||||
},
|
||||
xl: {
|
||||
name: 'XL ($width-xl)',
|
||||
styles: {width: '1280px', height: 'auto'}
|
||||
},
|
||||
...INITIAL_VIEWPORTS
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
configure(() => {
|
||||
const loadMarkdown = require.context('../pages/css', true, /\.md$/)
|
||||
for (const path of loadMarkdown.keys()) {
|
||||
loadMarkdown(path)
|
||||
}
|
||||
}, module)
|
@ -1,3 +0,0 @@
|
||||
<link rel="stylesheet" href="https://unpkg.com/octicons@8.5.0/build/build.css">
|
||||
<link rel="stylesheet" href="https://github.com/site/assets/styleguide.css">
|
||||
<script src="https://github.com/site/assets/styleguide.js" async></script>
|
@ -1,48 +0,0 @@
|
||||
/* eslint-disable no-console */
|
||||
const {basename, dirname, join} = require('path')
|
||||
const parseFromString = require('code-blocks/lib/fromString')
|
||||
|
||||
module.exports = function storyLoader(markdown) {
|
||||
// resourcePath is the full path ("/Users/probot/primer/css/...") to the file being parsed
|
||||
// rootContext is really just dirname(resourcePath)
|
||||
const {resourcePath = '', rootContext} = this
|
||||
|
||||
// the sourcePath option provides a way to collapse the
|
||||
// navigation hierarchy by trimming even more of the
|
||||
// resourcePath's prefix; if it's not provided, use the
|
||||
// rootContext
|
||||
const {sourcePath = rootContext} = this.query || {}
|
||||
|
||||
// strip the sourcePath from the beginning of the resourcePath
|
||||
const file = resourcePath.replace(`${sourcePath}/`, '')
|
||||
const path = join(dirname(file), basename(file, '.md'))
|
||||
|
||||
const stories = storiesFromMarkdown(markdown, file)
|
||||
if (stories.length) {
|
||||
console.warn(`${stories.length} stories found in ${file}!`)
|
||||
return `
|
||||
const {storiesOf} = require('@storybook/react')
|
||||
const htmlToReact = require('html-to-react')
|
||||
|
||||
const chapter = storiesOf(${JSON.stringify(path)}, module)
|
||||
const stories = ${JSON.stringify(stories)}
|
||||
|
||||
const htmlParser = new htmlToReact.Parser()
|
||||
for (const {title, value} of stories) {
|
||||
chapter.add(title, () => htmlParser.parse(value))
|
||||
}
|
||||
`
|
||||
} else {
|
||||
return `module.exports = {markdown: ${JSON.stringify(markdown)}}`
|
||||
}
|
||||
}
|
||||
|
||||
function storiesFromMarkdown(markdown, file) {
|
||||
const path = file.replace(/^\.\//, '')
|
||||
return parseFromString(markdown, path).filter(block => {
|
||||
// yes: ```html
|
||||
// no: ```html dead
|
||||
// no: ```html inert
|
||||
return block.lang === 'html' && !block.info.dead && !block.info.inert
|
||||
})
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
const {resolve} = require('path')
|
||||
const pagesPath = resolve(__dirname, '../pages/css')
|
||||
|
||||
module.exports = ({config}) => {
|
||||
const babel = config.module.rules[0].use[0]
|
||||
|
||||
config.module.rules = config.module.rules.filter(rule => {
|
||||
return !rule.test.test('test.md')
|
||||
})
|
||||
|
||||
config.module.rules.push(
|
||||
{
|
||||
test: /\.md$/,
|
||||
include: pagesPath,
|
||||
loaders: [
|
||||
babel,
|
||||
{
|
||||
loader: require.resolve('./story-loader'),
|
||||
options: {
|
||||
sourcePath: pagesPath
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
loaders: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
config: {
|
||||
path: require.resolve('../postcss.config.js')
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
)
|
||||
|
||||
return config
|
||||
}
|
@ -24,11 +24,8 @@
|
||||
"stylelint": "stylelint --quiet src",
|
||||
"eslint": "eslint deprecations.js __tests__",
|
||||
"prepublishOnly": "script/prepublish",
|
||||
"publish-storybook": "script/publish-storybook",
|
||||
"start": "npm run dev",
|
||||
"dev": "cd docs && npm install && npm run develop",
|
||||
"start-storybook": "start-storybook -p 8001",
|
||||
"build-storybook": "build-storybook -o .storybuild",
|
||||
"pretest": "yarn dist && script/pretest",
|
||||
"test": "jest",
|
||||
"release": "changeset publish"
|
||||
@ -42,12 +39,8 @@
|
||||
"@changesets/changelog-github": "^0.3.0",
|
||||
"@changesets/cli": "^2.14.1",
|
||||
"@github/prettier-config": "0.0.4",
|
||||
"@storybook/addon-viewport": "5.3.18",
|
||||
"@storybook/react": "5.3.18",
|
||||
"autoprefixer": "9.8.6",
|
||||
"code-blocks": "^1.1.0",
|
||||
"colorette": "^1.2.1",
|
||||
"css-loader": "1.0.0",
|
||||
"cssstats": "3.3.0",
|
||||
"eslint": "^7.23.0",
|
||||
"eslint-plugin-github": "^4.1.2",
|
||||
@ -57,7 +50,6 @@
|
||||
"filesize": "4.1.2",
|
||||
"front-matter": "4.0.2",
|
||||
"fs-extra": "^4.0.2",
|
||||
"gh-pages": "^1.0.0",
|
||||
"globby": "^6.1.0",
|
||||
"jest": "26.6.3",
|
||||
"js-yaml": "4.0.0",
|
||||
|
@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
file=publish-files.log
|
||||
if [[ -f $file ]]; then
|
||||
echo "deleting all files listed in $file..."
|
||||
cat $file | xargs rm -rfv
|
||||
rm $file
|
||||
fi
|
||||
|
||||
if [[ "$GITHUB_REF" = "refs/heads/main" ]]; then
|
||||
npm run --silent publish-storybook || (
|
||||
echo "Whoops! Failed to publish Storybook. This is not a fatal error."
|
||||
)
|
||||
fi
|
||||
|
||||
# TODO: remove this in v13
|
||||
rm -rf build/
|
@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
remote=${STORYBOOK_GIT_URL:-https://github.com/primer/storybook}
|
||||
npm run build-storybook
|
||||
npx gh-pages -d .storybuild -b gh-pages -r "$remote" "$@"
|
Loading…
Reference in New Issue
Block a user