1
1
mirror of https://github.com/primer/css.git synced 2024-10-03 20:07:58 +03:00

Merge pull request #1291 from primer/tidy_up_file_structure

Tidying up the directory structure moving contributing docs
This commit is contained in:
Jon Rohan 2021-04-01 12:50:58 -07:00 committed by GitHub
commit 01a05b3f19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 111 additions and 79 deletions

View File

@ -72,7 +72,7 @@ Here are a few things you can do that will increase the likelihood of your pull
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
## Releasing a new Primer CSS version
See [RELEASING.md](../RELEASING.md) for our release process.
See [RELEASING.md](./RELEASING.md) for our release process.
## Resources

View File

View File

@ -51,7 +51,7 @@
- [ ] Update `github/github`
- [ ] Tell the world (Slack, Twitter, Team post)
For more details, see [RELEASING.md](https://github.com/primer/css/blob/main/RELEASING.md).
For more details, see [RELEASING.md](https://github.com/primer/css/blob/main/.github/RELEASING.md).
/cc @primer/ds-core
```

View File

@ -1,16 +1,14 @@
*.log
__tests__/
.changeset/
.github/
.next/
.storybook/
next.config.js
now.json
docs/
docs-test/
lib/
__tests__/
pages/
script/
# we ignore this because everything in src/ is copied out in script/prepublish
src/
tmp/
docs.scss
.*
*.log
now.json
*.config.js

View File

@ -50,13 +50,13 @@ You can import individual Primer modules directly from the `@primer/css` package
```
## Development
See [DEVELOP.md](./DEVELOP.md) for development docs.
See [DEVELOP.md](./.github/DEVELOP.md) for development docs.
## Releasing (for GitHub staff)
You can find docs about our release process in [RELEASING.md](./RELEASING.md).
You can find docs about our release process in [RELEASING.md](./.github/RELEASING.md).
## Documentation
The [Primer CSS docs site](https://primer.style/css) is deployed from this repo with [primer/deploy](https://github.com/primer/deploy). See [the development docs](DEVELOP.md#docs-site) for more info.
The [Primer CSS docs site](https://primer.style/css) is deployed from this repo with [primer/deploy](https://github.com/primer/deploy). See [the development docs](./.github/DEVELOP.md#docs-site) for more info.
## License

View File

@ -1,5 +1,8 @@
{
"extends": [
"plugin:jest/recommended"
]
],
"rules": {
"eslint-comments/no-use": 0
}
}

View File

@ -10,9 +10,9 @@ describe('./dist/ folder', () => {
let distCSS, distMap, distJS
beforeAll(() => {
distCSS = distDir.filter( i => i.match(/\.css$/) )
distMap = distDir.filter( i => i.match(/\.map$/) )
distJS = distDir.filter( i => i.match(/\.js$/) )
distCSS = distDir.filter(i => i.match(/\.css$/))
distMap = distDir.filter(i => i.match(/\.map$/))
distJS = distDir.filter(i => i.match(/\.js$/))
})
it('is not empty', () => {
@ -21,15 +21,15 @@ describe('./dist/ folder', () => {
})
it('contains source maps', () => {
distCSS.forEach( file => {
for (const file of distCSS) {
expect(distMap).toContain(`${file}.map`)
})
}
})
it('contains stats export files', () => {
distCSS.forEach( file => {
expect(distJS).toContain(file.replace('.css','.js'))
})
for (const file of distCSS) {
expect(distJS).toContain(file.replace('.css', '.js'))
}
})
it('contains stats/ folder', () => {
@ -50,8 +50,8 @@ describe('./dist/stats/ folder', () => {
})
it('contains a css file for each stat file', () => {
statsDir.forEach( file => {
expect(distDir).toContain(file.replace('.json','.css'))
})
for (const file of statsDir) {
expect(distDir).toContain(file.replace('.json', '.css'))
}
})
})

View File

@ -22,7 +22,7 @@ describe('deprecations', () => {
if (deprecations.length) {
// Selectors were marked to be deprecated in this version,
// but were not removed from the codebase. Please remove these selectors.
expect(deprecations.sort()).toEqual(removed.sort())
expect(deprecations.sort()).toEqual(removed.sort()) // eslint-disable-line jest/no-conditional-expect
}
})
@ -41,7 +41,7 @@ describe('deprecations', () => {
if (deprecations.length) {
// Variables were marked to be deprecated in this version,
// but were not removed from the codebase. Please remove these variables.
expect(deprecations.sort()).toEqual(removed.sort())
expect(deprecations.sort()).toEqual(removed.sort()) // eslint-disable-line jest/no-conditional-expect
}
})

View File

@ -9,25 +9,25 @@ beforeAll(async () => {
describe('frontmatter', () => {
it('page title matches link title', () => {
navLinks.forEach(link => {
for (const link of navLinks) {
const content = contentFM[link['url']]
expect(content).not.toBeNull()
expect(content['title']).toBe(link['title'])
})
}
})
it('contains path attribute', () => {
Object.values(contentFM).forEach( v => {
for (const v of Object.values(contentFM)) {
expect(v['path']).not.toBeNull()
})
}
})
})
describe('navigation', () => {
it('has a file for each nav item', () => {
navLinks.forEach(link => {
for (const link of navLinks) {
const content = contentFM[link['url']]
expect(content).not.toBeNull()
})
}
})
})

View File

@ -1,4 +1,4 @@
const fs = require('fs')
const fs = require('fs')
const frontMatter = require('front-matter')
const yaml = require('js-yaml')
const globby = require('globby')
@ -8,15 +8,15 @@ const docsPath = join(__dirname, '../../docs')
function collectNavLinks(links) {
let foundLinks = []
links.forEach(link => {
for (const link of links) {
foundLinks.push({
title: link['title'],
url: link['url']
})
if(link['children']) {
if (link['children']) {
foundLinks = foundLinks.concat(collectNavLinks(link['children']))
}
})
}
return foundLinks
}
@ -26,14 +26,14 @@ function getNavigationLinks() {
}
async function getContentFrontmatter() {
let fm = {}
const fm = {}
const paths = await globby(join(docsPath, './content/**/*.md*'))
paths.forEach(path => {
for (const path of paths) {
const contents = fs.readFileSync(path, 'utf8')
const fmContents = frontMatter(contents)
fm[path.replace(join(docsPath, './content'), '').replace(/(\/index)?\.mdx?/,'')] = fmContents['attributes']
})
fm[path.replace(join(docsPath, './content'), '').replace(/(\/index)?\.mdx?/, '')] = fmContents['attributes']
}
return fm
}

View File

@ -4,6 +4,12 @@
* array and a "message" string.
*/
const versionDeprecations = {
'17.0.0': [
{
selectors: [':-ms-input-placeholder'],
message: 'Browserslist update to match github has removed the need for this pseudoselector'
}
],
'16.0.0': [
{
selectors: [

View File

@ -105,7 +105,7 @@ We have several checks and tools in place to help us plan, track, and catch both
[This file][deprecations.js] is where we document all of our current and _planned_ CSS selector and SCSS variable deprecations (removals), and is used to generate [deprecation data](../tools/deprecations) for other tools.
### `primer-css/TODO`
[This stylelint rule][lib/stylelint-todo.js] looks for comments in the form:
[This stylelint rule][script/stylelint-todo.js] looks for comments in the form:
```scss
// TODO@<version>: <message>
@ -158,4 +158,4 @@ To understand what choice to make, you'll need to understand semver and know if
[semantic versioning]: https://semver.org
[script/test-deprecations.js]: https://github.com/primer/css/tree/main/script/test-deprecations.js
[deprecations.js]: https://github.com/primer/css/tree/main/deprecations.js
[lib/stylelint-todo.js]: https://github.com/primer/css/tree/main/lib/stylelint-todo.js
[script/stylelint-todo.js]: https://github.com/primer/css/tree/main/script/stylelint-todo.js

View File

@ -22,7 +22,7 @@
"fresh": "rm -rf node_modules; npm install",
"dist": "script/dist.js",
"stylelint": "stylelint --quiet src",
"eslint": "eslint deprecations.js lib",
"eslint": "eslint deprecations.js __tests__",
"prepublishOnly": "script/prepublish",
"publish-storybook": "script/publish-storybook",
"start": "npm run dev",
@ -34,7 +34,7 @@
"release": "changeset publish"
},
"dependencies": {
"@primer/octicons": "^9.1.1",
"@primer/octicons": "12.1.0",
"@primer/primitives": "4.1.0"
},
"devDependencies": {
@ -49,9 +49,9 @@
"colorette": "^1.2.1",
"css-loader": "1.0.0",
"cssstats": "3.3.0",
"details-dialog-element": "^1.4.0",
"eslint": "^7.23.0",
"eslint-plugin-github": "^4.1.2",
"eslint-plugin-jest": "24.3.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.1",
"filesize": "4.1.2",

View File

@ -1,25 +0,0 @@
---
bundle: "{bundle}"
generated: true
---
# Primer CSS: `{bundle}` bundle
## Usage
Primer CSS source files are written in [SCSS]. To include this Primer CSS module in your own build, ensure that your `node_modules` directory is listed in your Sass include paths, then import it with:
```scss
@import "@primer/css/{bundle}/index.scss";
```
## Build
The `@primer/css` npm package includes a standalone CSS build of this module in `dist/{bundle}.css`.
## License
[MIT](https://github.com/primer/css/blob/main/LICENSE) &copy; [GitHub](https://github.com/)
[scss]: https://sass-lang.com/documentation/syntax#scss

View File

@ -2,7 +2,7 @@ const currentVersion = process.env.PRIMER_VERSION || require('./package.json').v
module.exports = {
extends: ['stylelint-config-primer'],
plugins: ['stylelint-scss', './lib/stylelint-todo'],
plugins: ['stylelint-scss', './script/stylelint-todo'],
syntax: 'scss',
rules: {
'scss/dollar-variable-default': [true, {ignore: 'local'}],

View File

@ -1731,9 +1731,10 @@
"@nodelib/fs.scandir" "2.1.3"
fastq "^1.6.0"
"@primer/octicons@^9.1.1":
version "9.1.1"
resolved "https://registry.npmjs.org/@primer/octicons/-/octicons-9.1.1.tgz"
"@primer/octicons@12.1.0":
version "12.1.0"
resolved "https://registry.yarnpkg.com/@primer/octicons/-/octicons-12.1.0.tgz#770c8395dc54604637c56ccb261707f9e9d59ddb"
integrity sha512-jayKLMTCx/0zh4fjYmkxdlEgQ8STwevn5S48fkvi/03asITmBkaYAMPrUgO8VNSQkSPHIEuc3oTLXgh+JwH0UQ==
dependencies:
object-assign "^4.1.1"
@ -2430,6 +2431,18 @@
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"
"@typescript-eslint/experimental-utils@^4.0.1":
version "4.20.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-4.20.0.tgz#a8ab2d7b61924f99042b7d77372996d5f41dc44b"
integrity sha512-sQNlf6rjLq2yB5lELl3gOE7OuoA/6IVXJUJ+Vs7emrQMva14CkOwyQwD7CW+TkmOJ4Q/YGmoDLmbfFrpGmbKng==
dependencies:
"@types/json-schema" "^7.0.3"
"@typescript-eslint/scope-manager" "4.20.0"
"@typescript-eslint/types" "4.20.0"
"@typescript-eslint/typescript-estree" "4.20.0"
eslint-scope "^5.0.0"
eslint-utils "^2.0.0"
"@typescript-eslint/parser@>=2.25.0":
version "4.19.0"
resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.19.0.tgz"
@ -2446,10 +2459,23 @@
"@typescript-eslint/types" "4.19.0"
"@typescript-eslint/visitor-keys" "4.19.0"
"@typescript-eslint/scope-manager@4.20.0":
version "4.20.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-4.20.0.tgz#953ecbf3b00845ece7be66246608be9d126d05ca"
integrity sha512-/zm6WR6iclD5HhGpcwl/GOYDTzrTHmvf8LLLkwKqqPKG6+KZt/CfSgPCiybshmck66M2L5fWSF/MKNuCwtKQSQ==
dependencies:
"@typescript-eslint/types" "4.20.0"
"@typescript-eslint/visitor-keys" "4.20.0"
"@typescript-eslint/types@4.19.0":
version "4.19.0"
resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.19.0.tgz"
"@typescript-eslint/types@4.20.0":
version "4.20.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-4.20.0.tgz#c6cf5ef3c9b1c8f699a9bbdafb7a1da1ca781225"
integrity sha512-cYY+1PIjei1nk49JAPnH1VEnu7OYdWRdJhYI5wiKOUMhLTG1qsx5cQxCUTuwWCmQoyriadz3Ni8HZmGSofeC+w==
"@typescript-eslint/typescript-estree@4.19.0":
version "4.19.0"
resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.19.0.tgz"
@ -2462,6 +2488,19 @@
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/typescript-estree@4.20.0":
version "4.20.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-4.20.0.tgz#8b3b08f85f18a8da5d88f65cb400f013e88ab7be"
integrity sha512-Knpp0reOd4ZsyoEJdW8i/sK3mtZ47Ls7ZHvD8WVABNx5Xnn7KhenMTRGegoyMTx6TiXlOVgMz9r0pDgXTEEIHA==
dependencies:
"@typescript-eslint/types" "4.20.0"
"@typescript-eslint/visitor-keys" "4.20.0"
debug "^4.1.1"
globby "^11.0.1"
is-glob "^4.0.1"
semver "^7.3.2"
tsutils "^3.17.1"
"@typescript-eslint/visitor-keys@4.19.0":
version "4.19.0"
resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.19.0.tgz"
@ -2469,6 +2508,14 @@
"@typescript-eslint/types" "4.19.0"
eslint-visitor-keys "^2.0.0"
"@typescript-eslint/visitor-keys@4.20.0":
version "4.20.0"
resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-4.20.0.tgz#1e84db034da13f208325e6bfc995c3b75f7dbd62"
integrity sha512-NXKRM3oOVQL8yNFDNCZuieRIwZ5UtjNLYtmMx2PacEAGmbaEYtGgVHUHVyZvU/0rYZcizdrWjDo+WBtRPSgq+A==
dependencies:
"@typescript-eslint/types" "4.20.0"
eslint-visitor-keys "^2.0.0"
"@webassemblyjs/ast@1.9.0":
version "1.9.0"
resolved "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz"
@ -4765,10 +4812,6 @@ destroy@~1.0.4:
version "1.0.4"
resolved "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz"
details-dialog-element@^1.4.0:
version "1.4.1"
resolved "https://registry.npmjs.org/details-dialog-element/-/details-dialog-element-1.4.1.tgz"
detect-indent@^6.0.0:
version "6.0.0"
resolved "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz"
@ -5297,6 +5340,13 @@ eslint-plugin-import@>=2.20.1:
resolve "^1.17.0"
tsconfig-paths "^3.9.0"
eslint-plugin-jest@24.3.2:
version "24.3.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-24.3.2.tgz#30a8b2dea6278d0da1d6fb9d6cd530aaf58050a1"
integrity sha512-cicWDr+RvTAOKS3Q/k03+Z3odt3VCiWamNUHWd6QWbVQWcYJyYgUTu8x0mx9GfeDEimawU5kQC+nQ3MFxIM6bw==
dependencies:
"@typescript-eslint/experimental-utils" "^4.0.1"
eslint-plugin-jsx-a11y@^6.4.1:
version "6.4.1"
resolved "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz"