-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
3,923 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
"files": [ | ||
"README.md" | ||
], | ||
"imageSize": 100, | ||
"commit": false, | ||
"contributors": [ | ||
{ | ||
"login": "alejandrofdiaz", | ||
"name": "Alejandro", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/9197247?v=4", | ||
"profile": "https://github.com/alejandrofdiaz", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "alexgallardo", | ||
"name": "Alejandro Gallardo Escobar", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/7766614?v=4", | ||
"profile": "https://github.com/alexgallardo", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "cicloon", | ||
"name": "Alejandro León", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/818328?v=4", | ||
"profile": "https://github.com/cicloon", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "AlexTemina", | ||
"name": "Alex Temina", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/14157093?v=4", | ||
"profile": "https://github.com/AlexTemina", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "ArianZargaran", | ||
"name": "Arian Zargaran", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/29388744?v=4", | ||
"profile": "http://www.ari.soy/", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "Crismmgg", | ||
"name": "Crismmgg", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/56558107?v=4", | ||
"profile": "https://github.com/Crismmgg", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "inspiratweb", | ||
"name": "Francisco Sánchez", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/6814061?v=4", | ||
"profile": "https://github.com/inspiratweb", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "jalopez", | ||
"name": "Javier López", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/259623?v=4", | ||
"profile": "https://github.com/jalopez", | ||
"contributions": [ | ||
"code" | ||
] | ||
}, | ||
{ | ||
"login": "valenber", | ||
"name": "Valentin Berlin", | ||
"avatar_url": "https://avatars.githubusercontent.com/u/7880641?v=4", | ||
"profile": "https://valya.codes/", | ||
"contributions": [ | ||
"code" | ||
] | ||
} | ||
], | ||
"contributorsPerLine": 7, | ||
"projectName": "package-build-javascript", | ||
"projectOwner": "cabify", | ||
"repoType": "github", | ||
"repoHost": "https://github.com", | ||
"skipCi": true, | ||
"commitConvention": "none" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
*.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = { | ||
extends: ['@cabify'], | ||
overrides: [ | ||
{ | ||
files: ['**/*.js', '**/*.jsx'], | ||
parser: '@babel/eslint-parser', | ||
}, | ||
], | ||
env: { | ||
node: true, | ||
}, | ||
rules: { | ||
'import/prefer-default-export': 'off', | ||
// disable type related rules to make linting faster | ||
'@typescript-eslint/await-thenable': 'off', | ||
'@typescript-eslint/no-misused-promises': 'off', | ||
'@typescript-eslint/no-unnecessary-type-assertion': 'off', | ||
'@typescript-eslint/prefer-includes': 'off', | ||
'@typescript-eslint/prefer-regexp-exec': 'off', | ||
'@typescript-eslint/prefer-string-starts-ends-with': 'off', | ||
'@typescript-eslint/require-await': 'off', | ||
'@typescript-eslint/unbound-method': 'off', | ||
}, | ||
settings: { | ||
'import/resolver': { | ||
'eslint-import-resolver-typescript': false, | ||
node: { | ||
extensions: ['.mjs', '.js', '.json'], | ||
}, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Basic dependabot.yml file with | ||
|
||
version: 2 | ||
updates: | ||
# Enable version updates for npm | ||
- package-ecosystem: 'npm' | ||
# Look for `package.json` and `lock` files in the `root` directory | ||
directory: '/' | ||
# Check the npm registry for updates every day (weekdays) | ||
schedule: | ||
interval: 'weekly' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | ||
|
||
name: Publish package | ||
|
||
on: | ||
workflow_run: | ||
workflows: ['Tests'] | ||
branches: [main] | ||
types: | ||
- completed | ||
push: | ||
branches: | ||
- '!*' | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
publish-npm: | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- uses: JS-DevTools/npm-publish@v1 | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 14.x | ||
cache: 'yarn' | ||
- run: yarn install | ||
- name: Run Lint | ||
run: yarn lint:check | ||
- name: Run Format | ||
run: yarn format:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.eslintrc.js | ||
.eslintignore | ||
.gitignore | ||
.prettierignore | ||
.prettierrc.json | ||
yarn.lock | ||
node_modules | ||
.npmignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"arrowParens": "always", | ||
"useTabs": false, | ||
"tabWidth": 2, | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
|
||
## [Unreleased] | ||
|
||
## [0.0.1] - 2021-11-02 | ||
|
||
- Initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Introduction | ||
|
||
This package is used to build our open sourced tools. Please check that nothing is | ||
broken after contributing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,50 @@ | ||
# package-build-javascript | ||
Package build configuration based on Rollup to compile JS packages | ||
## @cabify/package-build | ||
|
||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
|
||
[![All Contributors](https://img.shields.io/badge/all_contributors-9-orange.svg?style=flat-square)](#contributors-) | ||
|
||
<!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
|
||
Package build configuration based on Rollup to compile JS packages. | ||
|
||
### Usage | ||
|
||
Install this package as a dev dependency in your package, then create scripts in your `package.json` invoking it like this: | ||
|
||
``` | ||
"dist": "package-build", | ||
"dist:watch": "package-build -w", | ||
``` | ||
|
||
NOTICE: this package doesn't clean your build directories in each run, so you'd probably want to append something like `rimraf` to your dependencies. | ||
|
||
## Contributors ✨ | ||
|
||
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): | ||
|
||
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --> | ||
<!-- prettier-ignore-start --> | ||
<!-- markdownlint-disable --> | ||
<table> | ||
<tr> | ||
<td align="center"><a href="https://github.com/alejandrofdiaz"><img src="https://avatars.githubusercontent.com/u/9197247?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alejandro</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=alejandrofdiaz" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/alexgallardo"><img src="https://avatars.githubusercontent.com/u/7766614?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alejandro Gallardo Escobar</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=alexgallardo" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/cicloon"><img src="https://avatars.githubusercontent.com/u/818328?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alejandro León</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=cicloon" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/AlexTemina"><img src="https://avatars.githubusercontent.com/u/14157093?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Alex Temina</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=AlexTemina" title="Code">💻</a></td> | ||
<td align="center"><a href="http://www.ari.soy/"><img src="https://avatars.githubusercontent.com/u/29388744?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Arian Zargaran</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=ArianZargaran" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/Crismmgg"><img src="https://avatars.githubusercontent.com/u/56558107?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Crismmgg</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=Crismmgg" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/inspiratweb"><img src="https://avatars.githubusercontent.com/u/6814061?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Francisco Sánchez</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=inspiratweb" title="Code">💻</a></td> | ||
</tr> | ||
<tr> | ||
<td align="center"><a href="https://github.com/jalopez"><img src="https://avatars.githubusercontent.com/u/259623?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Javier López</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=jalopez" title="Code">💻</a></td> | ||
<td align="center"><a href="https://valya.codes/"><img src="https://avatars.githubusercontent.com/u/7880641?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Valentin Berlin</b></sub></a><br /><a href="https://github.com/cabify/package-build-javascript/commits?author=valenber" title="Code">💻</a></td> | ||
</tr> | ||
</table> | ||
|
||
<!-- markdownlint-restore --> | ||
<!-- prettier-ignore-end --> | ||
|
||
<!-- ALL-CONTRIBUTORS-LIST:END --> | ||
|
||
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
presets: ['@cabify/babel-preset/package'], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env node | ||
|
||
const spawn = require('cross-spawn'); | ||
const path = require('path'); | ||
|
||
const args = process.argv.slice(2); | ||
|
||
const buildPath = path.join(__dirname, '..', 'build.js'); | ||
const buildingPackagePath = process.cwd(); | ||
|
||
const result = spawn.sync('node', [buildPath, ...args], { | ||
stdio: 'inherit', | ||
cwd: buildingPackagePath, | ||
}); | ||
|
||
if (result.signal) { | ||
/* eslint-disable no-console */ | ||
if (result.signal === 'SIGKILL') { | ||
console.log( | ||
'The build failed because the process exited too early. ' + | ||
'This probably means the system ran out of memory or someone called ' + | ||
'`kill -9` on the process.', | ||
); | ||
} else if (result.signal === 'SIGTERM') { | ||
console.log( | ||
'The build failed because the process exited too early. ' + | ||
'Someone might have called `kill` or `killall`, or the system could ' + | ||
'be shutting down.', | ||
); | ||
} | ||
/* eslint-enable */ | ||
process.exit(1); | ||
} | ||
process.exit(result.status); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* eslint-disable no-console */ | ||
|
||
const minimist = require('minimist'); | ||
const rollup = require('rollup'); | ||
const getRollupConfig = require('./getRollupConfig'); | ||
|
||
const watch = (config) => { | ||
const watcher = rollup.watch(config); | ||
|
||
const eventHandler = (event) => { | ||
switch (event.code) { | ||
case 'START': | ||
console.log('Rollup watcher starting...'); | ||
break; | ||
case 'BUNDLE_START': | ||
break; | ||
case 'BUNDLE_END': | ||
break; | ||
case 'END': | ||
console.log( | ||
`Rollup watcher finished bundling in ${event.duration}. Watching for changes...`, | ||
); | ||
|
||
break; | ||
case 'ERROR': | ||
console.error('Rollup watcher error', event); | ||
break; | ||
default: | ||
console.error('Rollup watcher unknown event', event); | ||
} | ||
}; | ||
|
||
watcher.on('event', (event) => eventHandler(event)); | ||
}; | ||
|
||
const build = async (withWatch = false) => { | ||
const dirname = process.cwd(); | ||
console.log(`Bundling ${dirname}`); | ||
const { input, output } = getRollupConfig(dirname); | ||
|
||
if (withWatch) { | ||
watch({ ...input, output }); | ||
} else { | ||
try { | ||
const bundle = await rollup.rollup(input); | ||
await Promise.all( | ||
output.map(async (outputItem) => { | ||
console.log(`Bundling ${outputItem.format} into ${outputItem.file}`); | ||
return bundle.write(outputItem); | ||
}), | ||
); | ||
} catch (err) { | ||
console.error('ERROR BUNDLING: ', dirname); | ||
console.error(err); | ||
process.exit([1]); | ||
throw err; | ||
} | ||
} | ||
}; | ||
|
||
const argv = minimist(process.argv.slice(2)); | ||
|
||
build(argv.w); |
Oops, something went wrong.