Skip to content

Commit

Permalink
v3.10.0-beta.2 -- Cleanup NPM and git included files (#3412)
Browse files Browse the repository at this point in the history
* Cleanup NPM and git included files
* Compile Rollup.js on the fly for Node 6 compatibility
* Remove Node 6 from Travis because it never works
* Add note about Node 6 deprecation
  • Loading branch information
matthew-dean committed Aug 7, 2019
1 parent bd76d65 commit c0f5e97
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Expand Up @@ -5,6 +5,8 @@ build/
.grunt/
benchmark/
test/
test/less-bom/
lib/
# re-include test files as they can be useful for plugins that do testing
!test/*.js
tmp/
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -6,7 +6,6 @@ node_js:
- "12"
- "10"
- "8"
- "6"
before_install:
# from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-177592725
# and also from https://github.com/travis-ci/travis-ci/issues/3225#issuecomment-200965782
Expand Down
19 changes: 15 additions & 4 deletions Gruntfile.js
Expand Up @@ -178,6 +178,17 @@ module.exports = function(grunt) {
// Make the SauceLabs jobs
["all"].concat(browserTests).map(makeJob);

var semver = require('semver');
var path = require('path');

// Handle async / await in Rollup build for tests
// Remove this when Node 6 is no longer supported for the build/test process
const nodeVersion = semver.major(process.versions.node);
let scriptRuntime = 'node';
if (nodeVersion < 8) {
scriptRuntime = path.resolve(path.join('node_modules', '.bin', 'babel-node')) + ' --presets=@babel/env';
}

// Project configuration.
grunt.initConfig({
shell: {
Expand All @@ -190,14 +201,14 @@ module.exports = function(grunt) {
},
build: {
command: [
"node build/rollup.js --dist"
scriptRuntime + " build/rollup.js --dist"
].join(" && ")
},
testbuild: {
command: [
"node build/rollup.js --lessc --out=./tmp/lessc",
"node build/rollup.js --node --out=./tmp/less.cjs.js",
"node build/rollup.js --browser --out=./test/browser/less.min.js"
scriptRuntime + " build/rollup.js --lessc --out=./tmp/lessc",
scriptRuntime + " build/rollup.js --node --out=./tmp/less.cjs.js",
scriptRuntime + " build/rollup.js --browser --out=./test/browser/less.min.js"
].join(" && ")
},
test: {
Expand Down
1 change: 1 addition & 0 deletions bin/lessc
@@ -1,4 +1,5 @@
#!/usr/bin/env node
// AUTO-GENERATED BY ROLLUP

'use strict';

Expand Down
10 changes: 3 additions & 7 deletions build/rollup.js
Expand Up @@ -127,7 +127,7 @@ async function buildLessC() {

await bundle.write({
file: path.join(rootPath, file),
banner: '#!/usr/bin/env node\n',
banner: '#!/usr/bin/env node\n// AUTO-GENERATED BY ROLLUP\n',
format: 'cjs',
interop: false
});
Expand All @@ -144,9 +144,5 @@ async function build() {
await buildNode();
}
}
try {
build();
}
catch (e) {
throw e;
}

build();
2 changes: 1 addition & 1 deletion dist/less.js
@@ -1,5 +1,5 @@
/**
* Less - Leaner CSS v3.10.0-beta
* Less - Leaner CSS v3.10.0-beta.2
* http://lesscss.org
*
* Copyright (c) 2009-2019, Alexis Sellier <self@cloudhead.net>
Expand Down
2 changes: 1 addition & 1 deletion dist/less.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "less",
"version": "3.10.0-beta",
"version": "3.10.0-beta.2",
"description": "Leaner CSS",
"homepage": "http://lesscss.org",
"author": {
Expand Down Expand Up @@ -51,6 +51,7 @@
"devDependencies": {
"@babel/cli": "^7.5.5",
"@babel/core": "^7.5.5",
"@babel/node": "^7.5.5",
"@babel/preset-env": "^7.5.5",
"@typescript-eslint/eslint-plugin": "^1.13.0",
"@typescript-eslint/parser": "^1.13.0",
Expand Down Expand Up @@ -81,6 +82,7 @@
"rollup-plugin-commonjs": "^10.0.1",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-terser": "^5.1.1",
"semver": "^6.3.0",
"time-grunt": "^1.3.0",
"typescript": "^3.5.3",
"uikit": "2.27.4"
Expand Down
11 changes: 10 additions & 1 deletion test/less-test.js
Expand Up @@ -7,7 +7,16 @@ module.exports = function() {
doBomTest = false,
clone = require('clone');

var less = require('../tmp/less.cjs.js');
var less;

// Dist fallback for NPM-installed Less (for plugins that do testing)
try {
less = require('../tmp/less.cjs.js');
}
catch (e) {
less = require('../dist/less.cjs.js');
}

var stylize = require('../lib/less-node/lessc-helper').stylize;

var globals = Object.keys(global);
Expand Down
13 changes: 11 additions & 2 deletions test/modify-vars.js
@@ -1,5 +1,14 @@
var less = require('../tmp/less.cjs.js'),
fs = require('fs');
var less;

// Dist fallback for NPM-installed Less (for plugins that do testing)
try {
less = require('../tmp/less.cjs.js');
}
catch (e) {
less = require('../dist/less.cjs.js');
}

var fs = require('fs');

var input = fs.readFileSync('./test/less/modifyVars/extended.less', 'utf8');
var expectedCss = fs.readFileSync('./test/css/modifyVars/extended.css', 'utf8');
Expand Down

0 comments on commit c0f5e97

Please sign in to comment.