Skip to content
This repository was archived by the owner on Nov 9, 2022. It is now read-only.

Commit 65ef6b7

Browse files
committed
Adds typescript and rollup complication
1 parent 6827e8a commit 65ef6b7

12 files changed

+2601
-120
lines changed

.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-env"]
3+
}

.editorconfig

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

.eslintignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build

.eslintrc.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
3+
parserOptions: {
4+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
5+
sourceType: 'module', // Allows for the use of imports
6+
ecmaFeatures: {
7+
jsx: true, // Allows for the parsing of JSX
8+
},
9+
},
10+
extends: [
11+
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
12+
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
13+
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and eslint-config-prettier. This will display prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
14+
],
15+
}

.npmignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
# dependencies
44
/node_modules
55

6-
76
# misc
87
.DS_Store
98

@@ -22,5 +21,5 @@ tmp
2221
rollup.config.js
2322
tsconfig.json
2423

25-
docs/
2624
src/
25+
images/

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
semi: false,
3+
trailingComma: "all",
4+
singleQuote: true,
5+
printWidth: 80,
6+
tabWidth: 2
7+
};

index.js

-105
This file was deleted.

package.json

+48-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,59 @@
11
{
22
"name": "streamlinehq",
33
"version": "0.0.1",
4+
"private": false,
45
"description": "Universal NPM package for Streamline visual assets.",
5-
"main": "index.js",
6-
"scripts": {
7-
"start": "yarn node index.js"
8-
},
9-
"engines": {
10-
"node": "14.15.0",
11-
"npm": "6.14.8"
6+
"keywords": [
7+
"streamline",
8+
"streamline-icons",
9+
"icons",
10+
"svg",
11+
"illustrations"
12+
],
13+
"author": "Webalys",
14+
"homepage": "https://github.com/webalys-hq/streamlinehq-npm#readme",
15+
"license": "MIT",
16+
"bugs": {
17+
"email": "[email protected]",
18+
"url": "https://github.com/webalys-hq/streamlinehq-npm/issues"
1219
},
13-
"type": "module",
1420
"repository": {
1521
"type": "git",
1622
"url": "git+https://github.com/webalys-hq/streamlinehq-npm.git"
1723
},
18-
"author": "Webalys",
19-
"license": "MIT",
20-
"bugs": {
21-
"url": "https://github.com/webalys-hq/streamlinehq-npm/issues"
24+
"main": "build/index.js",
25+
"types": "build/index.d.ts",
26+
"scripts": {
27+
"build": "NODE_ENV=production rollup -c",
28+
"dev": "NODE_ENV=development rollup -c -w",
29+
"start": "yarn node build/index.js",
30+
"lint": "eslint 'src/index.ts' --quiet --fix"
31+
},
32+
"engines": {
33+
"node": "14.15.0",
34+
"npm": "6.14.8"
2235
},
23-
"homepage": "https://github.com/webalys-hq/streamlinehq-npm#readme"
36+
"browserslist": [
37+
"defaults"
38+
],
39+
"dependencies": {},
40+
"devDependencies": {
41+
"@babel/core": "^7.12.3",
42+
"@babel/preset-env": "^7.12.1",
43+
"@rollup/plugin-babel": "^5.2.1",
44+
"@rollup/plugin-commonjs": "^16.0.0",
45+
"@rollup/plugin-node-resolve": "^10.0.0",
46+
"@rollup/plugin-replace": "^2.3.4",
47+
"@rollup/plugin-typescript": "^6.1.0",
48+
"@typescript-eslint/eslint-plugin": "^4.8.1",
49+
"@typescript-eslint/parser": "^4.8.1",
50+
"eslint": "^7.14.0",
51+
"eslint-config-prettier": "^6.15.0",
52+
"eslint-plugin-prettier": "^3.1.4",
53+
"prettier": "^2.2.0",
54+
"rollup": "^2.33.3",
55+
"rollup-plugin-terser": "^7.0.2",
56+
"tslib": "^2.0.3",
57+
"typescript": "^4.1.2"
58+
}
2459
}

rollup.config.js

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import replace from '@rollup/plugin-replace'
2+
import babel from '@rollup/plugin-babel'
3+
import commonjs from '@rollup/plugin-commonjs'
4+
import resolve from '@rollup/plugin-node-resolve'
5+
import { terser } from 'rollup-plugin-terser'
6+
import typescript from '@rollup/plugin-typescript'
7+
8+
const NODE_ENV = process.env.NODE_ENV || 'development'
9+
10+
export default {
11+
input: 'src/index.ts',
12+
output: {
13+
dir: 'build',
14+
format: 'cjs',
15+
sourcemap: true,
16+
},
17+
plugins: [
18+
replace({
19+
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
20+
preventAssignment: true,
21+
}),
22+
babel({
23+
exclude: 'node_modules/**',
24+
babelHelpers: 'runtime'
25+
}),
26+
resolve({preferBuiltins: true}),
27+
commonjs(),
28+
typescript({
29+
declaration: true,
30+
declarationDir: 'build',
31+
rootDir: 'src/',
32+
}),
33+
terser(),
34+
],
35+
}

0 commit comments

Comments
 (0)