mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Remove cson2json dependency
The latest release does not work because of CoffeeScript changes so use a simple compile script to convert CSON files to JSON files when buildilng. Closes #348
This commit is contained in:
@@ -3,8 +3,7 @@
|
||||
"version" : "0.0.0",
|
||||
|
||||
"dependencies": {
|
||||
"coffee-script": "1.5",
|
||||
"cson": "1.x"
|
||||
"coffee-script": "1.5"
|
||||
},
|
||||
|
||||
"scripts": {
|
||||
|
||||
@@ -11,4 +11,4 @@ node --version > /dev/null 2>&1 || source /opt/github/env.sh
|
||||
INPUT_FILE="${1}"
|
||||
OUTPUT_FILE="${2}"
|
||||
|
||||
node_modules/.bin/cson2json "${INPUT_FILE}" > "${OUTPUT_FILE}"
|
||||
node_modules/.bin/coffee script/compile-cson.coffee -- "${INPUT_FILE}" "${OUTPUT_FILE}"
|
||||
|
||||
23
script/compile-cson.coffee
Normal file
23
script/compile-cson.coffee
Normal file
@@ -0,0 +1,23 @@
|
||||
fs = require 'fs'
|
||||
{exec} = require 'child_process'
|
||||
|
||||
inputFile = process.argv[2]
|
||||
unless inputFile?.length > 0
|
||||
console.error("Input file must be first argument")
|
||||
process.exit(1)
|
||||
|
||||
outputFile = process.argv[3]
|
||||
unless outputFile?.length > 0
|
||||
console.error("Output file must be second arguments")
|
||||
process.exit(1)
|
||||
|
||||
contents = fs.readFileSync(inputFile)?.toString() ? ''
|
||||
exec "node_modules/.bin/coffee -bcp #{inputFile}", (error, stdout, stderr) ->
|
||||
if error
|
||||
console.error(error)
|
||||
process.exit(1)
|
||||
json = eval(stdout.toString()) ? {}
|
||||
if json isnt Object(json)
|
||||
console.error("CSON file does not contain valid JSON")
|
||||
process.exit(1)
|
||||
fs.writeFileSync(outputFile, JSON.stringify(json, null, 2))
|
||||
Reference in New Issue
Block a user