Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modules legacy and ts #80

Merged
merged 33 commits into from
Jun 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
/package-lock.json
/tests/fixtures/*/build
/tests/fixtures/*/.stylelintcache

# ignore build files
*.d.ts
*.js
!/src/@types/*.d.ts
!/tests/**/*.js
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@
/node_modules
/package-lock.json
/tests
/tsconfig.json

# ignore all .ts when publishing
*.ts
*.tsx
!*.d.ts
22 changes: 14 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
8.1
===
9.0.0
=====

* Always build a legacy and a modern JS build.


8.1.0
=====

* Changed the webpack include order, to avoid false-positive TypeScript errors.
* Activated the `no-prototype-builtins` ESLint rule.
* Automatically add the import for the `h()` function from preact for all modules.


8.0
===
8.0.0
=====

* Removed `enableTypeScript()`.
* Removed `setBrowserList()`.


7.3
===
7.3.0
=====

* Always build source maps.
* Always enable TypeScript for `.ts` / `.tsx` files.
Expand All @@ -23,8 +29,8 @@
* Deprecated `setBrowserList()`.


7.2
===
7.2.0
=====

* Updated bundled KabaScss to 2.x.
* Update the rest of the bundled dependencies.
Expand Down
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
8.x to 9.0
==========

* Internal: The project was ported to TypeScript.
* Always build a legacy and a modern JS build.
* Removed the ability to use the project's `tsconfig.json`.


7.x to 8.0
==========

Expand Down
43 changes: 19 additions & 24 deletions bin/run.js → bin/run.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/usr/bin/env node

const CliConfig = require("../lib/CliConfig");
const {bgYellow, black, green, red, yellow} = require("kleur");
const Logger = require("../lib/Logger");
const printPackageVersions = require("../lib/print-package-versions");
import {kaba} from "../src/@types/kaba";
import {Kaba} from "../src/Kaba";
import {Logger} from "../src/Logger";
const sade = require("sade");
const SassRunner = require("../lib/runner/SassRunner");
const WebpackRunner = require("../lib/runner/WebpackRunner");
import {bgYellow, black, blue, cyan, green, magenta, red, yellow} from "kleur";
import {printPackageVersions} from "../src/print-package-versions";
import {SassRunner} from "../src/runner/SassRunner";
import {WebpackRunner} from "../src/runner/WebpackRunner";


console.log(``);
Expand Down Expand Up @@ -66,7 +67,6 @@ program
console.log("");

runKaba({
analyze: true,
lint: true,
}, !!opts.verbose);
});
Expand Down Expand Up @@ -94,14 +94,14 @@ program
console.log(` ${bgYellow(black(" Versions "))}`);
console.log("");
printPackageVersions(kabaVersion, {
"kaba-babel-preset": "yellow",
"kaba-scss": "yellow",
webpack: "cyan",
"babel-core": "blue",
typescript: "blue",
eslint: "blue",
"node-sass": "magenta",
stylelint: "magenta",
"kaba-babel-preset": yellow,
"kaba-scss": yellow,
webpack: cyan,
"@babel/core": blue,
typescript: blue,
eslint: blue,
"node-sass": magenta,
stylelint: magenta,
});

process.exit(0);
Expand All @@ -115,21 +115,16 @@ program.parse(process.argv);

/**
* Main kaba function
*
* @param {CliConfigArguments} opts
* @param {boolean} isVerbose
*/
function runKaba (opts, isVerbose)
function runKaba (cliConfig: kaba.CliConfig, isVerbose: boolean) : void
{
try
{
const logger = new Logger(bgYellow(black(" kaba ")));
logger.log("kaba started");
const start = process.hrtime();
const cliConfig = new CliConfig(opts);

/** @type {Kaba} kaba */
const kaba = require(`${process.cwd()}/kaba.js`);
const kaba: Kaba = require(`${process.cwd()}/kaba.js`);
const buildConfig = kaba.getBuildConfig(cliConfig);

const scss = new SassRunner(buildConfig, cliConfig);
Expand All @@ -139,7 +134,7 @@ function runKaba (opts, isVerbose)
.then(
([scssOk, webpackOk]) =>
{
const failed = (false === scssOk || false === webpackOk);
const failed = !scssOk || !webpackOk;
const status = failed
? red("failed")
: green("succeeded");
Expand All @@ -153,7 +148,7 @@ function runKaba (opts, isVerbose)
(...args) => console.log("something broke", args)
);

if (cliConfig.isWatch())
if (cliConfig.watch)
{
const exitCallback = () => {
scss.stop();
Expand Down
File renamed without changes.
26 changes: 26 additions & 0 deletions configs/tsconfig.legacy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"alwaysStrict": false,
"esModuleInterop": true,
"experimentalDecorators": true,
"jsx": "react",
"jsxFactory": "h",
"lib": [
"dom",
"es5",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"noImplicitThis": true,
"removeComments": true,
"sourceMap": true,
"strict": false,
"target": "es5"
},
"exclude": [
"../node_modules",
"vendor"
]
}
27 changes: 27 additions & 0 deletions configs/tsconfig.modern.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"alwaysStrict": false,
"esModuleInterop": true,
"experimentalDecorators": true,
"jsx": "react",
"jsxFactory": "h",
"lib": [
"dom",
"es5",
"es2015",
"es2016"
],
"module": "es2015",
"moduleResolution": "node",
"noImplicitThis": true,
"removeComments": true,
"sourceMap": true,
"strict": false,
"target": "es2016"
},
"exclude": [
"../node_modules",
"vendor"
]
}
128 changes: 0 additions & 128 deletions lib/CliConfig.js

This file was deleted.

Loading