Use archiver directly rather than grunt-contrib-compress
Removes two old copies of glob and is another step towards removing Grunt.
This commit is contained in:
@@ -6,7 +6,6 @@ module.exports = function(grunt) {
|
|||||||
pkg: pkg,
|
pkg: pkg,
|
||||||
concat: require('./grunt/config/concat.js'),
|
concat: require('./grunt/config/concat.js'),
|
||||||
sass: require('./grunt/config/sass.js'),
|
sass: require('./grunt/config/sass.js'),
|
||||||
compress: require('./grunt/config/compress.js'),
|
|
||||||
cssUrlEmbed: require('./grunt/config/cssUrlEmbed.js')
|
cssUrlEmbed: require('./grunt/config/cssUrlEmbed.js')
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
var standaloneLibDir = "lib/jasmine-" + jasmineVersion;
|
|
||||||
|
|
||||||
function root(path) { return "./" + path; }
|
|
||||||
function libJasmineCore(path) { return root("lib/jasmine-core/" + path); }
|
|
||||||
function dist(path) { return root("dist/" + path); }
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
standalone: {
|
|
||||||
options: {
|
|
||||||
archive: root("dist/jasmine-standalone-" + global.jasmineVersion + ".zip")
|
|
||||||
},
|
|
||||||
|
|
||||||
files: [
|
|
||||||
{ src: [ root("LICENSE") ] },
|
|
||||||
{
|
|
||||||
src: [ "jasmine_favicon.png"],
|
|
||||||
dest: standaloneLibDir,
|
|
||||||
expand: true,
|
|
||||||
cwd: root("images")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
src: [
|
|
||||||
"jasmine.js",
|
|
||||||
"jasmine-html.js",
|
|
||||||
"jasmine.css"
|
|
||||||
],
|
|
||||||
dest: standaloneLibDir,
|
|
||||||
expand: true,
|
|
||||||
cwd: libJasmineCore("")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
src: [ "boot0.js", "boot1.js" ],
|
|
||||||
dest: standaloneLibDir,
|
|
||||||
expand: true,
|
|
||||||
cwd: libJasmineCore("")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
src: [ "SpecRunner.html" ],
|
|
||||||
dest: root(""),
|
|
||||||
expand: true,
|
|
||||||
cwd: dist("tmp")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
src: [ "*.js" ],
|
|
||||||
dest: "src",
|
|
||||||
expand: true,
|
|
||||||
cwd: libJasmineCore("example/src/")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
src: [ "*.js" ],
|
|
||||||
dest: "spec",
|
|
||||||
expand: true,
|
|
||||||
cwd: libJasmineCore("example/spec/")
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,8 @@
|
|||||||
var grunt = require("grunt");
|
var grunt = require("grunt");
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
const archiver = require('archiver');
|
||||||
|
const glob = require('glob');
|
||||||
|
|
||||||
function standaloneTmpDir(path) { return "dist/tmp/" + path; }
|
function standaloneTmpDir(path) { return "dist/tmp/" + path; }
|
||||||
|
|
||||||
@@ -20,12 +24,76 @@ grunt.registerTask("build:cleanSpecRunner",
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const standaloneFileGroups = [
|
||||||
|
{
|
||||||
|
src: [
|
||||||
|
'LICENSE',
|
||||||
|
'dist/tmp/SpecRunner.html',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: [
|
||||||
|
'images/jasmine_favicon.png',
|
||||||
|
'lib/jasmine-core/jasmine.js',
|
||||||
|
'lib/jasmine-core/jasmine-html.js',
|
||||||
|
'lib/jasmine-core/jasmine.css',
|
||||||
|
'lib/jasmine-core/boot0.js',
|
||||||
|
'lib/jasmine-core/boot1.js',
|
||||||
|
],
|
||||||
|
destDir: 'lib/jasmine-' + jasmineVersion
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: glob.sync('lib/jasmine-core/example/src/*.js'),
|
||||||
|
destDir: 'src'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: glob.sync('lib/jasmine-core/example/spec/*.js'),
|
||||||
|
destDir: 'spec'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
grunt.registerTask("zipStandaloneDist",
|
||||||
|
"Creates a zip file for the standalone distribution",
|
||||||
|
function() {
|
||||||
|
const done = this.async();
|
||||||
|
const destPath = `./dist/jasmine-standalone-${global.jasmineVersion}.zip`;
|
||||||
|
const output = fs.createWriteStream(destPath);
|
||||||
|
const archive = archiver('zip');
|
||||||
|
|
||||||
|
output.on('close', done);
|
||||||
|
|
||||||
|
archive.on('warning', function (err) {
|
||||||
|
grunt.fail.warn(err)
|
||||||
|
});
|
||||||
|
|
||||||
|
archive.on('error', function (err) {
|
||||||
|
grunt.fail.warn(err)
|
||||||
|
});
|
||||||
|
|
||||||
|
archive.pipe(output);
|
||||||
|
|
||||||
|
for (const group of standaloneFileGroups) {
|
||||||
|
for (const srcPath of group.src) {
|
||||||
|
let destPath = path.basename(srcPath);
|
||||||
|
|
||||||
|
if (group.destDir) {
|
||||||
|
destPath = `${group.destDir}/${destPath}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
archive.file(srcPath, {name: destPath});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
archive.finalize();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
grunt.registerTask("buildStandaloneDist",
|
grunt.registerTask("buildStandaloneDist",
|
||||||
"Builds a standalone distribution",
|
"Builds a standalone distribution",
|
||||||
[
|
[
|
||||||
"buildDistribution",
|
"buildDistribution",
|
||||||
"build:compileSpecRunner",
|
"build:compileSpecRunner",
|
||||||
"compress:standalone",
|
"zipStandaloneDist",
|
||||||
"build:cleanSpecRunner"
|
"build:cleanSpecRunner"
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -36,6 +36,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/eslintrc": "^3.3.1",
|
"@eslint/eslintrc": "^3.3.1",
|
||||||
"@eslint/js": "^9.24.0",
|
"@eslint/js": "^9.24.0",
|
||||||
|
"archiver": "^7.0.1",
|
||||||
"css-url-embed": "github:sgravrock/css-url-embed",
|
"css-url-embed": "github:sgravrock/css-url-embed",
|
||||||
"eslint": "^9.24.0",
|
"eslint": "^9.24.0",
|
||||||
"eslint-plugin-compat": "^6.0.2",
|
"eslint-plugin-compat": "^6.0.2",
|
||||||
@@ -43,7 +44,6 @@
|
|||||||
"globals": "^16.0.0",
|
"globals": "^16.0.0",
|
||||||
"grunt": "^1.0.4",
|
"grunt": "^1.0.4",
|
||||||
"grunt-cli": "^1.3.2",
|
"grunt-cli": "^1.3.2",
|
||||||
"grunt-contrib-compress": "^2.0.0",
|
|
||||||
"grunt-contrib-concat": "^2.0.0",
|
"grunt-contrib-concat": "^2.0.0",
|
||||||
"grunt-sass": "^4.0.0",
|
"grunt-sass": "^4.0.0",
|
||||||
"jasmine": "^5.0.0",
|
"jasmine": "^5.0.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user