Skip to content

Commit

Permalink
chore: refactor build deps & upgrade build scripts (#684)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon authored Apr 12, 2022
1 parent 1725837 commit 7f1b566
Show file tree
Hide file tree
Showing 32 changed files with 13,620 additions and 7,214 deletions.
46 changes: 0 additions & 46 deletions .circleci/config.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"root": true,
"parser": "@typescript-eslint/parser",
"extends": [
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": [
"node_modules",
"dist",
"build",
".vscode",
"*.config.js",
".webpack",
"_warmup",
"**/*.js"
],
"plugins": [],
"parserOptions": {
"ecmaVersion": 2019,
"sourceType": "module"
},
"rules": {
"@typescript-eslint/no-namespace": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/consistent-type-assertions": "off",
"@typescript-eslint/ban-ts-ignore": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"prefer-const": "off",
"@typescript-eslint/ban-types": "off"
}
}
76 changes: 76 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<!--
BUGS: Please use this template.
SUPPORT REQUESTS/QUESTIONS: If you have a support request or question please
submit them to StackOverflow using the tags aurelia and aurelia-framework
http://stackoverflow.com/questions/tagged/aurelia
or the Aurelia Gitter https://gitter.im/aurelia/discuss
Blue Spire offers paid support agreements. Further information regarding paid support
may be obtained by emailing support@bluespire.com
Future support requests submitted here will be closed.
The HTML comments below are for your reference, and are not displayed
when your issue is submitted, feel free to leave them.
Choose one of the two headings, delete the other.
-->
**I'm submitting a bug report**
**I'm submitting a feature request**

* **Library Version:**
major.minor.patch-pre


**Please tell us about your environment:**
* **Operating System:**
OSX 10.x|Linux (distro)|Windows [7|8|8.1|10]

* **Node Version:**
6.2.0
<!--
Minimum supported Node version is latest Node 4.x LTS
run `node -v`
-->

* **NPM Version:**
3.8.9
<!--
Minimum supported NPM version is 3.x
run `npm -v`
-->

* **JSPM OR Webpack AND Version**
JSPM 0.16.32 | webpack 2.1.0-beta.17
<!--
If using JSPM
run `jspm -v`
If using Webpack
run `webpack --help | grep webpack`
-->

* **Browser:**
all | Chrome XX | Firefox XX | Edge XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView

* **Language:**
all | TypeScript X.X | ESNext


**Current behavior:**


**Expected/desired behavior:**
<!--
If the current behavior is a bug, please provide the steps to reproduce and, if possible, a minimal demo of the
problem along with a runnable gist, if possible.
To create a runnable gist, go to https://gist.run/?id=7542e061bc940cde506b&sha=6821c521a6c7bae6f59a36fb8628ecd1032b2d10
Then click "Fork to Public Gist".
Create your gist, then finally click "Update Gist." Include a link to the gist.run below.
-->


* **What is the expected behavior?**


* **What is the motivation / use case for changing the behavior?**
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: main
on: [push]

jobs:

ci:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14
- run: npm ci
- run: npm run cut-release
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ bower_components
.DS_STORE
.rollupcache
build/reports
.npmrc
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib",
"tslint.autoFixOnSave": true
"typescript.tsdk": "node_modules/typescript/lib"
}
46 changes: 29 additions & 17 deletions build/scripts/build.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
// @ts-check
const rollup = require('rollup');
const typescript = require('rollup-plugin-typescript2');
/** @type {(options: import('@rollup/plugin-typescript').RollupTypescriptOptions) => import('rollup').Plugin} */
// @ts-ignore
const typescript = require('@rollup/plugin-typescript');
const rimraf = require('rimraf');

const LIB_NAME = 'aurelia-router';
const cacheRoot = '.rollupcache';
const externalLibs = [
'aurelia-binding',
'aurelia-templating',
'aurelia-path',
'aurelia-dependency-injection',
'aurelia-event-aggregator',
'aurelia-logging',
Expand All @@ -24,7 +30,7 @@ function clean() {
if (error) {
throw error;
}
resolve();
resolve(void 0);
});
});
}
Expand All @@ -48,26 +54,37 @@ function generateDts() {

function build() {
console.log('\n==============\nBuidling...\n==============');
const inputFileName = `src/${LIB_NAME}.ts`;

return Promise.all([
{
input: `src/${LIB_NAME}.ts`,
input: inputFileName,
output: [
{ file: `dist/es2015/${LIB_NAME}.js`, format: 'es', sourcemap: true }
],
external: externalLibs,
plugins: [
typescript({
tsconfigOverride: {
compilerOptions: {
target: 'es2015'
}
},
cacheRoot: cacheRoot
target: 'es2015',
removeComments: true,
}),
]
},
{
input: inputFileName,
output: [
{ file: `dist/es2017/${LIB_NAME}.js`, format: 'es', sourcemap: true }
],
external: externalLibs,
plugins: [
typescript({
target: 'es2017',
removeComments: true,
}),
]
},
{
input: `src/${LIB_NAME}.ts`,
input: inputFileName,
output: [
{ file: `dist/commonjs/${LIB_NAME}.js`, format: 'cjs', sourcemap: true },
{ file: `dist/amd/${LIB_NAME}.js`, format: 'amd', amd: { id: LIB_NAME }, sourcemap: true },
Expand All @@ -76,13 +93,8 @@ function build() {
external: externalLibs,
plugins: [
typescript({
useTsconfigDeclarationDir: true,
tsconfigOverride: {
compilerOptions: {
target: 'es5'
}
},
cacheRoot: cacheRoot
target: 'es5',
removeComments: true,
}),
]
}
Expand Down
64 changes: 33 additions & 31 deletions build/scripts/dev.js
Original file line number Diff line number Diff line change
@@ -1,63 +1,62 @@
// @ts-check
const args = require('../tasks/args');
const rollup = require('rollup');
const typescript = require('rollup-plugin-typescript2');
/** @type {(options: import('@rollup/plugin-typescript').RollupTypescriptOptions) => import('rollup').Plugin} */
// @ts-ignore
const typescript = require('@rollup/plugin-typescript');
const ChildProcess = require('child_process');
const pkg = require('../../package.json');

const targetFormats = args.format || ['commonjs']; // by default only run devs for commonjs
const targetDir = args.target;

const LIB_NAME = pkg.name;

const buildConfigs = {
es2015: {
output: {
file: 'dist/es2015/index.js',
file: `dist/es2015/${LIB_NAME}.js`,
format: 'es'
},
tsConfig: {
tsconfigOverride: {
compilerOptions: {
target: 'es2015'
}
}
target: 'es2015'
}
},
es2017: {
output: {
file: `dist/es2017/${LIB_NAME}.js`,
format: 'es'
},
tsConfig: {
target: 'es2015'
}
},
amd: {
output: {
file: 'dist/amd/index.js',
file: `dist/amd/${LIB_NAME}.js`,
format: 'amd',
amd: { id: 'aurelia-router' }
amd: { id: LIB_NAME }
},
tsConfig: {
tsconfigOverride: {
compilerOptions: {
target: 'es5'
}
}
target: 'es5'
}
},
commonjs: {
output: {
file: 'dist/commonjs/index.js',
file: `dist/commonjs/${LIB_NAME}.js`,
format: 'cjs'
},
tsConfig: {
tsconfigOverride: {
compilerOptions: {
target: 'es5'
}
}
target: 'es5'
}
},
'native-modules': {
output: {
file: 'dist/commonjs/index.js',
file: `dist/commonjs/${LIB_NAME}.js`,
format: 'es'
},
tsConfig: {
tsconfigOverride: {
compilerOptions: {
target: 'es5'
}
}
target: 'es5'
}
}
};
Expand All @@ -69,19 +68,22 @@ console.log('Running dev with targets:', targetFormats);
*/
async function roll(format) {
const inputOptions = {
input: 'src/index.ts',
input: 'src/aurelia-router.ts',
external: [
'aurelia-binding',
'aurelia-path',
'aurelia-templating',
'aurelia-dependency-injection',
'aurelia-event-aggregator',
'aurelia-logging',
'aurelia-history',
'aurelia-route-recognizer'
],
plugins: [
typescript(Object.assign(
{ cacheRoot: '.rollupcache' },
buildConfigs[format].tsConfig
))
typescript({
target: buildConfigs[format].tsConfig.target,
removeComments: true
})
]
};
console.log('Starting watcher');
Expand Down
Loading

0 comments on commit 7f1b566

Please sign in to comment.