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

Convert to atom-transpile plugin #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
npm-debug.log
node_modules
# macOS
.DS_Store

# npm
node_modules/
*npm*
20 changes: 0 additions & 20 deletions LICENSE

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)
=====================
Copyright © 2017 [Daniel Bayley](https://github.com/danielbayley) <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
CSON
====
[![apm]](https://atom.io/packages/transpile-cson)

[Atom](http://atom.io/) plugin. Convert JSON to CSON, and vice versa.
Atom _[CSON]_ Transpiler
========================
Freely transpile between _[CSON]_ and JSON in [Atom].

Just select the text to convert and select the convert to CSON/JSON command. In a JSON or CSON file, it converts the whole file.
[Another] plugin for _[atom-transpile]_.

![Demo](http://i.imgur.com/rmc4awT.gif)
Install
-------
`apm install transpile-cson` or search “cson” under Packages within Atom.

This uses the [CSON](https://www.npmjs.com/package/cson) npm package.
License
-------
[MIT] © [Juan Cazala] et [al]

[MIT]: LICENSE.md
[Juan Cazala]: https://github.com/cazala
[al]: https://github.com/cazala/atom-transpile-cson/graphs/contributors
[atom]: https://atom.io
[apm]: https://img.shields.io/apm/v/transpile-cson.svg?style=flat-square

[atom-transpile]: https://atom.io/packages/transpile
[Another]: https://atom.io/packages/search?q=transpile-
[CSON]: https://github.com/bevry/cson#what-is-cson
57 changes: 0 additions & 57 deletions index.coffee

This file was deleted.

13 changes: 13 additions & 0 deletions lib/cson-json.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports =
class cson2json
name: @name
from:
scopeName: 'source.coffee'
fileTypes: ['cson']
to:
scopeName: 'source.json'
ext: '.json'

transpile: (source, {indent}) ->
cson = require 'cson'
JSON.stringify (cson.parse source), null, indent
10 changes: 10 additions & 0 deletions lib/index.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cson2json = require './cson-json'
json2cson = require './json-cson'

module.exports =
activate: ->
@cson2json = new cson2json
@json2cson = new json2cson
return [ @cson2json, @json2cson ]

deactivate: -> @cson2json = @json2cson = null
13 changes: 13 additions & 0 deletions lib/json-cson.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports =
class json2cson
name: @name
from:
scopeName: 'source.json'
fileTypes: ['*=".json"']
to:
scopeName: 'source.coffee'
ext: '.cson'

transpile: (source, {indent}) ->
cson = require 'cson'
cson.createString (cson.parse source), indent: indent
16 changes: 0 additions & 16 deletions menus/cson.cson

This file was deleted.

46 changes: 33 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,43 @@
{
"main": "./index.coffee",
"name": "cson",
"name": "transpile-cson",
"version": "2.0.1",
"description": "Convert JSON to CSON, and vice versa",
"description": "Freely transpile between CSON and JSON.",
"keywords": [
"JSON",
"CSON",
"transpile",
"convert",
"parser",
"json2cson",
"cson2json"
"refactor",
"CSON",
"JSON"
],
"homepage": "https://atom.io/packages/transpile-cson",
"repository": {
"type": "git",
"url": "git+https://github.com/cazala/atom-transpile-cson.git"
},
"bugs": {
"url": "https://github.com/cazala/atom-transpile-cson/issues"
},
"author": "Juan Cazala",
"contributors": [
"Daniel Bayley <[email protected]> (https://github.com/danielbayley)"
],
"repository": "https://github.com/cazala/cson",
"private": true,
"license": "MIT",
"dependencies": {
"cson": "^4.1.0"
},
"scripts": {
"preinstall": "apm install transpile"
},
"engines": {
"atom": "*"
},
"dependencies": {
"cson": "~3.0.2"
},
"scripts": {}
"main": "./lib/index",
"providedServices": {
"transpile": {
"versions": {
"1.0.0": "activate"
}
}
}
}