Skip to content

Commit

Permalink
feat: initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
joneff committed Jun 16, 2022
0 parents commit aa4e875
Show file tree
Hide file tree
Showing 45 changed files with 24,147 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"header-max-length": [
2,
"always",
100
],
"type-case": [
1,
"always",
[
"lower-case",
"upper-case"
]
],
"type-enum": [
2,
"always",
[
"ci",
"chore",
"docs",
"feat",
"fix",
"perf",
"refactor",
"revert",
"test",
"WIP"
]
]
}
}
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules
**/dist
96 changes: 96 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"root": true,
"extends": [
"eslint:recommended"
],
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"env": {
"browser": true,
"node": true,
"es6": true
},
"rules": {
"no-unexpected-multiline": "error",
"block-scoped-var": "error",
"complexity": [ 1, 15 ],
"consistent-return": "error",
"curly": "error",
"default-case": "error",
"dot-location": ["error", "property"],
"eqeqeq": ["error", "smart"],
"no-alert": "error",
"no-caller": "error",
"no-console": "error",
"no-else-return": "error",
"no-eval": "error",
"no-implied-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-implicit-coercion": "error",
"no-invalid-this": "error",
"no-lone-blocks": "error",
"no-loop-func": "error",
"no-multi-spaces": "error",
"no-native-reassign": "error",
"no-new": "error",
"no-param-reassign": "error",
"no-return-assign": "error",
"no-sequences": "error",
"no-useless-call": "error",
"array-bracket-spacing": ["error", "always"],
"brace-style": ["error", "1tbs", { "allowSingleLine": true }],
"camelcase": "error",
"comma-style": "error",
"consistent-this": ["error", "that"],
"indent": ["error", 4, { "SwitchCase": 1 }],
"jsx-quotes": "error",
"key-spacing": ["error", { "beforeColon": false, "afterColon": true }],
"keyword-spacing": ["error", { "before": true, "after": true }],
"linebreak-style": ["error", "unix"],
"max-params": ["error", 4],
"no-multiple-empty-lines": ["error", {"max": 2}],
"no-nested-ternary": "error",
"no-spaced-func": "error",
"no-trailing-spaces": "error",
"object-curly-spacing": ["error", "always"],
"semi": [ "error", "always" ],
"semi-spacing": "error",
"space-before-blocks": "error",
"space-before-function-paren": ["error", "never"],
"space-infix-ops": ["error", {"int32Hint": false} ],
"arrow-body-style": "error",
"no-confusing-arrow": "error",
"no-class-assign": "error",
"no-const-assign": "error",
"no-dupe-class-members": "error",
"no-this-before-super": "error",
"no-var": "error",
"yoda": ["error", "never", { "exceptRange": true }]
},
"overrides": [
{
"files": [
"**/*.ts"
],
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/triple-slash-reference": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off"
}
}
]
}
50 changes: 50 additions & 0 deletions .github/workflows/ci_unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI | Unit

defaults:
run:
shell: bash

on:
push:
branches:
- '**'

jobs:

run-tests:
name: Run tests
runs-on: ubuntu-latest

steps:

- name: Checkout branch
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install
run: npm ci

- name: Lint scripts
run: npm run eslint

- name: Run tests
run: npm run test


ci-unit:
name: CI | Unit
needs: run-tests
runs-on: ubuntu-latest

steps:

# IMPORTANT NOTE
#
# You can not set a workflow to be status check. The job is. Hence the trickery...

- name: Done
run: echo "Done!"
26 changes: 26 additions & 0 deletions .github/workflows/merge_develop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Merge develop to master

defaults:
run:
shell: bash

on: [workflow_dispatch]

jobs:

merge:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Merge develop to master
run: |
git fetch --quiet
git reset --hard origin/master
git merge --ff-only --quiet origin/develop
git push origin master
43 changes: 43 additions & 0 deletions .github/workflows/release_stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release stable channel

defaults:
run:
shell: bash

on: [workflow_dispatch]

jobs:

release-stable:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v2
with:
ref: master

- name: Merge develop to master
run: |
git fetch --quiet
git reset --hard origin/master
git merge --ff-only --quiet origin/develop
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 16.x

- name: Install
run: npm ci

- name: Publish
run: npx semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update develop
run: |
git push origin master:develop --quiet > /dev/null 2>&1
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Folders
.vscode/
.tmp/
node_modules/
dist/
modules/

# Log files
npm-debug.log
lerna-debug.log
debug.log

# System files
.DS_Store

# Lock files
# package-lock.json
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint -e
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run eslint
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npm run eslint
npm run build
4 changes: 4 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.husky/
__tests__/
scripts/
src/
1 change: 1 addition & 0 deletions __tests__/__fixtures__/at-import.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "simple.scss";
1 change: 1 addition & 0 deletions __tests__/__fixtures__/file.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lorem ipsum
1 change: 1 addition & 0 deletions __tests__/__fixtures__/nested/at-import.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "simple.scss";
4 changes: 4 additions & 0 deletions __tests__/__fixtures__/simple.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$var: red;
body {
color: $var;
}
44 changes: 44 additions & 0 deletions __tests__/sass-build/sass-build.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/// <reference path="../../lib/types/index.d.ts" />

import fs from 'fs';
import path from 'path';
import assert from 'assert';
import { sassBuild } from '../../src/sass-build';
import { logger, fileExists } from '../../src/utils';

const FIXTURES_PATH = path.resolve( __dirname, '../__fixtures__' );

[ 'modern', 'legacy' ].forEach( apiType => {

describe( `${apiType}-sass`, () => {

beforeAll(() => {
logger.level = 'error';
});

beforeEach(() => {
fs.rmSync( `${FIXTURES_PATH}/dist`, { recursive: true, force: true } );
});
afterEach(() => {
fs.rmSync( `${FIXTURES_PATH}/dist`, { recursive: true, force: true } );
});

const opts : Partial<CliOptions> = {
api: 'legacy'
};

const file = `${FIXTURES_PATH}/simple.scss`;
const outFile = `${FIXTURES_PATH}/dist/simple.css`;

describe( 'sassBuild', () => {

test('sassBuild compiles', () => {
sassBuild( file, outFile, <CliOptions> opts );
assert.equal( fileExists( outFile ), true );
});

});

});

});

0 comments on commit aa4e875

Please sign in to comment.