Skip to content

Commit 494c4d5

Browse files
committed
Merge branch 'release/2.0.0-beta.0'
2 parents e5d5fb3 + f65d54b commit 494c4d5

File tree

251 files changed

+14556
-24117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

251 files changed

+14556
-24117
lines changed

.eslintrc.cjs

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
module.exports = {
22
extends: '@studiometa/eslint-config',
3-
globals: {
4-
window: false,
5-
document: false,
6-
requestAnimationFrame: false,
7-
IntersectionObserver: false,
8-
Image: false,
9-
KeyboardEvent: false,
10-
globalThis: false,
11-
__DEV__: true,
12-
},
133
rules: {
144
'import/extensions': ['error', 'always', { ignorePackages: true }],
15-
'class-methods-use-this': 'off',
16-
'no-underscore-dangle': [
17-
'error',
18-
{ allow: [ '__base__', '_excludeFromAutoBind', '__DEV__' ] },
19-
],
5+
'no-underscore-dangle': 'off',
206
},
217
overrides: [
228
{

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
path_to_write_report: ./codecov_report.txt
3434
verbose: true
3535

36-
- run: cd dist && ls -al && npm publish
36+
- run: cd dist && ls -al && npm publish --tag next
3737
env:
3838
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
3939

.github/workflows/tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: actions/checkout@v1
1616
- uses: actions/setup-node@v1
1717
with:
18-
node-version: 15
18+
node-version: 16
1919
- name: Install modules
2020
run: npm install
2121
- name: Build the package
@@ -27,7 +27,7 @@ jobs:
2727
- uses: actions/checkout@v1
2828
- uses: actions/setup-node@v1
2929
with:
30-
node-version: 15
30+
node-version: 16
3131
- name: Install modules
3232
run: npm install
3333
- name: Run code quality tests
@@ -41,7 +41,7 @@ jobs:
4141
- uses: actions/checkout@v1
4242
- uses: actions/setup-node@v1
4343
with:
44-
node-version: 15
44+
node-version: 16
4545
- name: Install modules
4646
run: npm install
4747
- name: Run tests

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
node_modules/
66
yarn.lock
77
.cache/
8+
packages/**/package-lock.json
89

910
# Log files
1011
npm-debug.log*

README.md

Lines changed: 27 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# JS Toolkit
22

33
[![NPM Version](https://img.shields.io/npm/v/@studiometa/js-toolkit.svg?style=flat-square)](https://www.npmjs.com/package/@studiometa/js-toolkit/)
4-
[![Dependency Status](https://img.shields.io/david/studiometa/js-toolkit.svg?label=deps&style=flat-square)](https://david-dm.org/studiometa/js-toolkit)
5-
[![devDependency Status](https://img.shields.io/david/dev/studiometa/js-toolkit.svg?label=devDeps&style=flat-square)](https://david-dm.org/studiometa/js-toolkit?type=dev)
4+
[![Size](https://img.shields.io/bundlephobia/minzip/@studiometa/js-toolkit?label=size&style=flat-square)](https://bundlephobia.com/package/@studiometa/js-toolkit)
5+
[![Dependency Status](https://img.shields.io/librariesio/release/npm/@studiometa/js-toolkit?style=flat-square)](https://david-dm.org/studiometa/js-toolkit)
66
![Codecov](https://img.shields.io/codecov/c/github/studiometa/js-toolkit?style=flat-square)
77

88
> A set of useful little bits of JavaScript to boost your project! 🚀
@@ -15,37 +15,32 @@ Install the latest version via NPM:
1515
npm install @studiometa/js-toolkit
1616
```
1717

18-
The package can be used directly with the [Skypack CDN](https://www.skypack.dev) as follow:
19-
20-
```html
21-
<script type="module">
22-
// Import the Base class
23-
import Base from 'https://cdn.skypack.dev/@studiometa/js-toolkit/';
24-
// Import the full toolkit
25-
import * as components from 'https://cdn.skypack.dev/@studiometa/js-toolkit/components';
26-
import * as decorators from 'https://cdn.skypack.dev/@studiometa/js-toolkit/decorators';
27-
import * as services from 'https://cdn.skypack.dev/@studiometa/js-toolkit/services';
28-
import * as utils from 'https://cdn.skypack.dev/@studiometa/js-toolkit/utils';
29-
</script>
30-
```
18+
## Concept
3119

32-
## Usage
20+
[] todo
3321

34-
### Modern JS with bundler
22+
## Usage
3523

36-
Import the `Base` class to create your components from your `node_modules`:
24+
Import the `Base` class and extend it to create your components:
3725

3826
```js
39-
import Base from '@studiometa/js-toolkit';
40-
import Modal from '@studiometa/js-toolkit/components/Modal';
27+
import { Base, createApp } from '@studiometa/js-toolkit';
28+
29+
class Component extends Base {
30+
static config = {
31+
name: 'Component',
32+
}
33+
34+
sayHello() {
35+
console.log('Hello!');
36+
}
37+
}
4138

4239
class App extends Base {
4340
static config = {
4441
name: 'App',
45-
log: true,
46-
debug: true,
4742
components: {
48-
Modal,
43+
Component,
4944
},
5045
refs: ['btn', 'items[]'],
5146
options: {
@@ -60,16 +55,16 @@ class App extends Base {
6055
// Options
6156
this.$options.name; // 'App'
6257
this.$options.log; // true
63-
this.$options.debug; // true
58+
this.$options.debug; // false
6459
this.$options.foo // ''
6560
this.$options.bar // 'bar'
6661

6762
// Children
68-
this.$children.Modal; // Array<Modal>
63+
this.$children.Component; // Array<Component>
6964

7065
// DOM references
7166
this.$refs.btn; // <button data-ref="btn"></button>
72-
this.$refs.items; // <li data-ref="items[]"></li>
67+
this.$refs.items[0]; // <li data-ref="items[]"></li>
7368
}
7469

7570
destroyed() {
@@ -85,58 +80,15 @@ class App extends Base {
8580
}
8681
}
8782

88-
export default new App(document.querySelector('#app'));
83+
export default createApp(App, document.body);
8984
```
9085

91-
Read the [documentation](https://js-toolkit.meta.fr/) to learn more.
86+
Read the [documentation](https://js-toolkit.studiometa.dev/) to learn more.
9287

93-
### Modern JS in browser
88+
## Contribution
9489

95-
Two modern builds are provided for prototyping purpose, they can be used as follow:
90+
This projects follows the [Git Flow](https://github.com/petervanderdoes/gitflow-avh) methodology to manage its branches and features.
9691

97-
```html
98-
<script type="module">
99-
// Import the Base class
100-
import Base from 'https://cdn.skypack.dev/@studiometa/js-toolkit/';
101-
// Import the full toolkit
102-
import Modal from 'https://cdn.skypack.dev/@studiometa/js-toolkit/components/Modal';
103-
</script>
104-
```
92+
The packages from this project are managed with NPM workspaces.
10593

106-
### Legacy JS
107-
108-
Two UMD builds are also provided to be used in legacy projects.
109-
110-
```html
111-
<div id="app">
112-
<button data-ref="btn">Add more</button>
113-
<input data-ref="input" value="0" readonly />
114-
<div data-component="Component"></div>
115-
</div>
116-
<script src="https://unpkg.com/@studiometa/js-toolkit/index.umd.js"></script>
117-
<script>
118-
var Component = Base.defineComponent({
119-
config: {
120-
name: 'Component',
121-
},
122-
});
123-
124-
Base.createBase(document.querySelector('#app'), {
125-
config: {
126-
name: 'App',
127-
log: true,
128-
components: {
129-
Component: Component,
130-
},
131-
},
132-
mounted: function() {
133-
this.$log('mounted');
134-
},
135-
methods: {
136-
onBtnClick: function() {
137-
this.$refs.input.value = Number(this.$refs.input.value) + 1;
138-
},
139-
},
140-
});
141-
</script>
142-
```
94+
The files are linted with ESLint, type checked with TypeScript and formatted with Prettier.

babel.config.cjs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,14 @@ module.exports = {
44
'@babel/preset-env',
55
{
66
modules: false,
7+
targets: {
8+
esmodules: true,
9+
},
710
},
811
],
912
],
1013
plugins:
1114
process.env.NODE_TARGET === 'bundle'
1215
? ['@babel/plugin-proposal-class-properties']
13-
: [
14-
'@babel/plugin-transform-runtime',
15-
'@babel/plugin-proposal-class-properties',
16-
'babel-plugin-add-import-extension',
17-
],
18-
parserOpts: {
19-
plugins: ['dynamicImport', 'classProperties'],
20-
},
16+
: ['@babel/plugin-transform-runtime', 'babel-plugin-add-import-extension'],
2117
};

0 commit comments

Comments
 (0)