Upgrade dependencies

This commit is contained in:
Matt Swensen 2020-04-01 07:45:04 -06:00
parent 73a889557a
commit fdfdbdb87d
No known key found for this signature in database
GPG Key ID: 3F9E482BFC526F35
7 changed files with 1426 additions and 1783 deletions

@ -7,6 +7,6 @@
"test": "jest --coverage"
},
"devDependencies": {
"jest": "^24.9.0"
"jest": "^25.2.4"
}
}

@ -1,9 +1,12 @@
const { render, renderInstructions } = require('./index'),
{ colors } = require('../../themer-colors-default'),
del = require('del'),
fs = require('pn/fs'),
os = require('os'),
fs = require('fs'),
{ promisify } = require('util'),
writeFile = promisify(fs.writeFile),
readFile = promisify(fs.readFile),
mkdir = promisify(fs.mkdir),
less = require('less'),
mkdirp = require('mkdirp-promise'),
path = require('path');
describe('render function', () => {
@ -30,9 +33,7 @@ describe('render function', () => {
}
};
const outputDir = 'test-output';
afterAll(() => { del(outputDir); });
const outputDir = path.join(os.tmpdir(), new Date().valueOf().toString());
it('should properly render package.json files', async () => await basicFileCheck(/package\.json/));
it('should properly render color variables files', async () => await basicFileCheck(/colors\.less/));
@ -58,25 +59,26 @@ describe('render function', () => {
it('should produce valid, compilable less', async () => {
const files = await promisedFiles;
const outputFilePaths = await Promise.all(files.map(file => {
const outputFilePaths = await Promise.all(files.map(async file => {
const outputFilePath = path.resolve(outputDir, file.name);
return mkdirp(path.dirname(outputFilePath))
.then(() => fs.writeFile(outputFilePath, file.contents))
.then(() => outputFilePath);
await mkdir(path.dirname(outputFilePath), { recursive: true })
await writeFile(outputFilePath, file.contents);
return outputFilePath;
}));
const indexFilePaths = outputFilePaths.filter(outputFilePath => /index\.less/.test(outputFilePath));
expect(indexFilePaths.length).toBe(2);
const wrapped = await wrap(() => Promise.all(
indexFilePaths.map(
indexFilePath => fs.readFile(indexFilePath, 'utf8').then(
contents => less.render(
async indexFilePath => {
const contents = await readFile(indexFilePath, 'utf8')
return await less.render(
contents,
{
paths: [path.dirname(indexFilePath)],
filename: path.basename(indexFilePath),
},
)
)
);
}
)
));
expect(wrapped).not.toThrow();

@ -15,10 +15,7 @@
"prepublishOnly": "cp ../../../LICENSE.md ./"
},
"devDependencies": {
"del": "^3.0.0",
"less": "^3.8.1",
"mkdirp-promise": "^5.0.1",
"pn": "^1.1.0"
"less": "^3.8.1"
},
"peerDependencies": {
"themer": "^2.1||^3"

@ -1,80 +1,71 @@
const {render, renderInstructions} = require('./index'),
{pickBy} = require('lodash'),
const { render, renderInstructions } = require('./index'),
{ pickBy } = require('lodash'),
path = require('path'),
os = require('os'),
fs = require('pn/fs'),
mkdirp = require('mkdirp-promise'),
{ promisify } = require('util'),
fs = require('fs'),
writeFile = promisify(fs.writeFile),
readFile = promisify(fs.readFile),
mkdir = promisify(fs.mkdir),
less = require('less'),
{colors} = require('../../themer-colors-default');
{ colors } = require('../../themer-colors-default');
describe('render', () => {
const promisedFiles = Promise.all(render(colors));
it('should render one package directory for each theme in the colorset', done => {
promisedFiles.then(files => {
const packages = new Set();
files.forEach(file => {
const packageName = file.name.split(path.sep)[0];
packages.add(packageName);
});
expect(packages.size).toBe(2);
done();
it('should render one package directory for each theme in the colorset', async () => {
const files = await promisedFiles;
const packages = new Set();
files.forEach(file => {
const packageName = file.name.split(path.sep)[0];
packages.add(packageName);
});
expect(packages.size).toBe(2);
});
it('should render properly-formatted theme files', async () => {
const files = await promisedFiles;
files.forEach(file => {
if (path.basename(file.name) === 'package.json') {
expect(
pickBy(
JSON.parse(file.contents.toString('utf8')),
(v, k) => k !== 'version'
)
).toMatchSnapshot();
} else {
expect(file.contents.toString('utf8')).toMatchSnapshot();
}
});
});
it('should render properly-formatted theme files', done => {
promisedFiles.then(files => {
files.forEach(file => {
if (path.basename(file.name) === 'package.json') {
expect(
pickBy(
JSON.parse(file.contents.toString('utf8')),
(v, k) => k !== 'version'
)
).toMatchSnapshot();
} else {
expect(file.contents.toString('utf8')).toMatchSnapshot();
}
});
done();
});
});
it('should produce valid compiled CSS', done => {
it('should produce valid compiled CSS', async () => {
const tmp = path.join(os.tmpdir(), new Date().valueOf().toString());
promisedFiles
.then(files =>
Promise.all(
files.map(file => {
const outputFilePath = path.resolve(tmp, file.name);
return mkdirp(path.dirname(outputFilePath))
.then(() => fs.writeFile(outputFilePath, file.contents))
.then(() => outputFilePath);
})
)
)
.then(outputFilePaths => {
const indexFilePaths = outputFilePaths.filter(outputFilePath =>
/index\.less/.test(outputFilePath)
);
expect(indexFilePaths.length).toBe(2);
return Promise.all(
indexFilePaths.map(indexFilePath => {
return fs.readFile(indexFilePath, 'utf8').then(contents =>
less.render(contents, {
paths: [path.dirname(indexFilePath)],
filename: path.basename(indexFilePath),
})
);
})
);
})
.then(compiledContents => {
compiledContents.forEach(contents => {
expect(contents.css).toMatchSnapshot();
const files = await promisedFiles;
const outputFilePaths = await Promise.all(
files.map(async file => {
const outputFilePath = path.resolve(tmp, file.name);
await mkdir(path.dirname(outputFilePath), { recursive: true });
await writeFile(outputFilePath, file.contents);
return outputFilePath;
}),
);
const indexFilePaths = outputFilePaths.filter(outputFilePath =>
/index\.less/.test(outputFilePath)
);
expect(indexFilePaths.length).toBe(2);
const compiledContents = await Promise.all(
indexFilePaths.map(async indexFilePath => {
const contents = await readFile(indexFilePath, 'utf8')
return await less.render(contents, {
paths: [path.dirname(indexFilePath)],
filename: path.basename(indexFilePath),
});
done();
});
}),
);
compiledContents.forEach(contents => {
expect(contents.css).toMatchSnapshot();
});
});
});

@ -48,10 +48,8 @@
"homepage": "https://github.com/mjswensen/themer/tree/master/cli/packages/themer-atom-ui#readme",
"dependencies": {},
"devDependencies": {
"less": "^3.0.0-alpha.3",
"lodash": "^4.17.4",
"mkdirp-promise": "^5.0.1",
"pn": "^1.0.0"
"less": "^3.11.1",
"lodash": "^4.17.4"
},
"peerDependencies": {
"themer": "^2.1||^3"

@ -29,7 +29,7 @@
"dependencies": {
"color-steps": "^1.0.1",
"js-yaml": "^3.11.0",
"minimist": "^1.2.0",
"minimist": "^1.2.5",
"onecolor": "^3.0.5"
},
"devDependencies": {},

File diff suppressed because it is too large Load Diff