This repository has been archived by the owner on Jul 12, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(elements): add @carbon/elements package (#199)
* feat(elements): add @carbon/elements package * chore(project): run sync * chore(elements): add additional build folders to clean task
- Loading branch information
Showing
26 changed files
with
288 additions
and
7 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
scss/bundled |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
__tests__ | ||
examples | ||
tasks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# @carbon/elements | ||
|
||
> A collection of design elements in code for the IBM Design Language | ||
## Getting started | ||
|
||
To install `@carbon/elements` in your project, you will need to run | ||
the following command using [npm](https://www.npmjs.com/): | ||
|
||
```bash | ||
npm install -S @carbon/elements | ||
``` | ||
|
||
If you prefer [Yarn](https://yarnpkg.com/en/), use the following | ||
command instead: | ||
|
||
```bash | ||
yarn add @carbon/elements | ||
``` | ||
|
||
## 🙌 Contributing | ||
|
||
We're always looking for contributors to help us fix bugs, build new | ||
features, or help us improve the project documentation. If you're | ||
interested, definitely check out our [Contributing Guide](/.github/CONTRIBUTING.md) | ||
! 👀 | ||
|
||
## 📝 License | ||
|
||
Licensed under the [Apache 2.0 License](/LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"name": "@carbon/elements", | ||
"description": "A collection of design elements in code for the IBM Design Language", | ||
"version": "0.0.1-alpha.26", | ||
"license": "Apache-2.0", | ||
"main": "lib/index.js", | ||
"module": "es/index.js", | ||
"repository": "https://github.com/IBM/carbon-elements/tree/master/packages/elements", | ||
"bugs": "https://github.com/IBM/carbon-elements/issues", | ||
"files": [ | ||
"es", | ||
"lib", | ||
"scss", | ||
"umd" | ||
], | ||
"keywords": [ | ||
"ibm", | ||
"elements", | ||
"carbon", | ||
"carbon-elements", | ||
"carbon-design-system" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"scripts": { | ||
"build": "node tasks/build.js && bundler bundle src/index.js --name CarbonElements", | ||
"clean": "rimraf es lib scss/bundled umd" | ||
}, | ||
"dependencies": { | ||
"@carbon/colors": "0.0.1-alpha.26", | ||
"@carbon/grid": "0.0.1-alpha.26", | ||
"@carbon/import-once": "0.0.1-alpha.26", | ||
"@carbon/layout": "0.0.1-alpha.26", | ||
"@carbon/motion": "0.0.1-alpha.26", | ||
"@carbon/type": "0.0.1-alpha.26" | ||
}, | ||
"devDependencies": { | ||
"@carbon/bundler": "0.0.1-alpha.26", | ||
"fs-extra": "^7.0.1", | ||
"klaw-sync": "^6.0.0", | ||
"replace-in-file": "^3.4.2", | ||
"rimraf": "^2.6.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// The bundled files below are generated using the `yarn build` stage for this | ||
// package | ||
@import './bundled/@carbon/import-once/scss/import-once'; | ||
@import './bundled/@carbon/colors/scss/colors'; | ||
@import './bundled/@carbon/layout/scss/layout'; | ||
@import './bundled/@carbon/grid/scss/grid'; | ||
@import './bundled/@carbon/type/scss/type'; | ||
@import './bundled/@carbon/motion/scss/motion'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import '@carbon/import-once/scss/import-once'; | ||
@import '@carbon/colors/scss/colors'; | ||
@import '@carbon/layout/scss/layout'; | ||
@import '@carbon/grid/scss/grid'; | ||
@import '@carbon/type/scss/type'; | ||
@import '@carbon/motion/scss/motion'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export * from '@carbon/colors'; | ||
export * from '@carbon/layout'; | ||
export * from '@carbon/motion'; | ||
export * from '@carbon/type'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs-extra'); | ||
const klaw = require('klaw-sync'); | ||
const path = require('path'); | ||
const replace = require('replace-in-file'); | ||
const packageJson = require('../package.json'); | ||
|
||
const WORKSPACE_NODE_MODULES = path.resolve(__dirname, '../../../node_modules'); | ||
const BUNDLE_DIR = path.resolve(__dirname, '../scss/bundled'); | ||
const dependencies = Object.keys(packageJson.dependencies).map(key => { | ||
return [key, path.join(WORKSPACE_NODE_MODULES, key)]; | ||
}); | ||
|
||
async function build() { | ||
// Copy scss folders over | ||
await Promise.all( | ||
dependencies.map(async ([dependency, dependencyPath]) => { | ||
const scssFolder = path.join(dependencyPath, 'scss'); | ||
if (!(await fs.pathExists(scssFolder))) { | ||
return; | ||
} | ||
|
||
await fs.copy(scssFolder, path.join(BUNDLE_DIR, dependency, 'scss')); | ||
}) | ||
); | ||
|
||
// Replace `@carbon` imports with relative paths | ||
const paths = klaw(BUNDLE_DIR, { | ||
nodir: true, | ||
}); | ||
|
||
await Promise.all( | ||
paths.map(async file => { | ||
const relativeImportPath = path.relative( | ||
file.path, | ||
path.join(BUNDLE_DIR, '@carbon') | ||
); | ||
await replace({ | ||
files: file.path, | ||
from: /\@carbon/g, | ||
to: `${relativeImportPath}/@carbon`, | ||
}); | ||
}) | ||
); | ||
} | ||
|
||
build().catch(error => { | ||
console.error(error); | ||
}); |
Oops, something went wrong.