Skip to content

Commit

Permalink
Ripped out the code no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
MattStypa committed Mar 15, 2019
1 parent e0cad52 commit 7ec4b11
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 130 deletions.
4 changes: 1 addition & 3 deletions __tests__/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ describe('cli', () => {

it('creates a full Tailwind config file', () => {
return cli(['init', '--full']).then(() => {
expect(utils.writeFile.mock.calls[0][1]).toEqual(
utils.replaceAll(defaultConfigFixture, constants.replacements)
)
expect(utils.writeFile.mock.calls[0][1]).toEqual(defaultConfigFixture)
})
})
})
Expand Down
26 changes: 0 additions & 26 deletions __tests__/cli.utils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,30 +109,4 @@ describe('cli utils', () => {
expect(result).toEqual(expect.stringContaining('__comment_docblock_important__'))
})
})

describe('replaceAll', () => {
it('replaces strings', () => {
const result = utils.replaceAll('test', [['test', 'pass']])

expect(result).toEqual('pass')
})

it('replaces regex patterns', () => {
const result = utils.replaceAll('TEST', [[/test/i, 'pass']])

expect(result).toEqual('pass')
})

it('replaces all matches', () => {
const result = utils.replaceAll('test test', [['test', 'pass']])

expect(result).toEqual('pass pass')
})

it('replaces all multiple patterns', () => {
const result = utils.replaceAll('hello world', [['hello', 'greetings'], ['world', 'earth']])

expect(result).toEqual('greetings earth')
})
})
})
79 changes: 0 additions & 79 deletions defaultConfig.stub.js

This file was deleted.

3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@
]
},
"jest": {
"moduleNameMapper": {
"lib/plugins/container": "<rootDir>/src/plugins/container"
},
"setupFilesAfterEnv": [
"<rootDir>/jest/customMatchers.js"
],
Expand Down
1 change: 0 additions & 1 deletion src/cli/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ export function run(cliParams, cliOptions) {
const stubFile = full ? constants.defaultConfigStubFile : constants.simpleConfigStubFile
let stub = utils.readFile(stubFile)

stub = utils.replaceAll(stub, constants.replacements)
noComments && (stub = utils.stripBlockComments(stub))

utils.writeFile(file, stub)
Expand Down
4 changes: 0 additions & 4 deletions src/cli/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@ export const cli = 'tailwind'
export const defaultConfigFile = 'tailwind.js'
export const defaultConfigStubFile = path.resolve(__dirname, '../../stubs/defaultConfig.stub.js')
export const simpleConfigStubFile = path.resolve(__dirname, '../../stubs/simpleConfig.stub.js')

export const replacements = [
["require('../plugins/container')", "require('tailwindcss/plugins/container')"],
]
14 changes: 0 additions & 14 deletions src/cli/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,3 @@ export function stripBlockComments(input) {
.trim()
.concat('\n')
}

/**
* Performs string replacement for multiple patterns.
*
* @param {string} input
* @param {array} replacements
* @return {string}
*/
export function replaceAll(input, replacements) {
return replacements.reduce(
(str, [pattern, replacement]) => str.split(pattern).join(replacement),
input
)
}

0 comments on commit 7ec4b11

Please sign in to comment.