Skip to content

Commit 38b9d9e

Browse files
committed
prepared folder structure for real cli
1 parent 13f72d4 commit 38b9d9e

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed
File renamed without changes.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "rename-css-selectors",
33
"version": "0.0.2",
44
"description": "Rename css classes and id's in files",
5-
"main": "./lib/cli.js",
5+
"main": "./index.js",
66
"scripts": {
77
"test": "mocha --recursive",
88
"coverage": "istanbul cover _mocha -- --recursive",

test/cli.spec.js renamed to test/index.spec.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
const cli = require('../lib/cli');
3+
const app = require('../');
44
const rcs = require('rcs-core');
55
const fs = require('fs-extra');
66
const expect = require('chai').expect;
@@ -9,7 +9,7 @@ const testCwd = 'test/files/testCache';
99
const fixturesCwd = 'test/files/fixtures';
1010
const resultsCwd = 'test/files/results';
1111

12-
describe('cli.js', () => {
12+
describe('app.js', () => {
1313
beforeEach(() => {
1414
// reset counter and selectors for tests
1515
rcs.selectorLibrary.selectors = {};
@@ -24,7 +24,7 @@ describe('cli.js', () => {
2424

2525
describe('processing', () => {
2626
it('should process css files', done => {
27-
cli.process('**/*.css', {
27+
app.process('**/*.css', {
2828
collectSelectors: true,
2929
newPath: testCwd,
3030
cwd: fixturesCwd
@@ -48,7 +48,7 @@ describe('cli.js', () => {
4848
// duplicated code from the test before
4949
// but another function - especially for css
5050
it('should process css files with processCss', done => {
51-
cli.processCss('**/*.css', {
51+
app.processCss('**/*.css', {
5252
newPath: testCwd,
5353
cwd: fixturesCwd
5454
}, (err, data) => {
@@ -70,7 +70,7 @@ describe('cli.js', () => {
7070

7171

7272
it('should process css files and flatten the directories', done => {
73-
cli.process('**/*.css', {
73+
app.process('**/*.css', {
7474
collectSelectors: true,
7575
flatten: true,
7676
newPath: testCwd,
@@ -91,7 +91,7 @@ describe('cli.js', () => {
9191

9292
it('should process js files', done => {
9393
rcs.replace.fileCss(fixturesCwd + '/style.css', (err, data) => {
94-
cli.process('**/*.txt', {
94+
app.process('**/*.txt', {
9595
newPath: testCwd,
9696
cwd: fixturesCwd
9797
}, (err, data) => {
@@ -108,7 +108,7 @@ describe('cli.js', () => {
108108

109109
it('should process html files', done => {
110110
rcs.replace.fileCss(fixturesCwd + '/style.css', (err, data) => {
111-
cli.process('**/*.html', {
111+
app.process('**/*.html', {
112112
newPath: testCwd,
113113
cwd: fixturesCwd
114114
}, (err, data) => {
@@ -124,7 +124,7 @@ describe('cli.js', () => {
124124
});
125125

126126
it('should fail', done => {
127-
cli.process('path/**/with/nothing/in/it', err => {
127+
app.process('path/**/with/nothing/in/it', err => {
128128
expect(err).to.be.an('object');
129129
expect(err.error).to.equal('ENOENT');
130130

@@ -135,7 +135,7 @@ describe('cli.js', () => {
135135

136136
describe('generating files', () => {
137137
beforeEach(done => {
138-
cli.processCss('**/*.css', {
138+
app.processCss('**/*.css', {
139139
newPath: testCwd,
140140
cwd: fixturesCwd
141141
}, (err, data) => {
@@ -144,7 +144,7 @@ describe('cli.js', () => {
144144
});
145145

146146
it('should create the normal library file', done => {
147-
cli.generateLibraryFile(testCwd, (err, data) => {
147+
app.generateLibraryFile(testCwd, (err, data) => {
148148
const cssMapping = fs.readFileSync(testCwd + '/renaming_map.js', 'utf8');
149149

150150
expect(err).to.not.exist;
@@ -158,7 +158,7 @@ describe('cli.js', () => {
158158
});
159159

160160
it('should create the minified library file', done => {
161-
cli.generateLibraryFile(testCwd, {
161+
app.generateLibraryFile(testCwd, {
162162
cssMapping: false,
163163
cssMappingMin: true
164164
}, (err, data) => {
@@ -175,7 +175,7 @@ describe('cli.js', () => {
175175
});
176176

177177
it('should create the extended normal library file', done => {
178-
cli.generateLibraryFile(testCwd, {
178+
app.generateLibraryFile(testCwd, {
179179
extended: true
180180
}, (err, data) => {
181181
const cssMapping = fs.readFileSync(testCwd + '/renaming_map.js', 'utf8');
@@ -191,7 +191,7 @@ describe('cli.js', () => {
191191
});
192192

193193
it('should create the minified library file', done => {
194-
cli.generateLibraryFile(testCwd, {
194+
app.generateLibraryFile(testCwd, {
195195
cssMapping: false,
196196
cssMappingMin: true,
197197
extended: true
@@ -209,7 +209,7 @@ describe('cli.js', () => {
209209
});
210210

211211
it('should create the both library files', done => {
212-
cli.generateLibraryFile(testCwd, {
212+
app.generateLibraryFile(testCwd, {
213213
cssMapping: true,
214214
cssMappingMin: true
215215
}, (err, data) => {
@@ -227,7 +227,7 @@ describe('cli.js', () => {
227227
});
228228

229229
it('should create the both extended library files', done => {
230-
cli.generateLibraryFile(testCwd, {
230+
app.generateLibraryFile(testCwd, {
231231
extended: true,
232232
cssMapping: true,
233233
cssMappingMin: true
@@ -249,7 +249,7 @@ describe('cli.js', () => {
249249
describe('include config', () => {
250250
it('should set the config with package.json', done => {
251251
// include config
252-
cli.includeConfig();
252+
app.includeConfig();
253253

254254
// include new settings
255255
rcs.selectorLibrary.set(['js', 'any-value']);
@@ -273,7 +273,7 @@ describe('cli.js', () => {
273273
});
274274

275275
// include config
276-
cli.includeConfig();
276+
app.includeConfig();
277277

278278
// include new settings
279279
rcs.selectorLibrary.set(['flexbox', 'any-value']);
@@ -288,7 +288,7 @@ describe('cli.js', () => {
288288

289289
it('should set the config with package.json', done => {
290290
// include config
291-
cli.includeConfig('test/files/config.json');
291+
app.includeConfig('test/files/config.json');
292292

293293
// include new settings
294294
rcs.selectorLibrary.set(['own-file', 'any-value']);

0 commit comments

Comments
 (0)