Skip to content

Commit

Permalink
build: normalize across repos
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Feb 10, 2021
1 parent 5542c58 commit 2020d61
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .changelogrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const SKIP_COMMANDS = '[skip ci], [ci skip], [skip cd], [cd skip]'.split(', ');

debug('SKIP_COMMANDS:', SKIP_COMMANDS);

sjx.config.silent = true;
sjx.config.silent = !process.env.DEBUG;

// ! XXX: dark magic to synchronously deal with this async package
const wait = sjx.exec(
Expand Down
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module.exports = {
node: true,
jest: true,
'jest/globals': true,
browser: false,
webextensions: false
browser: true,
webextensions: true
},
rules: {
'no-console': 'warn',
Expand Down Expand Up @@ -101,3 +101,4 @@ module.exports = {
};

debug('exports: %O', module.exports);
true;
4 changes: 2 additions & 2 deletions .github/workflows/post-release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Give result of npm publish time to propagate
uses: jakejarvis/wait-action@v0.1.0
uses: kibertoad/wait-action@1.0.1
with:
time: '5m'

Expand Down Expand Up @@ -81,5 +81,5 @@ jobs:
mkdir /tmp/post-release-check
cd /tmp/post-release-check
npm install "${PKG_NAME}@${PKG_VERSION}"
! [ -z "$PKG_BIN" ] && npx --no-install $PKG_BIN --help
! [ -z "$PKG_BIN" ] && npx --no-install $PKG_BIN --help || true
fi
23 changes: 12 additions & 11 deletions babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ const NODE_LTS = 'maintained node versions';

const debug = require('debug')(`${require('./package.json').name}:babel-config`);

// ? Fix relative local imports referencing package.json (.dist/esm/...)
const transformRenameImport = [
'transform-rename-import',
{
replacements: [{ original: '../package.json', replacement: '../../package.json' }]
}
];

module.exports = {
parserOpts: { strictMode: true },
plugins: [
'@babel/plugin-proposal-export-default-from',
'@babel/plugin-proposal-function-bind',
'@babel/plugin-transform-typescript',
// ? Interoperable named CJS imports for free
'babel-plugin-transform-default-named-imports'
'transform-default-named-imports'
],
// ? Sub-keys under the "env" config key will augment the above
// ? configuration depending on the value of NODE_ENV and friends. Default
Expand Down Expand Up @@ -49,7 +57,8 @@ module.exports = {
['@babel/preset-env', { targets: { node: true } }],
['@babel/preset-typescript', { allowDeclareFields: true }]
// ? Webpack will handle minification
]
],
plugins: [transformRenameImport]
},
// * Used for compiling ESM code output somewhere in ./dist
esm: {
Expand All @@ -68,15 +77,7 @@ module.exports = {
plugins: [
// ? Ensure all local imports without extensions now end in .mjs
['add-import-extension', { extension: 'mjs' }],
// ? Fix relative local imports referencing package.json (.dist/esm/...)
[
'transform-rename-import',
{
replacements: [
{ original: '../package.json', replacement: '../../package.json' }
]
}
]
transformRenameImport
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion spellcheck-commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const sjx = require('shelljs');

const debug = require('debug')(`${require('./package.json').name}:spellcheck-commit`);

sjx.config.silent = true;
sjx.config.silent = !process.env.DEBUG;

const tryToRead = async (path) => {
try {
Expand Down
9 changes: 9 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,36 @@
import { name as pkgName } from '../package.json';
import debugFactory from 'debug';

const debug = debugFactory(`${pkgName}:git-lib`);

/**
* Returns the sum of `a` and `b`
*/
export function sum(a: number, b: number) {
debug(`summed ${a} and ${b}`);
return a + b;
}

/**
* Returns the difference of `a` and `b`
*/
export function diff(a: number, b: number) {
debug(`subtracted ${b} from ${a}`);
return a - b;
}

/**
* Returns the product of `a` and `b`
*/
export function mult(a: number, b: number) {
debug(`multiplies ${a} and ${b}`);
return a * b;
}

/**
* Returns the quotient of `dividend` and `divisor`
*/
export function div({ dividend, divisor }: { dividend: number; divisor: number }) {
debug(`divides ${dividend} with ${divisor}`);
return dividend / divisor;
}

0 comments on commit 2020d61

Please sign in to comment.