-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3a51bdf
commit d06a314
Showing
3 changed files
with
22 additions
and
33 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
'use strict' | ||
|
||
const toJson = require('./lib/to-json') | ||
const toSketch = require('./lib/to-sketch') | ||
|
||
|
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -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 |