Skip to content

Commit

Permalink
Update all deps with necessary fixes (#42)
Browse files Browse the repository at this point in the history
* Add workflow

* fix global in eslint

* patch

* Add test:build

* typo

* WIP: build still broken

* remove lock from ignore

* fix warning in new version

* Update names adding opts for more clarity

* Update UMD wrapper

* update snaps for plugins

* potential fix

* remove cross-env form CI

* add yarn before jest
  • Loading branch information
jalal246 committed Dec 11, 2020
1 parent f0d3cce commit 96cb84d
Show file tree
Hide file tree
Showing 16 changed files with 7,070 additions and 53 deletions.
12 changes: 5 additions & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ module.exports = {
globals: {
Atomics: "readonly",
SharedArrayBuffer: "readonly",
describe: true,
it: true,
expect: true,
jest: true,
},
parserOptions: {
ecmaVersion: 2018,
Expand All @@ -15,11 +19,5 @@ module.exports = {
rules: {
"no-console": ["error", { allow: ["warn", "error"] }],
},
globals: {
describe: true,
it: true,
expect: true,
jest: true,
},
ignorePatterns: ["dist"],
ignorePatterns: ["dist", "test/fixtures"],
};
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
day: "sunday"


- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
60 changes: 60 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Configuration for probot-stale - https://github.com/probot/stale

# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 30

# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7

# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
onlyLabels: []

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- pinned
- security
- feature

# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false

# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false

# Set to true to ignore issues with an assignee (defaults to false)
exemptAssignees: false

# Label to use when marking as stale
staleLabel: wontfix

# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.

# Comment to post when closing a stale Issue or Pull Request.
# closeComment: >
# Your comment here.

# Limit the number of actions per hour, from 1-30. Default is 30
# limitPerRun: 30
# Limit to only `issues` or `pulls`
# only: issues

# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
# pulls:
# daysUntilStale: 30
# markComment: >
# This pull request has been automatically marked as stale because it has not had
# recent activity. It will be closed if no further activity occurs. Thank you
# for your contributions.

# issues:
# exemptLabels:
# - confirmed
32 changes: 32 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Lint

on:
push:
branches:
- master
pull_request:

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Set Node.js 14.x
uses: actions/setup-node@master
with:
node-version: 14.x

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: yarn

- name: Run lint
run: yarn eslint .
69 changes: 69 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Unit Test
on:
push:
branches:
- master
pull_request:

jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Set Node.js 14.x
uses: actions/setup-node@master
with:
node-version: 14.x

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: yarn

- name: Run Build
run: yarn build

- name: Run Test
run: CI=true yarn jest --coverage

- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) -C $GITHUB_SHA -B ${GITHUB_REF#refs/heads/} -Z
env:
CODECOV_TOKEN: 7d3431ac-fcb5-4dbb-8e04-ea5a890b492c


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

- name: Set Node.js 14.x
uses: actions/setup-node@master
with:
node-version: 14.x

- name: Cache Dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: yarn

- name: Run Build
run: yarn build

- name: Run Test
run: USE_BUILD=DIST yarn jest


1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
*.log
*.lock
.changelog
build
dist
Expand Down
43 changes: 23 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"scripts": {
"build": "node --require @babel/register build.self.js",
"prepublish": "yarn build",
"test": "jest"
"test:build": "yarn build && cross-env USE_BUILD=DIST jest",
"test": "cross-env USE_BUILD=SRC jest"
},
"files": [
"src",
Expand Down Expand Up @@ -47,32 +48,33 @@
"filter"
],
"dependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-object-rest-spread": "^7.9.5",
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/preset-env": "^7.8.3",
"@babel/preset-typescript": "^7.9.0",
"@rollup/plugin-alias": "^3.0.1",
"@rollup/plugin-commonjs": "^11.0.1",
"@rollup/plugin-json": "^4.0.1",
"@rollup/plugin-multi-entry": "^3.0.0",
"@rollup/plugin-node-resolve": "^7.0.0",
"@rollup/pluginutils": "^3.0.9",
"babel-plugin-macros": "^2.8.0",
"@babel/preset-env": "^7.12.10",
"@babel/preset-typescript": "^7.12.7",
"@rollup/plugin-alias": "^3.1.1",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-multi-entry": "^4.0.0",
"@rollup/plugin-node-resolve": "^11.0.0",
"@rollup/pluginutils": "^4.1.0",
"babel-plugin-macros": "^3.0.0",
"babel-plugin-transform-async-to-promises": "^0.8.15",
"get-info": "^2.4.4",
"move-position": "^1.0.0",
"package-sorter": "^1.1.1",
"postcss": "^8.2.1",
"rimraf": "^3.0.2",
"rollup": "^1.29.1",
"rollup-plugin-postcss": "^2.6.2",
"rollup-plugin-terser": "^5.2.0",
"rollup-plugin-typescript2": "^0.27.0",
"typescript": "^3.8.3",
"update-notifier": "^4.1.0",
"rollup": "^2.34.2",
"rollup-plugin-postcss": "^4.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"typescript": "^4.1.2",
"update-notifier": "^5.0.1",
"validate-access": "^0.3.0",
"yargs": "^15.3.1"
"yargs": "^16.2.0"
},
"devDependencies": {
"@babel/plugin-external-helpers": "^7.8.3",
Expand All @@ -81,6 +83,7 @@
"@babel/register": "^7.9.0",
"babel-eslint": "^10.0.3",
"babel-jest": "^25.1.0",
"cross-env": "^7.0.3",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-prettier": "^6.9.0",
Expand Down
16 changes: 8 additions & 8 deletions src/builderz.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@ import StateHandler from "./store";
*/
async function build(inputFunc, outputFunc, { isProd, buildFormat, order }) {
try {
const input = await inputFunc({
const inputOpts = await inputFunc({
isProd,
buildFormat,
idx: order,
});

const output = await outputFunc({
isProd,
buildFormat,
});

/**
* create a bundle
*/
const bundle = await rollup(input);
const bundle = await rollup(inputOpts);

const outputOpts = await outputFunc({
isProd,
buildFormat,
});

/**
* write the bundle to disk
*/
await bundle.write(output);
await bundle.write(outputOpts);
} catch (err) {
console.error(err);
}
Expand Down
1 change: 0 additions & 1 deletion src/config/input/getInput.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import getPlugins from "./getInputPlugins";
import getExternal from "./getInputExternal";
import { cache } from "../../utils";

/**
* Generates output build
Expand Down
9 changes: 3 additions & 6 deletions src/config/input/getInputPlugins.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { join } from "path";

import resolve from "@rollup/plugin-node-resolve";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import json from "@rollup/plugin-json";
import aliasPlugin from "@rollup/plugin-alias";
Expand Down Expand Up @@ -45,13 +45,13 @@ function getPlugins(
* Convert CommonJS modules to ES6, so they can be included in a Rollup
* bundle.
*/
commonjs(),
commonjs({ dynamicRequireTargets: [] }),

/**
* Locates modules using the Node resolution algorithm, for using third
* party modules in node_modules.
*/
resolve({
nodeResolve({
preferBuiltins: true,
extensions: [".mjs", ".js", ".jsx", ".json", ".node"],
}),
Expand All @@ -78,9 +78,6 @@ function getPlugins(
// default undefined
ecma: 5,

// default false
sourcemap: true,

// display warnings when dropping unreachable code or unused declarations etc
warnings: true,

Expand Down
1 change: 1 addition & 0 deletions src/config/output/getOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ function getOutput(
const output = {
file: join(buildPath, bundleName),
format: buildFormat,
exports: "auto", // Prevent warning for rollup@^2.22.0
esModule,
strict,
interop: false,
Expand Down
4 changes: 2 additions & 2 deletions test/__snapshots__/babelOpts.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ exports[`tests babel-reads-presets for testing: embedded presets passes 5`] = `
`;

exports[`tests babel-reads-presets for testing: embedded presets passes 6`] = `
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=e||self).babelReadsPresets=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
"!function(e,r){\\"object\\"==typeof exports&&\\"undefined\\"!=typeof module?module.exports=r():\\"function\\"==typeof define&&define.amd?define(r):(e=\\"undefined\\"!=typeof globalThis?globalThis:e||self).babelReadsPresets=r()}(this,function(){var e=function(){try{for(var e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];return Promise.resolve(r.reduce(function(e,r){return e+r},0))}catch(e){return Promise.reject(e)}};return function(){for(var r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];try{return Promise.resolve(e.apply(void 0,n)).then(function(r){return Promise.resolve(e.apply(void 0,n)).then(function(e){return[r,e]})})}catch(e){return Promise.reject(e)}}});
//# sourceMappingURL=babelReadsPresets.min.umd.js.map
"
`;
Expand All @@ -189,7 +189,7 @@ exports[`tests babel-reads-presets for testing: embedded presets passes 7`] = `
"(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = global || self, global.babelReadsPresets = factory());
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.babelReadsPresets = factory());
}(this, (function () {
var two = function two() {
try {
Expand Down
Loading

0 comments on commit 96cb84d

Please sign in to comment.