Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lerna #7

Merged
merged 31 commits into from Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
7963ecd
Initial Commit 🚀
paulmolluzzo Jul 13, 2017
16a27ba
Update package.json with publisher and marketplace info
paulmolluzzo Jul 13, 2017
07cf5a6
Update README with link to @ansumanshah
paulmolluzzo Jul 13, 2017
ee1bb26
Add prebuild script
paulmolluzzo Jul 13, 2017
c864b46
Change header color for VS Code marketplace
paulmolluzzo Jul 13, 2017
8c05713
Bump to v0.0.2
paulmolluzzo Jul 13, 2017
ece183e
Add in .vscode files
paulmolluzzo Jul 14, 2017
1ec61f8
Add key bindings for shortcut
paulmolluzzo Jul 14, 2017
c22f7c4
Refactor convert and fix beginning whitespace issue
paulmolluzzo Jul 14, 2017
ffd6f2c
Update README
paulmolluzzo Jul 14, 2017
d388984
Update CHANGELOG
paulmolluzzo Jul 14, 2017
d9d5902
Bump to v0.1.0
paulmolluzzo Jul 14, 2017
26a0029
Use hosted gif image in README
paulmolluzzo Jul 14, 2017
7fd1669
Refactor convert
paulmolluzzo Jul 16, 2017
f7820c4
Change current line if nothing is selected
paulmolluzzo Jul 16, 2017
71a919b
Update changelog; bump package version to v0.2.0
paulmolluzzo Jul 16, 2017
4ef55e6
Update package.json with info for marketplace
paulmolluzzo Jul 21, 2017
5178945
feat(extension) Add typescript supportCloses #1
paulmolluzzo Aug 19, 2017
794a913
Merge pull request #2 from paulmolluzzo/typescript-support
paulmolluzzo Aug 19, 2017
f7a90c2
Update package.json, changelog, readme for v0.3.0
paulmolluzzo Aug 19, 2017
df6b5d9
Move to packages/css-in-js
ansumanshah Sep 2, 2017
4a27efd
Move to packages/convert-css-in-js
ansumanshah Sep 2, 2017
cded344
Merge branch 'master' of /Users/ansumanshah/Desktop/code/github/conve…
ansumanshah Sep 2, 2017
0ef7456
Lerna init
ansumanshah Sep 2, 2017
06b6e46
Update build script for vscode version to work with lerna
paulmolluzzo Sep 4, 2017
5bb5c30
Move vscode-css-in-js/convert to common lib
paulmolluzzo Sep 4, 2017
d155a00
Merge master into lerna; fix conflicting package.json for atom version
paulmolluzzo Sep 4, 2017
5b8e9f1
Add README for entire project
paulmolluzzo Sep 4, 2017
cba15ac
Created css-in-js-helpers package
ansumanshah Sep 4, 2017
32bbe65
Removed lock file for now
ansumanshah Sep 4, 2017
e643a5f
add yarn.lock
ansumanshah Sep 4, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
@@ -1,3 +1,7 @@
.DS_Store
npm-debug.log
.idea
node_modules
dist
*.log
yarn.lock
package-lock.json
44 changes: 12 additions & 32 deletions README.md
@@ -1,49 +1,21 @@
# Atom Autocomplete for React Native and css-in-js [![Star on GitHub][github-star-badge]][github-star][![Tweet][twitter-badge]][twitter]
# CSS in JS for Atom and VS Code

## Atom Autocomplete for React Native and css-in-js [![Star on GitHub][github-star-badge]][github-star][![Tweet][twitter-badge]][twitter]

[![PRs Welcome][prs-badge]][prs]
[![Version][version-badge]][package]
[![MIT License][license-badge]][LICENSE]

Now get Autocomplete for CSSinJS libraries using object styles.

## Installation
### Installation
```
apm install css-in-js
```
Or go to Settings → Install and search for `css-in-js`

<a href="https://app.codesponsor.io/link/jZ7oK2ZsGezatDv9YZW6fM3e/ansumanshah/css-in-js" rel="nofollow"><img src="https://app.codesponsor.io/embed/jZ7oK2ZsGezatDv9YZW6fM3e/ansumanshah/css-in-js.svg" style="width: 888px; height: 68px;" alt="Sponsor" /></a>

## Usage
```js
const btnA = css({ /* styles */ });
const btnB = glamorous.div({ /* styles */ });
const btnC = StyleSheet.create({ /* styles */ });
```
Only works for these keywords by default you can edit in settings for more.

`glamorous | css | StyleSheet.create`

![ReactNative][native-demo]

![Autocomplete][autocomplete-demo]

Does not work for general objects
```js
let styles = {
/* styles */
}
```
This is basically a fork of [autocomplete-css](https://github.com/atom/autocomplete-css)

<kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>J</kbd> to convert the css lines to js

![Convert][converter-demo]

Coming Soon

*Codemods for easy shifting between css-in-js libraries*

[autocomplete-demo]: https://github.com/ansumanshah/css-in-js/raw/master/cssinjs.gif
[native-demo]: https://github.com/ansumanshah/css-in-js/raw/master/native.gif
[converter-demo]: https://github.com/ansumanshah/css-in-js/raw/master/example.gif
Expand All @@ -59,3 +31,11 @@ Coming Soon
[license]: https://github.com/ansumanshah/css-in-js/blob/master/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com

## Convert CSS in JS

> Convert kebab-case CSS to camelCase CSS and vice versa

Converts CSS between regular CSS syntax (strings) and CSS-in-JS syntax (style objects)

![demo](https://user-images.githubusercontent.com/737065/28219279-6ffbf4c4-6889-11e7-8d3d-51637fe90856.gif)
7 changes: 7 additions & 0 deletions lerna.json
@@ -0,0 +1,7 @@
{
"lerna": "2.1.2",
"packages": [
"packages/*"
],
"version": "0.0.0"
}
41 changes: 3 additions & 38 deletions package.json
@@ -1,40 +1,5 @@
{
"name": "css-in-js",
"main": "./lib/css-in-js",
"version": "1.4.0",
"description": "Autocomplete JS and React Native styles, and converting copied CSS to JS styles and vice versa",
"repository": "https://github.com/ansumanshah/css-in-js",
"license": "MIT",
"providedServices": {
"autocomplete.provider": {
"versions": {
"2.0.0": "getProvider"
}
}
},
"scripts": {
"update-css": "node scripts/css/completions.js",
"update-rn": "node scripts/rn/completions.js"
},
"keywords": [
"atom",
"autocomplete",
"react",
"react-native",
"glamourous",
"glamour",
"snippets"
],
"engines": {
"atom": ">=1.0.0 <2.0.0"
},
"dependencies": {
"css": "^2.2.1",
"stringify-object": "^3.2.0"
},
"devDependencies": {
"path": "^0.12.7",
"react-docgen": "3.0.0-beta6",
"request": "^2.81.0"
}
"devDependencies": {
"lerna": "^2.1.2"
}
}
File renamed without changes.
61 changes: 61 additions & 0 deletions packages/atom-css-in-js/README.md
@@ -0,0 +1,61 @@
# Atom Autocomplete for React Native and css-in-js [![Star on GitHub][github-star-badge]][github-star][![Tweet][twitter-badge]][twitter]

[![PRs Welcome][prs-badge]][prs]
[![Version][version-badge]][package]
[![MIT License][license-badge]][LICENSE]

Now get Autocomplete for CSSinJS libraries using object styles.

## Installation
```
apm install css-in-js
```
Or go to Settings → Install and search for `css-in-js`

<a href="https://app.codesponsor.io/link/jZ7oK2ZsGezatDv9YZW6fM3e/ansumanshah/css-in-js" rel="nofollow"><img src="https://app.codesponsor.io/embed/jZ7oK2ZsGezatDv9YZW6fM3e/ansumanshah/css-in-js.svg" style="width: 888px; height: 68px;" alt="Sponsor" /></a>

## Usage
```js
const btnA = css({ /* styles */ });
const btnB = glamorous.div({ /* styles */ });
const btnC = StyleSheet.create({ /* styles */ });
```
Only works for these keywords by default you can edit in settings for more.

`glamorous | css | StyleSheet.create`

![ReactNative][native-demo]

![Autocomplete][autocomplete-demo]

Does not work for general objects
```js
let styles = {
/* styles */
}
```
This is basically a fork of [autocomplete-css](https://github.com/atom/autocomplete-css)

<kbd>CTRL</kbd> + <kbd>ALT</kbd> + <kbd>J</kbd> to convert the css lines to js

![Convert][converter-demo]

Coming Soon

*Codemods for easy shifting between css-in-js libraries*

[autocomplete-demo]: https://github.com/ansumanshah/css-in-js/raw/master/cssinjs.gif
[native-demo]: https://github.com/ansumanshah/css-in-js/raw/master/native.gif
[converter-demo]: https://github.com/ansumanshah/css-in-js/raw/master/example.gif

[github-star-badge]: https://img.shields.io/github/stars/ansumanshah/css-in-js.svg?style=social
[github-star]: https://github.com/ansumanshah/css-in-js/stargazers
[twitter]: https://twitter.com/intent/tweet?text=Check%20out%20Atom%20Autocomplete%20css-in-js!%20https://github.com/ansumanshah/css-in-js%20%F0%9F%91%8D
[twitter-badge]: https://img.shields.io/twitter/url/https/github.com/ansumanshah/css-in-js.svg?style=social

[version-badge]: https://img.shields.io/apm/v/css-in-js.svg?style=flat-square
[package]: https://atom.io/packages/css-in-js
[license-badge]: https://img.shields.io/apm/l/css-in-js.svg?style=flat-square
[license]: https://github.com/ansumanshah/css-in-js/blob/master/LICENSE
[prs-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square
[prs]: http://makeapullrequest.com
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
40 changes: 40 additions & 0 deletions packages/atom-css-in-js/package.json
@@ -0,0 +1,40 @@
{
"name": "css-in-js",
"main": "./lib/css-in-js",
"version": "1.4.0",
"description": "Autocomplete JS and React Native styles, and converting copied CSS to JS styles and vice versa",
"repository": "https://github.com/ansumanshah/css-in-js",
"license": "MIT",
"providedServices": {
"autocomplete.provider": {
"versions": {
"2.0.0": "getProvider"
}
}
},
"scripts": {
"update-css": "node scripts/css/completions.js",
"update-rn": "node scripts/rn/completions.js"
},
"keywords": [
"atom",
"autocomplete",
"react",
"react-native",
"glamourous",
"glamour",
"snippets"
],
"engines": {
"atom": ">=1.0.0 <2.0.0"
},
"dependencies": {
"css": "^2.2.1",
"stringify-object": "^3.2.0"
},
"devDependencies": {
"path": "^0.12.7",
"react-docgen": "3.0.0-beta6",
"request": "^2.81.0"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
33 changes: 33 additions & 0 deletions packages/css-in-js-helpers/index.js
@@ -0,0 +1,33 @@
const getBeginningWhitespace = string =>
string.match(/^\s+/) !== null ? string.match(/^\s+/)[0] : '';

const isCSS = item => (item.match(/;/g) || []).length === 1;

const isJS = item => (item.match(/,/g) || []).length === 1;

const toHyphen = prop =>
prop.replace(/([A-Z])/g, char => `-${char[0].toLowerCase()}`);

const toCamel = prop =>
prop.replace(/-(\w|$)/g, (dash, next) => next.toUpperCase());

const toJS = item => {
const [prop, val] = item.split(':');
return `${getBeginningWhitespace(prop)}${toCamel(
prop.trim()
)}: '${val.trim().replace(';', '')}',`;
};

const toCSS = item => {
const [prop, val] = item.split(':');
return `${getBeginningWhitespace(prop)}${toHyphen(
prop.trim()
)}: ${val.trim().replace(/'|,/g, '')};`;
};

export default function convert(s) {
const lines = s.split('\n');
return lines
.map(item => (isCSS(item) ? toJS(item) : isJS(item) ? toCSS(item) : item))
.join('\n');
}
20 changes: 20 additions & 0 deletions packages/css-in-js-helpers/package.json
@@ -0,0 +1,20 @@
{
"name": "css-in-js-helpers",
"version": "1.0.0",
"description": "CSS in JS helpers",
"main": "index.js",
"scripts": {},
"repository": {
"type": "git",
"url": "git+https://github.com/ansumanshah/css-in-js.git"
},
"keywords": [
"CSSinJS"
],
"author": "Ansuman Shah",
"license": "MIT",
"bugs": {
"url": "https://github.com/ansumanshah/css-in-js/issues"
},
"homepage": "https://github.com/ansumanshah/css-in-js#readme"
}
3 changes: 3 additions & 0 deletions packages/vscode-css-in-js/.babelrc
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
1 change: 1 addition & 0 deletions packages/vscode-css-in-js/.vscode/extensions.json
@@ -0,0 +1 @@
{}
13 changes: 13 additions & 0 deletions packages/vscode-css-in-js/.vscode/launch.json
@@ -0,0 +1,13 @@
{
"version": "0.1.0",
"configurations": [
{
"name": "Launch Extension",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
"stopOnEntry": false
}
]
}
1 change: 1 addition & 0 deletions packages/vscode-css-in-js/.vscode/settings.json
@@ -0,0 +1 @@
{}
17 changes: 17 additions & 0 deletions packages/vscode-css-in-js/CHANGELOG.md
@@ -0,0 +1,17 @@
## 0.3.0
- Add support for typescript files

## 0.2.1
- Update package.json info for marketplace

## 0.2.0
- Change current line if nothing is selected

## 0.1.0
- Add in keyboard shortcut for converting text

## 0.0.2
- Change header color for VS Code marketplace

## 0.0.1
- Initial release
24 changes: 24 additions & 0 deletions packages/vscode-css-in-js/README.md
@@ -0,0 +1,24 @@
# Convert CSS in JS

> Convert kebab-case CSS to camelCase CSS and vice versa

Converts CSS between regular CSS syntax (strings) and CSS-in-JS syntax (style objects)

![demo](https://user-images.githubusercontent.com/737065/28219279-6ffbf4c4-6889-11e7-8d3d-51637fe90856.gif)


## How to Use

Select some block of text in a `javascript` or `typescript` file and use `cmd+shift+p` to bring up the command palette, then select `Convert CSS-in-JS`.

Or use the keyboard shortcut `cmd+shift+j` (`ctrl+shift+j` on Windows).

# Thanks

Thanks to [Ansuman Shah](https://github.com/ansumanshah) for making [css-in-js](https://github.com/ansumanshah/css-in-js) for Atom. I basically copied what was done in that repo. 😃

---

MIT

© 2017 Paul Molluzzo
Binary file added packages/vscode-css-in-js/demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added packages/vscode-css-in-js/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions packages/vscode-css-in-js/jsconfig.json
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
]
},
"exclude": [
"node_modules"
]
}