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

breaking: drop support for ES, UMD formats #991

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 3 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ on:
branches: [master]

jobs:
build:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/cache@v2
id: yarn-cache
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies and build the library
- name: Test TypeScript definitions
run: |
yarn
yarn build:lib
yarn test:types
13 changes: 3 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,24 @@
"license": "Apache-2.0",
"description": "Svelte implementation of the Carbon Design System",
"svelte": "./src/index.js",
"main": "./lib/index.js",
"module": "./lib/index.mjs",
"main": "./src/index.js",
"types": "./types/index.d.ts",
"type": "module",
"sideEffects": [
"css/*.css"
],
"scripts": {
"test:types": "svelte-check --workspace tests",
"build:css": "node scripts/build-css",
"build:docs": "node scripts/build-docs",
"build:lib": "rollup -c",
"prepack": "yarn build:docs & yarn build:lib",
"prepack": "yarn build:docs",
"format": "prettier --write \"./**/*.{svelte,js,md}\"",
"prepare": "husky install"
},
"dependencies": {
"flatpickr": "4.6.9"
},
"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.3",
"@rollup/plugin-node-resolve": "^13.3.0",
"@tsconfig/svelte": "^3.0.0",
"autoprefixer": "^10.4.8",
"carbon-components": "10.56.0",
Expand All @@ -34,9 +31,6 @@
"postcss": "^8.4.16",
"prettier": "^2.7.1",
"prettier-plugin-svelte": "^2.7.0",
"rollup": "^2.78.1",
"rollup-plugin-svelte": "^7.1.0",
"rollup-plugin-terser": "^7.0.2",
"sass": "^1.49.11",
"sveld": "^0.17.2",
"svelte": "^3.46.6",
Expand Down Expand Up @@ -66,7 +60,6 @@
"carbon design system"
],
"files": [
"lib",
"src",
"types",
"css"
Expand Down
27 changes: 0 additions & 27 deletions rollup.config.js

This file was deleted.

56 changes: 27 additions & 29 deletions scripts/build-css.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
const fs = require("fs");
const sass = require("sass");
const autoprefixer = require("autoprefixer");
const postcss = require("postcss");
const path = require("path");
import fs from "fs";
import sass from "sass";
import autoprefixer from "autoprefixer";
import postcss from "postcss";
import path from "path";

(async () => {
const scss = fs
.readdirSync("css")
.filter((file) => file.endsWith(".scss") && !/^\_popover/.test(file))
.map((file) => path.parse(file));
const scss = fs
.readdirSync("css")
.filter((file) => file.endsWith(".scss") && !/^\_popover/.test(file))
.map((file) => path.parse(file));

for (const { name, base } of scss) {
const file = `css/${base}`;
const outFile = `css/${name}.css`;
for (const { name, base } of scss) {
const file = `css/${base}`;
const outFile = `css/${name}.css`;

console.log("[build-css]", file, "-->", outFile);
console.log("[build-css]", file, "-->", outFile);

const { css } = sass.renderSync({
file,
outFile,
outputStyle: "compressed",
omitSourceMapUrl: true,
includePaths: ["node_modules"],
});
const { css } = sass.renderSync({
file,
outFile,
outputStyle: "compressed",
omitSourceMapUrl: true,
includePaths: ["node_modules"],
});

const prefixed = await postcss([
autoprefixer({
overrideBrowserslist: ["last 1 version", "ie >= 11", "Firefox ESR"],
}),
]).process(css, { from: undefined });
const prefixed = await postcss([
autoprefixer({
overrideBrowserslist: ["last 1 version", "ie >= 11", "Firefox ESR"],
}),
]).process(css, { from: undefined });

fs.writeFileSync(outFile, prefixed.css);
}
})();
fs.writeFileSync(outFile, prefixed.css);
}
11 changes: 7 additions & 4 deletions scripts/build-docs.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
const fs = require("fs");
const glob = require("glob");
const { sveld } = require("sveld");
const pkg = require("../package.json");
import fs from "fs";
import glob from "glob";
import { sveld } from "sveld";

const pkg = JSON.parse(
fs.readFileSync(new URL("../package.json", import.meta.url), "utf8")
);

sveld({
glob: true,
Expand Down
Loading