Skip to content

Commit

Permalink
Merge pull request #73 from buildo/72-removed_css
Browse files Browse the repository at this point in the history
#72: Removed CSS? (closes #72)
FrancescoCioria authored May 8, 2018

Verified

This commit was signed with the committer’s verified signature.
b-zee Benno
2 parents b8f5929 + 1af1fc6 commit 42c2b79
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
"main": "lib",
"scripts": {
"test": "jest",
"build": "rm -rf lib && mkdir lib && tsc",
"build": "rm -rf lib && mkdir lib && node-sass src -o lib && tsc",
"preversion": "npm run test",
"prepublish": "npm run build",
"start": "styleguidist server",
26 changes: 26 additions & 0 deletions tests/ReactPlaceholder.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import * as React from 'react';
import { execSync } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import flatten = require('lodash/flatten');
import ReactPlaceholder from '../src/ReactPlaceholder';
import { shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
@@ -52,3 +56,25 @@ describe('ReactPlaceholder', () => {
});

});

describe('build', () => {

it('build script generates every needed file', () => {
execSync('npm run build', { stdio:[] })

const libPath = path.resolve(__dirname, '../lib');

const libFiles = fs.readdirSync(libPath);

const files = flatten(libFiles.map(fileInRoot => {
const filePath = path.resolve(libPath, fileInRoot);
if (fs.lstatSync(filePath).isDirectory()) {
return fs.readdirSync(filePath).map(fileInFolder => `${fileInRoot}/${fileInFolder}`);
}
return fileInRoot;
}));

expect(files).toMatchSnapshot();
})

})
22 changes: 22 additions & 0 deletions tests/__snapshots__/ReactPlaceholder.test.tsx.snap
Original file line number Diff line number Diff line change
@@ -53,3 +53,25 @@ Array [
/>,
]
`;

exports[`build build script generates every needed file 1`] = `
Array [
"ReactPlaceholder.d.ts",
"ReactPlaceholder.js",
"index.d.ts",
"index.js",
"placeholders/MediaBlock.d.ts",
"placeholders/MediaBlock.js",
"placeholders/RectShape.d.ts",
"placeholders/RectShape.js",
"placeholders/RoundShape.d.ts",
"placeholders/RoundShape.js",
"placeholders/TextBlock.d.ts",
"placeholders/TextBlock.js",
"placeholders/TextRow.d.ts",
"placeholders/TextRow.js",
"placeholders/index.d.ts",
"placeholders/index.js",
"reactPlaceholder.css",
]
`;

0 comments on commit 42c2b79

Please sign in to comment.