js-build-tools 2.2.11 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/build.js +48 -41
- package/dist/build.min.js +1 -1
- package/dist/bundle.js +7 -8
- package/dist/bundle.min.js +1 -1
- package/dist/bundleLint.js +12 -14
- package/dist/bundleLint.min.js +1 -1
- package/dist/bundleMinify.js +3 -6
- package/dist/bundleMinify.min.js +1 -1
- package/dist/compileReadme.js +8 -6
- package/dist/compileReadme.min.js +1 -1
- package/dist/default.js +8 -7
- package/dist/default.min.js +1 -1
- package/dist/dist.js +2 -4
- package/dist/dist.min.js +1 -1
- package/dist/distLint.js +12 -13
- package/dist/distLint.min.js +1 -1
- package/dist/distMinify.js +3 -5
- package/dist/distMinify.min.js +1 -1
- package/dist/partials/addToReadme.js +9 -12
- package/dist/partials/beginWatcher.js +5 -6
- package/dist/partials/clean.js +3 -12
- package/dist/partials/distFor.js +10 -9
- package/dist/partials/distForSrc.js +3 -3
- package/dist/partials/distSeries.js +13 -14
- package/dist/partials/minifyFor.js +11 -11
- package/dist/partials/readmeTemplate.js +7 -8
- package/dist/partials/removeDirectory.js +7 -16
- package/dist/partials/runOnChange.js +17 -21
- package/dist/partials/sassFor.js +28 -0
- package/dist/partials/tsFor.js +14 -17
- package/dist/partials.js +30 -28
- package/dist/partials.min.js +1 -1
- package/dist/sass.js +7 -0
- package/dist/sass.min.js +1 -0
- package/dist/test-helpers/circularObject.js +1 -1
- package/dist/test-helpers/countMatches.js +1 -5
- package/dist/test-helpers/deepReferenceObject.js +1 -1
- package/dist/test-helpers/domItem.js +1 -1
- package/dist/test-helpers/jsonDom.js +1 -1
- package/dist/test-helpers/linkedList.js +1 -1
- package/dist/test-helpers/logObject.js +4 -7
- package/dist/test-helpers/multiReferenceObject.js +1 -1
- package/dist/test-helpers/nodeTree.js +1 -1
- package/dist/test-helpers/setUp.js +56 -96
- package/dist/testFull.js +6 -5
- package/dist/testFull.min.js +1 -1
- package/dist/testHelpers.js +10 -10
- package/dist/testHelpers.min.js +1 -1
- package/dist/testQuick.js +6 -5
- package/dist/testQuick.min.js +1 -1
- package/dist/typeScript.js +2 -2
- package/dist/typeScript.min.js +1 -1
- package/dist/watchFull.js +5 -6
- package/dist/watchFull.min.js +1 -1
- package/dist/watchTest.js +8 -9
- package/dist/watchTest.min.js +1 -1
- package/functions/build.js +5 -0
- package/functions/build.test.js +87 -11
- package/functions/partials/distFor.test.js +7 -7
- package/functions/partials/sassFor.js +22 -0
- package/functions/partials/sassFor.test.js +62 -0
- package/functions/partials.js +2 -0
- package/functions/partials.test.js +1 -1
- package/functions/sass.js +6 -0
- package/functions/sass.test.js +30 -0
- package/functions/test-helpers/setUp.js +4 -0
- package/gulp.config.js +4 -0
- package/gulpfile.base.js +2 -0
- package/package.json +9 -6
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const setUp = require('../test-helpers/setUp')
|
|
3
|
+
setUp.setDefaults('test-sass-for')
|
|
4
|
+
const gulpConfig = setUp.gulpConfig
|
|
5
|
+
const sassFor = require('./sassFor')
|
|
6
|
+
const { countMatches, logObject } = require('../testHelpers')
|
|
7
|
+
|
|
8
|
+
const sassContents = 'html\n' +
|
|
9
|
+
' font-size: 62.5%\n' +
|
|
10
|
+
' color: #444\n' +
|
|
11
|
+
' font-size: 1em\n' +
|
|
12
|
+
' line-height: 1.4\n' +
|
|
13
|
+
' background-color: #fff\n' +
|
|
14
|
+
'\n' +
|
|
15
|
+
'html, body\n' +
|
|
16
|
+
' width: 100%\n' +
|
|
17
|
+
' height: 100%\n' +
|
|
18
|
+
' margin: 0\n' +
|
|
19
|
+
' padding: 0\n' +
|
|
20
|
+
' position: absolute\n' +
|
|
21
|
+
' text-align: center\n' +
|
|
22
|
+
'\n' +
|
|
23
|
+
'a\n' +
|
|
24
|
+
' outline: none\n' +
|
|
25
|
+
' text-decoration: none'
|
|
26
|
+
|
|
27
|
+
const sassPath = gulpConfig.get('sassPath')
|
|
28
|
+
|
|
29
|
+
beforeEach(() => {
|
|
30
|
+
setUp.beforeEach()
|
|
31
|
+
return fs.mkdirSync(sassPath, { recursive: true })
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
afterEach(setUp.afterEach)
|
|
35
|
+
|
|
36
|
+
describe('sassFor', () => {
|
|
37
|
+
test('copies the sass directory and converts it into css output', done => {
|
|
38
|
+
const sassFile = `${sassPath}/sassFor.sass`
|
|
39
|
+
fs.writeFileSync(sassFile, sassContents)
|
|
40
|
+
expect.assertions(7)
|
|
41
|
+
const oldContents = fs.readFileSync(sassFile).toString()
|
|
42
|
+
expect(countMatches(oldContents, ';')).toEqual(0)
|
|
43
|
+
expect(countMatches(oldContents, ' {')).toEqual(0)
|
|
44
|
+
expect(countMatches(oldContents, '\n' +
|
|
45
|
+
' }')).toEqual(0)
|
|
46
|
+
const cssPath = gulpConfig.get('cssPath')
|
|
47
|
+
sassFor(sassFile)
|
|
48
|
+
.on('finish', () => {
|
|
49
|
+
expect(fs.existsSync(cssPath)).toBeTruthy()
|
|
50
|
+
const cssContents = fs.readFileSync(`${cssPath}/sassFor.css`).toString()
|
|
51
|
+
// Will add braces and semicolons
|
|
52
|
+
expect(countMatches(cssContents, ';')).toEqual(13)
|
|
53
|
+
expect(countMatches(cssContents, '{')).toEqual(3)
|
|
54
|
+
expect(countMatches(cssContents, '}')).toEqual(3)
|
|
55
|
+
done()
|
|
56
|
+
})
|
|
57
|
+
.on('error', error => {
|
|
58
|
+
console.error('Encountered error', error)
|
|
59
|
+
done()
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
})
|
package/functions/partials.js
CHANGED
|
@@ -17,6 +17,7 @@ const minifyFor = require('./partials/minifyFor')
|
|
|
17
17
|
const readmeTemplate = require('./partials/readmeTemplate')
|
|
18
18
|
const removeDirectory = require('./partials/removeDirectory')
|
|
19
19
|
const runOnChange = require('./partials/runOnChange')
|
|
20
|
+
const sassFor = require('./partials/sassFor')
|
|
20
21
|
const tsFor = require('./partials/tsFor')
|
|
21
22
|
|
|
22
23
|
module.exports = {
|
|
@@ -30,5 +31,6 @@ module.exports = {
|
|
|
30
31
|
readmeTemplate,
|
|
31
32
|
removeDirectory,
|
|
32
33
|
runOnChange,
|
|
34
|
+
sassFor,
|
|
33
35
|
tsFor,
|
|
34
36
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const setUp = require('./test-helpers/setUp')
|
|
3
|
+
setUp.setDefaults('test-sass')
|
|
4
|
+
const gulpConfig = setUp.gulpConfig
|
|
5
|
+
const sass = require('./sass')
|
|
6
|
+
|
|
7
|
+
beforeEach(() => setUp.beforeEach().then(
|
|
8
|
+
() => {
|
|
9
|
+
const sassPath = gulpConfig.get('sassPath')
|
|
10
|
+
return fs.mkdirSync(sassPath, { recursive: true })
|
|
11
|
+
}
|
|
12
|
+
))
|
|
13
|
+
|
|
14
|
+
afterEach(setUp.afterEach)
|
|
15
|
+
|
|
16
|
+
describe('sass', () => {
|
|
17
|
+
test('uses the configured paths', done => {
|
|
18
|
+
const sassPath = gulpConfig.get('sassPath')
|
|
19
|
+
expect.assertions(1)
|
|
20
|
+
sass()
|
|
21
|
+
.on('finish', () => {
|
|
22
|
+
expect(fs.existsSync(sassPath)).toBeTruthy()
|
|
23
|
+
done()
|
|
24
|
+
})
|
|
25
|
+
.on('error', error => {
|
|
26
|
+
console.error('Encountered error', error)
|
|
27
|
+
done()
|
|
28
|
+
})
|
|
29
|
+
}, 10000)
|
|
30
|
+
})
|
|
@@ -17,8 +17,10 @@ const setDefaults = (testDir = 'test-temp') => {
|
|
|
17
17
|
srcPath = `${tempDir}src`
|
|
18
18
|
const distPath = `${tempDir}dist`
|
|
19
19
|
const browserPath = `${tempDir}browser`
|
|
20
|
+
const sassPath = `${tempDir}sass`
|
|
20
21
|
gulpConfig.set('browserPath', browserPath)
|
|
21
22
|
gulpConfig.set('cleanPaths', [distPath, browserPath])
|
|
23
|
+
gulpConfig.set('cssPath', `${browserPath}/css`)
|
|
22
24
|
gulpConfig.set('distMain', `${distPath}/main`)
|
|
23
25
|
gulpConfig.set('distPath', distPath)
|
|
24
26
|
gulpConfig.set('distSearch', `${distPath}/**/*.js`)
|
|
@@ -26,6 +28,8 @@ const setDefaults = (testDir = 'test-temp') => {
|
|
|
26
28
|
gulpConfig.set('readmePath', tempDir)
|
|
27
29
|
gulpConfig.set('readmeSearch', `${srcPath}/**/!(*.test).js`)
|
|
28
30
|
gulpConfig.set('rootPath', tempDir)
|
|
31
|
+
gulpConfig.set('sassPath', sassPath)
|
|
32
|
+
gulpConfig.set('sassSearch', `${sassPath}/**/*.+(scss|sass)`)
|
|
29
33
|
gulpConfig.set('srcPath', srcPath)
|
|
30
34
|
gulpConfig.set('srcSearch', `${srcPath}/**/!(*.test).js`)
|
|
31
35
|
gulpConfig.set('tsSearch', `${srcPath}/**/*.ts`)
|
package/gulp.config.js
CHANGED
|
@@ -113,6 +113,7 @@ const setDefaults = {
|
|
|
113
113
|
browserName: 'default',
|
|
114
114
|
browserPath: 'browser',
|
|
115
115
|
cleanPaths: ['dist', 'browser'],
|
|
116
|
+
cssPath: 'browser/css',
|
|
116
117
|
distMain: 'dist/main',
|
|
117
118
|
distPath: 'dist',
|
|
118
119
|
distSearch: 'dist/**/*.js',
|
|
@@ -123,6 +124,8 @@ const setDefaults = {
|
|
|
123
124
|
readmePath: './',
|
|
124
125
|
readmeSearch: 'src/**/!(*.test).js',
|
|
125
126
|
rootPath: './',
|
|
127
|
+
sassPath: 'sass',
|
|
128
|
+
sassSearch: 'sass/**/*.+(scss|sass)',
|
|
126
129
|
srcPath: 'src',
|
|
127
130
|
srcSearch: 'src/**/!(*.test).js',
|
|
128
131
|
testOptions: {
|
|
@@ -138,6 +141,7 @@ const setDefaults = {
|
|
|
138
141
|
},
|
|
139
142
|
testPath: ['src'],
|
|
140
143
|
tsSearch: 'src/**/*.ts',
|
|
144
|
+
useSass: false,
|
|
141
145
|
useTsConfig: false,
|
|
142
146
|
watchSearch: 'src/**/*.js'
|
|
143
147
|
}
|
package/gulpfile.base.js
CHANGED
|
@@ -17,6 +17,7 @@ const distLint = require('./functions/distLint.js')
|
|
|
17
17
|
const distMinify = require('./functions/distMinify.js')
|
|
18
18
|
const gulpConfig = require('./gulp.config.js')
|
|
19
19
|
const partials = require('./functions/partials.js')
|
|
20
|
+
const sass = require('./functions/sass.js')
|
|
20
21
|
const testFull = require('./functions/testFull.js')
|
|
21
22
|
const testHelpers = require('./functions/testHelpers.js')
|
|
22
23
|
const testQuick = require('./functions/testQuick.js')
|
|
@@ -36,6 +37,7 @@ module.exports = {
|
|
|
36
37
|
gulpConfig,
|
|
37
38
|
partials,
|
|
38
39
|
readme: compileReadme,
|
|
40
|
+
sass,
|
|
39
41
|
testFull,
|
|
40
42
|
testHelpers,
|
|
41
43
|
testQuick,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "js-build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Standardised build process with gulp.",
|
|
5
5
|
"main": "gulpfile.base.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,26 +33,29 @@
|
|
|
33
33
|
]
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@babel/core": "^7.23.
|
|
36
|
+
"@babel/core": "^7.23.7",
|
|
37
37
|
"@babel/plugin-proposal-throw-expressions": "^7.23.3",
|
|
38
|
-
"@babel/preset-env": "^7.23.
|
|
38
|
+
"@babel/preset-env": "^7.23.7",
|
|
39
39
|
"@babel/preset-typescript": "^7.23.3",
|
|
40
|
-
"@babel/runtime-corejs3": "^7.23.
|
|
40
|
+
"@babel/runtime-corejs3": "^7.23.7",
|
|
41
41
|
"babel-jest": "^29.7.0",
|
|
42
42
|
"browserify": "^17.0.0",
|
|
43
|
-
"core-js": "^3.
|
|
43
|
+
"core-js": "^3.35.0",
|
|
44
44
|
"fs": "^0.0.1-security",
|
|
45
45
|
"glob": "^10.3.10",
|
|
46
46
|
"gulp": "^4.0.2",
|
|
47
47
|
"gulp-babel": "^8.0.0",
|
|
48
|
+
"gulp-cssnano": "^2.1.3",
|
|
48
49
|
"gulp-rename": "^2.0.0",
|
|
50
|
+
"gulp-sass": "^5.1.0",
|
|
49
51
|
"gulp-standard": "^14.0.0",
|
|
50
52
|
"gulp-typescript": "^6.0.0-alpha.1",
|
|
51
53
|
"gulp-uglify-es": "^3.0.0",
|
|
52
54
|
"jest": "^29.7.0",
|
|
53
55
|
"jest-environment-jsdom": "^29.7.0",
|
|
54
56
|
"jsdoc-to-markdown": "^8.0.0",
|
|
55
|
-
"regenerator-runtime": "^0.14.
|
|
57
|
+
"regenerator-runtime": "^0.14.1",
|
|
58
|
+
"sass": "^1.69.7",
|
|
56
59
|
"vinyl-source-stream": "^2.0.0"
|
|
57
60
|
},
|
|
58
61
|
"files": [
|