1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 11:17:05 +03:00

copy over all the config from @primer/components

This commit is contained in:
Shawn Allen 2018-11-30 11:54:11 -08:00
parent 2426818bb7
commit fd5771235a
4 changed files with 3124 additions and 311 deletions

View File

@ -1,2 +1,73 @@
const withPrimer = require('@primer/next/plugin') // this runs synchronously
module.exports = withPrimer() require('./copy')
const {join} = require('path')
const withPlugins = require('next-compose-plugins')
const mdx = require('@zeit/next-mdx')
const getPageMap = require('next-page-map')
const pageExtensions = ['js', 'jsx', 'md', 'mdx']
const pageMap = getPageMap(join(__dirname, 'pages'), pageExtensions)
const assetPrefix = process.env.NOW_URL
module.exports = withPlugins([
mdx({extension: /\.mdx?$/})
], {
/*
* Note: Prefixing assets with the fully qualified deployment URL
* makes them available even when the site is served from a path alias, as in
* <https://primer.style/components>
*/
assetPrefix: process.env.NOW_URL,
pageExtensions,
publicRuntimeConfig: {
assetPrefix,
pageMap
},
webpack(config, {dev}) {
config.module.rules.push({
test: /\.svg$/,
use: {loader: '@svgr/webpack'}
})
if (dev) {
/*
* In development mode, we want to alias the project-root
* imports to the source files so that this:
*
* ```js
* import {Box} from '..'
* ```
*
* becomes:
*
* ```js
* import {Box} from '../src'
* ```
*
* Note: the '$' at the end of these tells webpack to match
* the end of the import path. Without it, the first alias
* applies to *every* import because the resolved path for
* every one begins with `__dirname`.
*/
config.resolve.alias = {
[__dirname + '$']: join(__dirname, 'src/index.js'),
[join(__dirname, 'css$')]: join(__dirname, 'src/css.js')
}
}
const {optimization} = config
if (optimization && Array.isArray(optimization.minimizer)) {
const terserPlugin = optimization.minimizer[0]
/* eslint-disable camelcase, no-console */
console.warn('*** disabling mangling in Terser plugin ***')
terserPlugin.options.terserOptions = {
keep_fnames: true
}
/* eslint-enable camelcase, no-console */
}
return config
}
})

View File

@ -1,18 +1,21 @@
{ {
"name": "primer-css",
"version": 1, "version": 1,
"name": "primer-css",
"alias": "primer-css.now.sh",
"scale": { "scale": {
"sfo": { "sfo": {
"min": 1, "min": 1,
"max": 3 "max": 3
} }
}, },
"engines": {
"node": ">=10"
},
"files": [ "files": [
"copy.js", "copy.js",
"next.config.js", "next.config.js",
"package-lock.json", "package-lock.json",
"pages", "pages",
"src",
"static" "static"
] ]
} }

3329
docs/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -2,23 +2,39 @@
"private": true, "private": true,
"scripts": { "scripts": {
"prepare": "npm run copy", "prepare": "npm run copy",
"lint": "eslint pages",
"test": "./test.sh", "test": "./test.sh",
"predev": "npm run copy",
"dev": "next", "dev": "next",
"copy": "node copy.js", "copy": "node copy.js",
"build": "next build", "build": "next build",
"start": "next start" "start": "next start"
}, },
"dependencies": { "dependencies": {
"@githubprimer/octicons-react": "^8.1.3",
"@mdx-js/loader": "0.15.0",
"@mdx-js/mdx": "0.15.0",
"@mdx-js/tag": "0.15.0",
"@primer/components": "^7.0.0-beta", "@primer/components": "^7.0.0-beta",
"@primer/next": "0.0.10", "@primer/next": "0.0.10",
"@svgr/webpack": "2.4.1",
"@zeit/next-mdx": "1.1.0",
"babel-core": "7.0.0-bridge.0",
"colorette": "^1.0.7", "colorette": "^1.0.7",
"emotion": "9.2.8",
"emotion-server": "9.2.8",
"eslint": "4.19.1",
"eslint-plugin-github": "1.0.0",
"eslint-plugin-prettier": "^3.0.0",
"fs-extra": "^7.0.1", "fs-extra": "^7.0.1",
"klaw": "^3.0.0", "klaw": "^3.0.0",
"mdx-live": "2.0.0-alpha.2",
"minimatch": "^3.0.4", "minimatch": "^3.0.4",
"next": "^7.0.2", "next": "7.0.2",
"next-page-map": "^1.0.1", "next-compose-plugins": "2.1.1",
"primer": "file:../modules/primer",
"react": "^16.6.3", "react": "^16.6.3",
"react-dom": "^16.6.3" "react-dom": "^16.6.3",
"react-emotion": "9.2.8",
"styled-components": "3.3.3"
} }
} }