Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
bukinoshita committed Sep 29, 2019
1 parent 3a51bdf commit d06a314
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 33 deletions.
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict'

const toJson = require('./lib/to-json')
const toSketch = require('./lib/to-sketch')

Expand Down
30 changes: 12 additions & 18 deletions lib/to-json.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
'use strict'

// Packages
const fs = require('fs-extra')
const decompress = require('decompress')
const globby = require('globby')
const del = require('del')

// Lib
const prettify = require('./prettify')

module.exports = () => {
return new Promise(async (resolve, reject) => {
const files = await globby(['**/*.sketch'])

if (files.length <= 0) {
return reject(new TypeError('Sketch file not found'))
}
async function toJSON() {
const files = await globby(['**/*.sketch'])

if (files && files.length > 0) {
await del(['sketch-json'])

files.map(async file => {
files.forEach(async file => {
const copy = `${process.cwd()}/${file}`.replace('.sketch', '.zip')

await fs.copy(file, copy)

const folder =
files.length > 1
? `sketch-json/${file.replace('.sketch', '')}`
: 'sketch-json'

console.log(file)
const folder = files.length > 1 ? `sketch-json/${file.replace('.sketch', '')}` : 'sketch-json'

await decompress(copy, folder)
await prettify()
resolve()
})
})
}

return new TypeError('Sketch file not found')
}

module.exports = toJSON
23 changes: 10 additions & 13 deletions lib/to-sketch.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
'use strict'

// Packages
const fs = require('fs-extra')
const globby = require('globby')

module.exports = () => {
return new Promise(async (resolve, reject) => {
const files = await globby(['**/*.zip'])

if (files.length <= 0) {
return reject(new TypeError('Zip file not found'))
}
async function toSketch() {
const files = await globby(['**/*.zip'])

files.map(async zipFile => {
if (files && files.length > 0) {
files.forEach(async zipFile => {
const copy = `${process.cwd()}/${zipFile}`.replace('.zip', '.sketch')

await fs.copy(zipFile, copy)

resolve()
})
})
}

return new TypeError('Zip file not found')
}

module.exports = toSketch

0 comments on commit d06a314

Please sign in to comment.